sendkeys - VBScript Send Key " -


i have vbscript unsubscribe steam workshop-objects

code:

set wshshell = wscript.createobject("wscript.shell") wshshell.appactivate "steam community :: [ger] aaron :: abonnierte objekte - opera" wshshell.appactivate "steam community :: [ger] aaron :: abonnierte objekte - opera" wshshell.appactivate "steam community :: [ger] aaron :: abonnierte objekte - opera" wshshell.sendkeys "^{2}" wscript.sleep 5000 wshshell.sendkeys "jquery ("[id^='unsubscribeitembtn']").children().trigger('click'); settimeout(function(){location.reload();},500);" wshshell.sendkeys "{enter}" wscript.sleep 5000 wshshell.sendkeys "jquery ("[id^='unsubscribeitembtn']").children().trigger('click'); settimeout(function(){location.reload();},500);" wshshell.sendkeys "{enter}" wscript.sleep 5000 wshshell.sendkeys "jquery ("[id^='unsubscribeitembtn']").children().trigger('click'); settimeout(function(){location.reload();},500);" wshshell.sendkeys "{enter}" 

and in line 7 (symbol 29) has send " script thinks has end sendkey-command there...

how can prevent that?

the issue here 2 fold;

  1. the strings not correctly escaped @scott has pointed out (revision 1), their latest edit isn't way fix both "" , chr(34) equivalent , i'd stick escaping doubling quotes.

  2. invalid procedure or argument @ line 7 symbol 1 (code: 800a0005)

    is caused sendkeys() when appactivate() isn't set correct window.

    notice happens in vbsedit while running script, sendkeys() injects script causing runtime error.

    screenshot

    the way check return boolean appactivate() before continuing script make sure successful.

    option explicit dim wshshell: set wshshell = wscript.createobject("wscript.shell") dim iswindowactive: iswindowactive = wshshell.appactivate("steam community :: [ger] aaron :: abonnierte objekte - opera") if iswindowactive     wshshell.sendkeys "^{2}"     wscript.sleep 5000     wshshell.sendkeys "jquery (""[id^='unsubscribeitembtn']"").children().trigger('click'); settimeout(function(){location.reload();},500);"     wshshell.sendkeys "{enter}"     wscript.sleep 5000     wshshell.sendkeys "jquery (""[id^='unsubscribeitembtn']"").children().trigger('click'); settimeout(function(){location.reload();},500);"     wshshell.sendkeys "{enter}"     wscript.sleep 5000     wshshell.sendkeys "jquery (""[id^='unsubscribeitembtn']"").children().trigger('click'); settimeout(function(){location.reload();},500);"     wshshell.sendkeys "{enter}" else     wscript.echo "activating window failed" end if 

    output (because don't have particular window):

    activating window failed 


    why appactivate() return false?

    as working out why appactivate() returns false i'd recommend reviewing

    a: wshshell.appactivate doesn't seem work in simple vbs script.


Comments

Popular posts from this blog

python - How to insert QWidgets in the middle of a Layout? -

python - serve multiple gunicorn django instances under nginx ubuntu -

module - Prestashop displayPaymentReturn hook url -