That would be fine. I just need the script to exit procomm when the user hits escape. I wasn't sure if just pressing keys would effect other software or not.
I am getting all kinds of compile errors though. Most of the errors occur on defining the variables. I narrowed the errors down to these two commands:
set aspect keys on
when $KEYHIT call closedown
Below is the script. I am looking to open the script, have it loop continually until the user hits esc.
proc main
set aspect keys on
when $KEYHIT call closedown
;---Define Variables--------------------------------------------
string strCrawl ;Message displayed on the screen
string strCounty ;Variable for which county is displayed
string strCountyName ;"<Name> County" will be displayed on the screen
string strBulk ;All Commands
string strLineBuffer ;Data in file
integer intX ;Number for the loop
integer intLength ;Length of the string
integer intCLen ;Length of the County String
integer intChoice ;1 = crawl data, 2 = exit procomm
;---Begin Code--------------------------------------------------
sdlgmsgbox "MCR/CODI Switch" "Set the AB switch to SCHOOL CLOSING, once that is done click OK" EXCLAMATION OKCANCEL intChoice
if intChoice == 2
pwexit ;Exit procomm
else
transmit "\sr\\" ;Reset the Chyron CODI
waitfor "000*" forever matchcase ;Allow the CODI to reset
transmit "\ct\9\2\0\\" ;Remove the shadow edge from the font
;The following line will set lines 1-180 to video and 181-256 black
transmit "\c1\\\f1\\\db\2\r\1\0\0\0\1\185\0\0\0\1\184\0\0\0\0\256\0\0\0\0\\\vb\\"
transmit "\dm\1\0\250\380\c1\f1\ATTENTION:\30\405\c1\f1\The following organizations have a modified schedule for today\\"
transmit "\md\1\\\sw\160\\"
while 1
for intX = 1 upto 13 ;This process is repeated for each county
;---Set Variable for that County------------------------
if intX == 1
strCounty = "V:\StormWarning\TVDir\Adams.txt"
elseif intX == 2
strCounty = "V:\StormWarning\TVDir\Berks.txt"
elseif intX == 3
strCounty = "V:\StormWarning\TVDir\Cumberland.txt"
elseif intX == 4
strCounty = "V:\StormWarning\TVDir\Dauphin.txt"
elseif intX == 5
strCounty = "V:\StormWarning\TVDir\Juniata.txt"
elseif intX == 6
strCounty = "V:\StormWarning\TVDir\Lancaster.txt"
elseif intX == 7
strCounty = "V:\StormWarning\TVDir\Lebanon.txt"
elseif intX == 8
strCounty = "V:\StormWarning\TVDir\Mifflin.txt"
elseif intX == 9
strCounty = "V:\StormWarning\TVDir\Perry.txt"
elseif intX == 10
strCounty = "V:\StormWarning\TVDir\Schuylkill.txt"
elseif intX == 11
strCounty = "V:\StormWarning\TVDir\Snyder.txt"
elseif intX == 12
strCounty = "V:\StormWarning\TVDir\York.txt"
else
exitfor ;Exit the for loop
endif
;---Create county text----------------------------------
strCrawl = "" ;Reset the Crawl message
strlen strCounty intCLen
substr strCountyName strCounty 22 (intCLen - 26) ;Parse the county from the string
strBulk = "\dm\1\0\45\368\c1\f1\"
strcat strBulk strCountyName
strcat strBulk " County"
strcat strBulk "\50\421\c5\f1\visit
and listen to WITF 89.5 FM for updates\\\me\cs\"
transmit strBulk ;Send setup commands to the CODI (message 1 and crawl data)
;---Open file or default message------------------------
if fopen 0 strCounty READ TEXT ;Open file for read only, if it exists.
while not feof 0 ;Loop while not end of file.
fgets 0 strLineBuffer ;Get line from file.
if not nullstr strLineBuffer
strlen strLineBuffer intLength ;Caluclate the length of the line
substr strCrawl strLineBuffer 1 (intLength - 2) ;Remove the Quotes
strcat strCrawl " " ;add a space between rows
endif
endwhile
fclose 0 ;Close the file
else
strCrawl = "There are no delays, cancellations or closings at this time."
endif
;---Transmit data---------------------------------------
transmit strCrawl ;Send the crawl data to the CODI
transmit "\\\md\1\\\me\cb\1\0\397\\\sa\\" ;Send the display commands to the CODI and wait for a system acknowledge
waitfor "*" forever matchcase ;continue with script when the crawl is finished
transmit "\mb\1\\\me\ce\\" ;Free some memory buffer
endfor ;Repeat the process 12 times (each county)
endwhile
transmit "\pb\\\sr\\" ;Reset the system, close ProComm
waitfor "000*" forever matchcase
pwexit
endif
endproc ;End main procedure
proc closedown
integer intKey ;numeric value of the key
keyget intKey
if intKey ==27
waitfor "*" forever matchcase
transmit "\pb\\\sr\\" ;Reset the system, close ProComm
waitfor "000*" forever matchcase
pwexit
endif
endproc ;End closedown procedure Thank you for your assistance
Jason Meckley
Database Analyst
WITF