cancel
Showing results for 
Search instead for 
Did you mean: 

Cannot get WScript.Quit to work to give user choice terminate script

Former Member
0 Kudos

Hi,

I've been attempting insert this code into an if statement and keep getting the same error:

'Object Required: 'WScript' -

Reading through the various forums, I've placed this code:

set WScript = CreateObject("WScript.Shell") in anumber of areas and it does not work

Does anyone know how to fix this and/or any other alternative for a user

to have the choice to Exit/Stop/Terminate a script,

Thanks

Accepted Solutions (1)

Accepted Solutions (1)

holger_khn
Contributor
0 Kudos

Hello.

This small vbs script is working fine for me:


Dim Answer
Answer = inputbox ("Fillin 'q' for Quit")

if Answer = "q" then
msgbox "Quit"
Wscript.Quit
end if
msgbox "Execute Code"

Former Member
0 Kudos

Thanks Holger,

got the script to work.

To add a point here: when I tried to execute from my desktop, the error message prompts for "Object Required 'WScript-'", yet when I ran it in a folder with a button embedded to execute the script, it worked.

Looks like the script recording and playback option does not work, yet an embedded button from GuiXT does.

Former Member
0 Kudos

Was able to calculate the reduction in mouse/keyboard events when creating customer in SAP in v-09 from 101 events to 26 thanks to the Script. What's still challenging is that sometimes a session error occurs when activating this or any script and sometimes not. Have embedded the wscript.sleep function as below

msgbox "Please select a session within the next 3 seconds after clicking ok"

wscript.sleep 3000

set session = application.ActiveSession

but still find a problem sometimes with the ActiveSession. Would anyone know the remedy for this?

Thanks

Answers (1)

Answers (1)

Former Member
0 Kudos

Was able to discover that the logon pad interfered with the script causing it  to help but to crash along with other sessions in SAP. Not the perfect fix having the 1 session as occasionally Active.Session not picked up by script, but have found performance of the script improves with logon pad terminated and no other sessions running. The wscript.sleep option does seem as well.