I need some ideas from yall. Mostly on how to fix this problem. I am working on trying to automate a tool that comes with most modern versions of Windows for our help desk. Its the Problem Steps Recorder, or PSE.exe. Apparently using the tool is "too hard" for some users and I thought this would be a good example to practice scripting, and learn a few things.
I actually have something that works fairly well but I have one problem that irritates the crap out of me, and I cant think of a solution, or a reason why it does this.
@ECHO OFF
TITLE PSR Script - DO NOT CLOSE, IT WILL AUTOMATICALLY CLOSE ON ITS OWN.
CD %TEMP%
MKDIR PSR
CD PSR
SET psrdir=%TEMP%\PSR
psr.exe /start /output "%psrdir%\ScreenCapture.zip" /maxsc 50 /gui 1 /stopevent 8675309
If exist "outlook.exe" "GOTO Outlook" else "GOTO Explorer"
:Outlook
start "" "OUTLOOK.EXE" /c ipm.note /m "support@msp.net&subject=Screen Capture&body=Please see attached file." /a "%psrdir%\ScreenCapture.zip" & GOTO exit
:Explorer
explorer.exe /n /root,%psrdir% & GOTO exit
:exit
exit
My problem is that once I get to starting the PSR executable, the script will hang until its closed. Ideally I would like a prompt of "Press any key to continue..." or a popup or something. Which I can then add a PSR.exe /stop, and close the program through the script. With the way its currently written, I have to tell my users to not only stop, but to close it. I know its not a big deal, but I do want to know how to fix it.
To let the program continue regardless of the state of psr.exe
change
psr.exe /start /output "%psrdir%\ScreenCapture.zip" /maxsc 50 /gui 1 /stopevent 8675309
To
start psr.exe /output "%psrdir%\ScreenCapture.zip" /maxsc 50 /gui 1 /stopevent 8675309
To create a popup with VBS:
Batch: Use start popup.vbs
whenever you want it to popup, or start popup.vbs /wait
to wait for the popup to close before doing anything else.
VBS (popup.vbs):
Popup=msgbox("YourMessage",0,"YourTitle")
The 0
in the vbscript above indicates that there will only be an ok
button. For more options, and to read more about vbs message boxes click here.
You could, add in the following lines to create the vb file, run it, then delete it:
echo Popup=msgbox("Click to close",0,"YourTitle")>popup.vbs
start popup.vbs
pause
del popup.vbs