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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Windows 7 yield while taskexists

Status
Not open for further replies.

hawk1996

Technical User
Mar 1, 2004
15
0
0
US
Hi, has anyone else ran into this problem using Procomm scripts on Windows 7? I have a script that runs a batch file to get the username of the pc, to do this I run the below script, I have a while taskexists yield so the script will wait until the batch file complets before moving on. This works really well in XP, but when I switched to Windows 7 it takes a long time (about a minute or longer) for the script to continue. Long after the batch file has completed.

Thanks,

PROC GET_USER_NAME
STRING GETPCUSERNAMEBAT="Y:\PM\OSS\Aspect\PCUSERNAMEBAT.BAT"
IF NOT FOPEN 1 GETPCUSERNAMEBAT CREATE TEXT
ERRORMSG "UNABLE TO OPEN OR CREATE %s" GETPCUSERNAMEBAT
ENDIF

FPUTS 1 "C:"
FPUTS 1 "CD\"
FPUTS 1 "SET > C:\PERSONAL\PCUSERNAME.TXT"
FFLUSH 1
FCLOSE 1

RUN GETPCUSERNAMEBAT HIDDEN PCUSER
WHILE TASKEXISTS PCUSER
YIELD
ENDWHILE

FOPEN 0 PCUSERNAME_TXT READ TEXT
WHILE NOT FEOF 0


FGETS 0 PCUSERNAMELINE
IF STRFIND PCUSERNAMELINE "USERNAME="
STREXTRACT PCUSERNAME PCUSERNAMELINE "=" 1
ENDIF
ENDWHILE
FCLOSE 0
DELFILE "C:\PERSONAL\PCUSERNAME.TXT"
;USERMSG "*%s*" PCUSERNAME
ENDPROC
 
I haven't had a chance to play with this yet, and can't think of the last time I ran a batch file from Procomm, but I did notice that the ASPECT help file said to use the dos command to run batch files instead of the run command.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top