WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Samples from Users
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Scan for Modem Descriptor and Generate a MIF File

Keywords:   modem scan

;TITLE:modem_scan.wbt
;DATE:9/23/98
;AUTHOR:Rob Schultz
;VERSION:1.0
;UPDATED:
;PURPOSE:To scan NT machines for their Modem descriptor, generate a mif file, and place it into the NOIDMIFS folder for import to SMS

;Gosub parameters
mode=0
;if mode==2 then goto help
Gosub find_sms  ;only necessary if it is SMS dependent
Gosub find_mif_dir ;only necessary if you are using a mif file.  change the mif name here
;Gosub add_extenders
Gosub init_vars
;Gosub welcome
Gosub delete_mif
Gosub create_mif
Gosub code
Gosub finish_mif
Gosub move_mif
;Gosub finished
Goto ender

;insert new code below
:code
;    If mode==1 then BoxOpen("Installing!",progtext)
;    If mode==1 then Gosub progress_bar ; call this routine everytime you want the progress bar to go up
;    If mode==1 then BoxShut()    

flag=1
  if RegExistKey(@REGMACHINE,"SOFTWARE\Microsoft\Windows\CurrentVersion\Unimodem")==@FALSE then flag=0
  if RegExistKey(@REGMACHINE,"SOFTWARE\Microsoft\Windows\CurrentVersion\Unimodem\DeviceSpecific")==@FALSE then flag=0
  if flag==0 then goto skip_modem_scan
  keys=RegOpenKey(@REGMACHINE,"SOFTWARE\Microsoft\Windows\CurrentVersion\Unimodem\DeviceSpecific")
  modemlist=RegQueryKeys(keys)
  RegCloseKey(keys)
  if modemlist=="" then flag=0
:skip_modem_scan
  if flag==0
    line = '    {"No Modems Found"}'
    FileWrite(fh,line)
  EndIf
  if flag==1
    for count=1 to ItemCount(modemlist,@TAB)
      modem=ItemExtract(count,modemlist,@TAB)
      if StrLen(modem)>128 then modem=StrSub(modem,1,128)
      modem=StrReplace(modem,"\","/")
      line='    {"%modem%"}'
      FileWrite(fh,line)      
    next count
  End If
Return

:progress_bar
  progshow=StrCat(progtext,StrSub(progress,1,progcount),">")
  BoxText(progshow)
  progcount=progcount+1
  if progcount>55 then progcount=1
Return
  
:init_vars
;  batch=IniReadPvt("Install Locations","Batch","",locpath)  ; shouldn't change
;  files=IniReadPvt("Install Locations","Files","",locpath)  ; shouldn't change
;  locpath="\\ntsms1\permanent\installation.ini"             ; shouldn't change
;  fixlocation="ie4jsfix\scr31en.exe"                        ; should change per program
  system=DirWindows(1)
  winnt=DirWindows(0)
  temp=Environment("TEMP")
  progress="-----------------------------------------------------------------------"
  progtext="Please wait "
  progcount=1
Return

:find_sms 
  drives=DiskScan(2)
  pos=1
  flag=0
  numdrives=ItemCount(drives,@TAB)
  for pos=1 to numdrives
    disk=ItemExtract(pos,drives,@TAB)  
    If FileExist("%disk%\sms.ini")==@TRUE
      sms_path="%disk%\sms.ini)"
      flag=1
    EndIf
  Next pos
  If flag==0 then goto no_sms  
Return

:find_mif_dir
  mifpath=IniReadPvt("SMS","MachineISVMIFPath","C:\MS\SMS\noidmifs",sms_path)
  mifname="modem_scan.mif"
  mifsave=StrCat(mifpath,"\%mifname%")
Return

:create_mif
msg='Start Component%@CRLF%'
msg=StrCat(msg,'  Name  = "ModemScan"',@CRLF)
msg=StrCat(msg,'  Start Group',@CRLF)
msg=StrCat(msg,'    Name  = "Modem Scan"',@CRLF)
msg=StrCat(msg,'    Class = "Company Name|ModemScan|1.0"',@CRLF)
msg=StrCat(msg,'    Key   = 1',@CRLF)
msg=StrCat(msg,'    Start Attribute',@CRLF)
msg=StrCat(msg,'      ID          = 1',@CRLF)
msg=StrCat(msg,'      Name        = "Modem Descriptor"',@CRLF)
msg=StrCat(msg,'      Description = "The name of the modem according to NT"',@CRLF)
msg=StrCat(msg,'      Storage     = Common',@CRLF)
msg=StrCat(msg,'      Type        = String(128)',@CRLF)
msg=StrCat(msg,'      Value       = ""',@CRLF)
msg=StrCat(msg,'    End Attribute',@CRLF)
msg=StrCat(msg,'  End Group',@CRLF)
msg=StrCat(msg,'  Start Table',@CRLF)
msg=StrCat(msg,'    Name  = "Modem Scan"',@CRLF)
msg=StrCat(msg,'    Class = "Company Name|ModemScan|1.0"',@CRLF)
msg=StrCat(msg,'    Id  = 20')
fh=FileOpen("%temp%\%mifname%", "WRITE")
FileWrite(fh,msg)
Return

:finish_mif
msg='  End Table%@CRLF%'
msg=StrCat(msg,'End Component',@CRLF)
FileWrite(fh,msg)
FileClose(fh)
Return

:delete_mif
  If FileExist("%temp%\%mifname%")==@TRUE then FileDelete("%temp%\%mifname%")
Return

:move_mif
  FileMove("%temp%\%mifname%","%mifpath%\%mifname%",@FALSE)
Return

:add_extenders
Return

:parameters
;this section is disabled by default
mode=1    ;mode=0=silent   mode=1=interactive   be sure to modify any message   default is interactive
if param0<>0
  if param1=="/q" then mode=0
  if param1=="/i" then mode=1
  if param1=="/?" then mode=2
EndIf
Return

:welcome
  If mode==1 then Message("Welcome!","text here")
Return

:finished
  If mode==1 then Message("Finished!","text here")
Return

:help
  Message("Help","These are the switches available for this program...%@CRLF%%@CRLF%/q = quiet install%@CRLF%/i = interactive install%@CRLF%/? = this screen")
Goto ender

:no_sms
  If mode==1 then Message("ERROR!","SMS does not exist on this PC.")
Goto ender

:ender
Exit

Article ID:   W14296
Filename:   Modem Scan - Get Descriptor.txt
File Created: 1999:10:26:11:23:08
Last Updated: 1999:10:26:11:23:08