MyFlight
Technical User
- Feb 4, 2002
- 193
QUESTION,
I have written a script file to import and create dialing directories. Which anyone is welcome to use.
However I am wondering if there is a way to make it more flexible.
proc main
integer iVar, iLen, iTok6, iTok7 ;Number of entries in dialing class
string sLine, sTok1, sTok2, sTok3, sTok4, sTok5
string sTok6, sTok7, sTok8, sTok9, sTok10, sTok11
string sTok12, sTok13, sTok14
string sNewSwitchDir ;Name of New Connection Directory
string sSwitchImportDir = "Switches.csv"
string sImportPath = "C:\Temp Data Files\Raw Data\"
string sNewPath = "C:\Program Files\Symantec\ProComm Plus\"
string sCapPath = "C:\Program Files\Symantec\ProComm Plus\Capture\"
string sOne = "9005 CBX's"
string sTwo = "9006 CBX's"
string sThree = "Other CBX's"
chdir sImportPath
isfile sSwitchImportDir ivar ; Verifies that File does Exist.
if SUCCESS
fopen 1 sSwitchImportDir READWRITE TEXT ; Opens Text File
pause 2
chdir sNewPath
if sdlginput "Create Directory" "Name:" sNewSwitchDir
if not nullstr sNewSwitchDir ; Make sure name isn't empty.
dialcreate sNewSwitchDir ; Create the Dialing Directory.
endif
endif
dialadd DATA GROUP sOne ;Add group called '9005 CBX's'
dialadd DATA GROUP sTwo ;Add group called '9005 CBX's'
dialadd DATA GROUP sThree ;Add group called '9005 CBX's'
while not feof 1
fgets 1 sLine
strlen sLine iLen
strtok sTok1 sLine "," 1 ;Site Name
strtok sTok2 sLine "," 1 ;State
strtok sTok3 sLine "," 1 ;Network ID Number
strtok sTok4 sLine "," 1 ;Area Code
strtok sTok5 sLine "," 1 ;Phone Number
strtok sTok6 sLine "," 1 ;Only Dial Data Number
strtok sTok7 sLine "," 1 ;Long Distance
strtok sTok8 sLine "," 1 ;CMR Number
strtok sTok9 sLine "," 1 ;Login
strtok sTok10 sLine "," 1 ;Password
strtok sTok11 sLine "," 1 ;Switch Type
strtok sTok12 sLine "," 1 ;Script File Name
strtok sTok13 sLine "," 1 ;capture File Name
; strtok sTok14 sLine "," 1 ;capture File Name
atoi sTok6 iTok6
atoi sTok7 iTok7
strcat sTok1 sTok2
strcat sTok1 sTok3
usermsg "`"%s`" FOUND." sTok1
if strfind "9005" sTok11 ;Check for target text in string.
; usermsg "Target string found in search string!"
dialadd DATA sTok1 ;Add Dial Entry
set dialentry access DATA sTok1 ;Turn on dialentry for the current entry
set dialentry areacode sTok4
set dialentry phonenumber sTok5
set dialentry dialnumberonly iTok6
set dialentry longdistance iTok7
set dialentry company sTok8
set userid sTok9
set password sTok10
set misc sTok11
set dialentry scriptfile sTok12
set dialentry scriptstart DIALED
set capture path sCapPath
set capture file sTok13
set capture autostart ON
dialinsert DATA sOne sTok1 ;Insert entry into '9005 Folder'
endif
if strfind "9006" sTok11 ;Check for target text in string.
; usermsg "Target string found in search string!"
dialadd DATA sTok1 ;Add Dial Entry
set dialentry access DATA sTok1 ;Turn on dialentry for the current entry
set dialentry areacode sTok4
set dialentry phonenumber sTok5
set dialentry dialnumberonly iTok6
set dialentry longdistance iTok7
set dialentry company sTok8
set userid sTok9
set password sTok10
set misc sTok11
set dialentry scriptfile sTok12
set dialentry scriptstart DIALED
set capture path sCapPath
set capture file sTok13
set capture autostart ON
dialinsert DATA sTwo sTok1 ;Insert entry into '9006 Folder'
endif
if strfind "Other" sTok11 ;Check for target text in string.
; usermsg "Target string found in search string!"
dialadd DATA sTok1 ;Add Dial Entry
set dialentry access DATA sTok1 ;Turn on dialentry for the current entry
set dialentry areacode sTok4
set dialentry phonenumber sTok5
set dialentry dialnumberonly iTok6
set dialentry longdistance iTok7
set dialentry company sTok8
set userid sTok9
set password sTok10
set misc sTok11
set dialentry scriptfile sTok12
set dialentry scriptstart DIALED
set capture path sCapPath
set capture file sTok13
set capture autostart ON
dialinsert DATA sThree sTok1 ;Insert entry into 'Other Folder'
endif
endwhile
dialsave ;List'group and Save the Connection Directory
fclose 1
else
usermsg "Can't Find FILE Switch.csv"
exit
endif
endproc
Currently I am using th sTok1 thru sTok15 variables and assigning them too cenrtian columns from the Switches.clv file. Is there a way I can prompt the User to input the column numbers for various data entry fields.
EXAMPLE:
+------------------------------------------------+
| PLEASE INPUT THE YOUR COLUMN NUMBERS |
| |
| Site Name: ___ |
| |
| State: ___ |
| |
| CMR: ___ |
| |
| Area Code: ___ |
| |
| Phone Number: ___ |
| |
+------------------------------------------------+
and using the column nubers entered I then import any spreadsheet no matter where the columns line up. Also this alliviates the need for the user to setup the excel spreadsheet in a certain way.
Your assisrtance in this matter will be fgreatly appreciated.
I have written a script file to import and create dialing directories. Which anyone is welcome to use.
However I am wondering if there is a way to make it more flexible.
proc main
integer iVar, iLen, iTok6, iTok7 ;Number of entries in dialing class
string sLine, sTok1, sTok2, sTok3, sTok4, sTok5
string sTok6, sTok7, sTok8, sTok9, sTok10, sTok11
string sTok12, sTok13, sTok14
string sNewSwitchDir ;Name of New Connection Directory
string sSwitchImportDir = "Switches.csv"
string sImportPath = "C:\Temp Data Files\Raw Data\"
string sNewPath = "C:\Program Files\Symantec\ProComm Plus\"
string sCapPath = "C:\Program Files\Symantec\ProComm Plus\Capture\"
string sOne = "9005 CBX's"
string sTwo = "9006 CBX's"
string sThree = "Other CBX's"
chdir sImportPath
isfile sSwitchImportDir ivar ; Verifies that File does Exist.
if SUCCESS
fopen 1 sSwitchImportDir READWRITE TEXT ; Opens Text File
pause 2
chdir sNewPath
if sdlginput "Create Directory" "Name:" sNewSwitchDir
if not nullstr sNewSwitchDir ; Make sure name isn't empty.
dialcreate sNewSwitchDir ; Create the Dialing Directory.
endif
endif
dialadd DATA GROUP sOne ;Add group called '9005 CBX's'
dialadd DATA GROUP sTwo ;Add group called '9005 CBX's'
dialadd DATA GROUP sThree ;Add group called '9005 CBX's'
while not feof 1
fgets 1 sLine
strlen sLine iLen
strtok sTok1 sLine "," 1 ;Site Name
strtok sTok2 sLine "," 1 ;State
strtok sTok3 sLine "," 1 ;Network ID Number
strtok sTok4 sLine "," 1 ;Area Code
strtok sTok5 sLine "," 1 ;Phone Number
strtok sTok6 sLine "," 1 ;Only Dial Data Number
strtok sTok7 sLine "," 1 ;Long Distance
strtok sTok8 sLine "," 1 ;CMR Number
strtok sTok9 sLine "," 1 ;Login
strtok sTok10 sLine "," 1 ;Password
strtok sTok11 sLine "," 1 ;Switch Type
strtok sTok12 sLine "," 1 ;Script File Name
strtok sTok13 sLine "," 1 ;capture File Name
; strtok sTok14 sLine "," 1 ;capture File Name
atoi sTok6 iTok6
atoi sTok7 iTok7
strcat sTok1 sTok2
strcat sTok1 sTok3
usermsg "`"%s`" FOUND." sTok1
if strfind "9005" sTok11 ;Check for target text in string.
; usermsg "Target string found in search string!"
dialadd DATA sTok1 ;Add Dial Entry
set dialentry access DATA sTok1 ;Turn on dialentry for the current entry
set dialentry areacode sTok4
set dialentry phonenumber sTok5
set dialentry dialnumberonly iTok6
set dialentry longdistance iTok7
set dialentry company sTok8
set userid sTok9
set password sTok10
set misc sTok11
set dialentry scriptfile sTok12
set dialentry scriptstart DIALED
set capture path sCapPath
set capture file sTok13
set capture autostart ON
dialinsert DATA sOne sTok1 ;Insert entry into '9005 Folder'
endif
if strfind "9006" sTok11 ;Check for target text in string.
; usermsg "Target string found in search string!"
dialadd DATA sTok1 ;Add Dial Entry
set dialentry access DATA sTok1 ;Turn on dialentry for the current entry
set dialentry areacode sTok4
set dialentry phonenumber sTok5
set dialentry dialnumberonly iTok6
set dialentry longdistance iTok7
set dialentry company sTok8
set userid sTok9
set password sTok10
set misc sTok11
set dialentry scriptfile sTok12
set dialentry scriptstart DIALED
set capture path sCapPath
set capture file sTok13
set capture autostart ON
dialinsert DATA sTwo sTok1 ;Insert entry into '9006 Folder'
endif
if strfind "Other" sTok11 ;Check for target text in string.
; usermsg "Target string found in search string!"
dialadd DATA sTok1 ;Add Dial Entry
set dialentry access DATA sTok1 ;Turn on dialentry for the current entry
set dialentry areacode sTok4
set dialentry phonenumber sTok5
set dialentry dialnumberonly iTok6
set dialentry longdistance iTok7
set dialentry company sTok8
set userid sTok9
set password sTok10
set misc sTok11
set dialentry scriptfile sTok12
set dialentry scriptstart DIALED
set capture path sCapPath
set capture file sTok13
set capture autostart ON
dialinsert DATA sThree sTok1 ;Insert entry into 'Other Folder'
endif
endwhile
dialsave ;List'group and Save the Connection Directory
fclose 1
else
usermsg "Can't Find FILE Switch.csv"
exit
endif
endproc
Currently I am using th sTok1 thru sTok15 variables and assigning them too cenrtian columns from the Switches.clv file. Is there a way I can prompt the User to input the column numbers for various data entry fields.
EXAMPLE:
+------------------------------------------------+
| PLEASE INPUT THE YOUR COLUMN NUMBERS |
| |
| Site Name: ___ |
| |
| State: ___ |
| |
| CMR: ___ |
| |
| Area Code: ___ |
| |
| Phone Number: ___ |
| |
+------------------------------------------------+
and using the column nubers entered I then import any spreadsheet no matter where the columns line up. Also this alliviates the need for the user to setup the excel spreadsheet in a certain way.
Your assisrtance in this matter will be fgreatly appreciated.