Page 1 of 1 1
Topic Options
#14478 - 2001-11-21 05:14 PM GETS command fails
Don.O Offline
Fresh Scripter

Registered: 2001-11-21
Posts: 5
Hello all, excuse me if this question has been asked before.

I have written a script that acts as a front end for some computer based training. There was a need to track usage of the programs. The script prompts the user for a username, stores it, then displays a basic menu for the user to select which training CD they want to access. Based on the selection, it then uses the Shell command to execute the appropriate programs EXE. After they exit the training, they are returned to the CD selection menu so they may select another CD or Exit.

The problem I am having is with the GETS command. The first time the script runs, everything works perfectly. The user is prompted for a name, they enter something, press Enter and are presented with the list of CDs. After running the training and returning to the script menu, they can exit the script.

However, when the script is run a second and subsequent times, the user is never prompted for a username. It's as if the GETS command isn't pausing and waiting for input. The value of the variable associated with the GETS command ($myname) ends up with what looks like content from the script itself.

The problem doesn't occur on all computer systems, the script works fine on most (in that the GETS command pauses and waits for input). There is something specific about this type of computer that is causing the problem.

The computer is based on a PCCHIPS 748 motherboard. I have tried both 3.61 and 2001 versions of KiXtart. Both do the same thing. Rebooting the system seems to reset the issue so the script runs fine one time, but again fails after that. All the computers are running Windows 98 SE.

I'm hoping someone else has seen this or a similar issue with the GETS command and can help point me to whatever it is about this computer that is causing this issue. We have 4 computer system based on this motherboard and they all fail. I am in the process of updating the drivers on the systems, but don't like to fix something if it's not broke. If anyone has a good idea on which driver I should start with, please help me out here.

Thanks!
Don

[ 21 November 2001: Message edited by: Don.O ]

Top
#14479 - 2001-11-21 05:30 PM Re: GETS command fails
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Hi Don, and welcome

Interesting problem (to say the least) ... what happens if you try using the latest and greatest KiXtart 2001 (just released) and try doing a FLUSHKB prior to your GETS. FLUSHKB has been broken for a long time but was just fixed

-Shawn

Top
#14480 - 2001-11-21 05:52 PM Re: GETS command fails
Don.O Offline
Fresh Scripter

Registered: 2001-11-21
Posts: 5
Thanks, I had tried the FLUSHKB command with version 3.61 and it didn't work, but I had not tested it with 2001.

I just tried it and still have the same issue.

Thanks again.

Top
#14481 - 2001-11-21 06:07 PM Re: GETS command fails
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Just to verify - your running buiuld 62 right ?

The other thing I was thinking was that maybe one of your training apps is screwing with the keyboard buffer ... what happens if you temporarily comment-out the shell commands in your main script - or better yet, shell out to a harmless DOS command like ECHO (instead of your app) ... does it still behave funky ?

I'm grasping here - yes !

-Shawn

Top
#14482 - 2001-11-21 06:48 PM Re: GETS command fails
Don.O Offline
Fresh Scripter

Registered: 2001-11-21
Posts: 5
Thanks again Shawn. I checked the properties on the Kix32.exe and confirmed it is build 62.

Your suggestion was correct. It is definately the training program that is causing some sort of problem that persists even after the training and the kix have been exited. If I start the script, enter a name, and exit without running the training program, the script runs fine each time (i.e. the GETS command prompts for a name). However, if I run the training program, exit, then exit the script and restart, the script no longer functions correctly.

I commented out the code that starts the training and put in a simple DIR command. Now each time I run the script, it pauses and prompts for the username (i.e. works as it should).

The training program is the culprit and must be doing something to the system that causes the GETS script command to fail when the script is ran a second time (and every time after). The training program must be having some sort of conflict with the system that causes subsequent attempts to run the script to fail, but I'm at a loss to figure out what I can do to fix it.

I haven't given up just yet but... Know of any other program out there that will allow me to, prompt for a username, set up a front-end menu system and create a log file of usage activity?

If it will help, here is a copy of the original script I wrote:

; Yellow Page Training launch and log-tracking script
; Don Olsen
; November 15, 2001

; Display the grid and user login info

:Start
color y+/n
BOX(0,0,23,79,single)

color b+/n
BOX(10,25,12,55,double)

color w+/n
at (7, 22) "Please type your name and press Enter"

color g+/n
at (11, 27)
gets $name

If len($name) = 0
goto "Start"
Endif

:Menu
; Display Menu
color y+/n
BOX(0,0,23,79,single)

color b+/n
BOX( 9,25,13,56,double)

color w+/n
at ( 7, 21) "Please select which Training CD to access"
at (10, 27) "1. Yellow Page Training CD 1"
at (11, 27) "2. Yellow Page Training CD 2"
at (12, 27) "X. Exit"

color g+/n
at (12, 27)
get $menuopt


; Find out which option was selected
Select
case $menuopt = 1
$runprogram = "R:\yptrain\cd1\ypstart.exe"
$cdnumber = "YP Training CD1"
case $menuopt = 2
$runprogram = "R:\yptrain\cd2\ypstrt2.exe"
$cdnumber = "YP Training CD2"
case instr("Xx", $menuopt)
quit
case 1
goto "Menu"
EndSelect

; Create and Update Log file
If open(1, "\\apc_web\yp.training$\yptraining.txt", 5) = 0
IF WriteLine(1, $cdnumber + " Started " + @DATE + " " + @TIME + " " + @WKSTA + " " + $name + chr(13) + chr(10)) = 0
$Result = SendMessage("don_olsen", $cdnumber + " accessed on machine " + @WKSTA + " by " + $name)
Else
$Result = SendMessage("don_olsen", "Unable to write to YP.Training log file on Machine " + @USERID + "/" + @WKSTA)
Endif
$Result = Close(1)
else
$Result = SendMessage("don_olsen", "Unable to open YP.Training log file on Machine " + @USERID + "/" + @WKSTA)
endif

shell $runprogram

; Update Log file
If open(1, "\\apc_web\yp.training$\yptraining.txt", 5) = 0
IF WriteLine(1, $cdnumber + " Exited " + @DATE + " " + @TIME + " " + @WKSTA + " " + $name + chr(13) + chr(10)) = 0
$Result = SendMessage("don_olsen", $cdnumber + " exited on machine " + @WKSTA + " by " + $name)
Else
$Result = SendMessage("don_olsen", "Unable to write to YP.Training log file on Machine " + @USERID + "/" + @WKSTA)
Endif
$Result = Close(1)
else
$Result = SendMessage("don_olsen", "Unable to open YP.Training log file on Machine " + @USERID + "/" + @WKSTA)
endif

goto "Menu"

Top
#14483 - 2001-11-21 06:58 PM Re: GETS command fails
Shawn Administrator Offline
Administrator
*****

Registered: 1999-08-13
Posts: 8611
Don,

By way of a quick test ... does it still behave funky if you shell-out and wait for task completion like this:

SHELL "%COMSPEC% /C $RUNPROGRAM"

-Shawn

Top
#14484 - 2001-11-21 09:35 PM Re: GETS command fails
Don.O Offline
Fresh Scripter

Registered: 2001-11-21
Posts: 5
Tried your suggestion, still no fix, but it did set me up to try a couple more things.

I have been initiating Kix via a dos batch file with the contents "kix32 log.kix". I got the idea to put that command directly into a Windows shortcut instead (no batch file).

Interestingly, with this set up the script works correctly in that it pauses on the GETS command and waits for input. Unfortunately, the script doesn't halt execution when the external training program is started. I need to be able to log when the training was started and exited.

I do appreciate you help, many thanks!
Don

Top
#14485 - 2001-11-21 11:11 PM Re: GETS command fails
Alex.H Offline
Seasoned Scripter

Registered: 2001-04-10
Posts: 406
Loc: France
If you want to wait for end of execution of a Win32 exe, you should try this :
SHELL "Start $RUNPROGRAM /wait"
_________________________
? getobject(Kixtart.org.Signature)

Top
#14486 - 2001-11-27 04:37 PM Re: GETS command fails
Don.O Offline
Fresh Scripter

Registered: 2001-11-21
Posts: 5
Thanks for the help, I have it all working now. I am running Kix from a Window's shortcut (no batch file) and to get the script to pause I am using your Start /wait suggestion, it is working as well. I had to change the format of the command to get it to work though.

Instead of:
SHELL "Start $RUNPROGRAM /wait"
(which didn't work)

I rearranged it to
SHELL "Start /wait $RUNPROGRAM"

The Start command wasn't seeing the /wait option, I guess. Thanks again for your help, consider this issue solved.

Don

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 1283 anonymous users online.
Newest Members
fgarcia, Viginette, ManuvdWielNL, Sir_Barrington, batdk82
17889 Registered Users

Generated in 0.167 seconds in which 0.096 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org