Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Exporting Dialing Directories 1

Status
Not open for further replies.

MyFlight

Technical User
Feb 4, 2002
193
Question,

I have a script for exporting Dialing directories that work s fine. However I would like to be able to combine all the directories in ONE file prior to exporting it. Does anyone know a quick way to do this?

Here is my current script.


Sure, here is a modified version of the WaitListS2 procedure that will get the number of nodes as well (value will be placed in the integer variable iNumNodes):

PROC WaitListS2
string sLine = " 2 of 5) is active with 12 Channels"
integer iLen
string sTemp

WHEN TARGET 0 CLEAR
WHEN TARGET 1 CLEAR
WHEN TARGET 2 CLEAR
WaitListStat = 2

strlen sLine iLen ;Get length of string

while iLen > 0 ;While the string has at least one character in it...
if rstrcmp sLine " " 1 ;Compare the first character in the string to a space
strdelete sLine 0 1 ;If the first character is a space, delete it from the string
else
exitwhile ;Else exit the while loop
endif
endwhile

substr sTemp sLine 0 1 ;Get node number
atoi sTemp iNode
substr sTemp sLine 6 1 ;Get number of nodes from system
atoi sTemp iNumNodes
ENDPROC


your assistance is greatly appreciated.
 
KNOB,

Yeah been preety hectic around here lately. Here is the correct script file.



proc main
string szList, szItem, szNewItem
string fEnd = ".csv"
integer Event
szList = " IBM-BCRS Project-CBX.DIR, IBM-BCRS Project-PM.DIR, IBM-Lotus-CBX.DIR, IBM-Lotus-PM.DIR, IBM-Northern-CBX.DIR, IBM-Northern-PM.DIR, IBM-SouthCentral-CBX.DIR, IBM-SouthCentral-PM.DIR, IBM-StandAlone-PM.DIR, IBM-Western-CBX.DIR, IBM-Western-PM.DIR"

dialogbox 0 241 99 152 138 11 "Select The Directories you want Exported"
listbox 1 28 8 90 89 szList multiple szItem sort
pushbutton 2 54 114 40 14 "&OK" OK DEFAULT
enddialog
while 1
dlgevent 0 Event ; Get the dialog event.

switch Event ; Evaluate the event.
case 0 ; No event occurred.
endcase
case 1
endcase
case 2 ; Exit button selected
IF strsearch szItem "IBM-BCRS Project-CBX.DIR"
szNewItem = "IBM-BCRS Project-CBX.DIR"
dialload szNewItem ; Load the specified directory.
strcat szNewItem fEnd
; Creates a New Text File With the Name: szitem + fEnd
fopen 1 szNewItem CREATE TEXT
pause 1
call export
ENDIF
IF strsearch szItem "IBM-BCRS Project-PM.DIR"
szNewItem = "IBM-BCRS Project-PM.DIR"
dialload szNewItem ; Load the specified directory.
strcat szNewItem fEnd
; Creates a New Text File With the Name: szitem + fEnd
fopen 1 szNewItem CREATE TEXT
pause 1
call export
ENDIF
IF strsearch szItem "IBM-Lotus-CBX.DIR"
szNewItem = "IBM-Lotus-CBX.DIR"
dialload szNewItem ; Load the specified directory.
strcat szNewItem fEnd
; Creates a New Text File With the Name: szitem + fEnd
fopen 1 szNewItem CREATE TEXT
pause 1
call export
ENDIF
IF strsearch szItem "IBM-Lotus-PM.DIR"
szNewItem = "IBM-Lotus-PM.DIR"
dialload szNewItem ; Load the specified directory.
strcat szNewItem fEnd
; Creates a New Text File With the Name: szitem + fEnd
fopen 1 szNewItem CREATE TEXT
pause 1
call export
ENDIF
IF strsearch szItem "IBM-Northern-CBX.DIR"
szNewItem = "IBM-Northern-CBX.DIR"
dialload szNewItem ; Load the specified directory.
strcat szNewItem fEnd
; Creates a New Text File With the Name: szitem + fEnd
fopen 1 szNewItem CREATE TEXT
pause 1
call export
ENDIF
IF strsearch szItem "IBM-Northern-PM.DIR"
szNewItem = "IBM-Northern-PM.DIR"
dialload szNewItem ; Load the specified directory.
strcat szNewItem fEnd
; Creates a New Text File With the Name: szitem + fEnd
fopen 1 szNewItem CREATE TEXT
pause 1
call export
ENDIF
IF strsearch szItem "IBM-SouthCentral-CBX.DIR"
szNewItem = "IBM-SouthCentral-CBX.DIR"
dialload szNewItem ; Load the specified directory.
strcat szNewItem fEnd
; Creates a New Text File With the Name: szitem + fEnd
fopen 1 szNewItem CREATE TEXT
pause 1
call export
ENDIF
IF strsearch szItem "IBM-SouthCentral-PM.DIR"
szNewItem = "IBM-SouthCentral-PM.DIR"
dialload szNewItem ; Load the specified directory.
strcat szNewItem fEnd
; Creates a New Text File With the Name: szitem + fEnd
fopen 1 szNewItem CREATE TEXT
pause 1
call export
ENDIF
IF strsearch szItem "IBM-StandAlone-PM.DIR"
szNewItem = "IBM-StandAlone-PM.DIR"
dialload szNewItem ; Load the specified directory.
strcat szNewItem fEnd
; Creates a New Text File With the Name: szitem + fEnd
fopen 1 szNewItem CREATE TEXT
pause 1
call export
ENDIF
IF strsearch szItem "IBM-Western-CBX.DIR"
szNewItem = "IBM-Western-CBX.DIR"
dialload szNewItem ; Load the specified directory.
strcat szNewItem fEnd
; Creates a New Text File With the Name: szitem + fEnd
fopen 1 szNewItem CREATE TEXT
pause 1
call export
ENDIF
IF strsearch szItem "IBM-Western-PM.DIR"
szNewItem = "IBM-Western-PM.DIR"
dialload szNewItem ; Load the specified directory.
strcat szNewItem fEnd
; Creates a New Text File With the Name: szitem + fEnd
fopen 1 szNewItem CREATE TEXT
pause 1
call export
ENDIF
exitwhile
endcase
default ; Exit case chosen.
exitwhile ; Exit the loop.
endcase
endswitch
endwhile
dlgdestroy 0 CANCEL ; Destroy the dialog box.
endproc
proc export
integer iEntries ;Number of entries in dialing class
integer iCount ;Loop variable
string sName ;Name of Connection Directory entry
string sAreaCode
string sCompany
string sPhoneNumber
string sUserID
string sPassword
string sMisc
string sComma = ","
string fEnd = ".csv"
string sEntry
string fName = $DDIRFNAME

dialcount DATA iEntries ;Get number of data entries
for iCount = 0 upto (iEntries - 1)
dialname DATA iCount sName ;Get name of entry based on index
set dialentry access DATA sName ;Turn on dialentry for the current entry
fetch dialentry areacode sAreaCode
fetch dialentry phonenumber sPhoneNumber
fetch dialentry company sCompany
fetch userid sUserID
fetch password sPassword
fetch misc sMisc
strcat sName sComma
strcat sAreaCode sComma
strcat sPhoneNumber sComma
strcat sCompany sComma
strcat sUserID sComma
strcat sPassword sComma
strcat sMisc sComma
strcat sEntry sName
strcat sEntry sAreaCode
strcat sEntry sPhoneNumber
strcat sEntry sCompany
strcat sEntry sUserID
strcat sEntry sPassword
strcat sEntry sMisc
fputs 1 sEntry
sEntry = ""
fclear 1
endfor
fclose 1
endproc



 
I'm not aware of a way to combine all Connection Directories into one .DIR file, but could you modify your script so it uses one standard file name, then export each directory to that file? If you modify the fopen commands so they are using the APPEND flag instead of CREATE, then you could add each directory to the file until you have all entries. If you go that route, then you would want your script to delete or rename an existing export file if it existed prior to beginning the export.


aspect@aspectscripting.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top