Script stops working

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
jameskhalil
Posts: 20
Joined: 07 Jun 2020, 13:56

Script stops working

22 Oct 2020, 18:59

Hi,
This script for some reason just stops working at "MsgBox, Vaccin".
I temporarely inserted the "MsgBox" lines only to know how far it goes, so I will delete them after.
It is executed from a menu and is supposed to copy the info from a website form and place the contents of the fields in variables for future use.
What causes it to not continue till the end?
Thanks in advance!

Code: Select all

CopyForm:
Gui, Destroy
Send ^a
Sleep, 500
ClipBoard = 
Send ^c
ClipWait
vaccin = %ClipBoard%
MsgBox, Vaccin
Send {TAB}{TAB}{TAB}
ClipBoard = 
Send ^c
ClipWait
lot = %ClipBoard%
MsgBox, lot
Send {TAB}{TAB}
ClipBoard = 
Send ^c
ClipWait
DateVacc = %ClipBoard%
MsgBox, DateVacc
Send {TAB}{TAB}{TAB}
Sleep, 300
Send {TAB}
Send {TAB}{TAB}{TAB}
ClipBoard = 
Send ^c
ClipWait
vaccinateur = %ClipBoard%
MsgBox, vaccinateur
Send {TAB}{TAB}{TAB}
ClipBoard = 
Send ^c
ClipWait
lieu = %ClipBoard%
MsgBox, lieu
Send {TAB}{TAB}{TAB}
Send ^a
ClipBoard = 
Send ^c
ClipWait
commentaires = %ClipBoard%
MsgBox, commentaires
return
User avatar
boiler
Posts: 17392
Joined: 21 Dec 2014, 02:44

Re: Script stops working

22 Oct 2020, 19:24

It probably didn't tab to the right spot after you dismiss the MsgBox, so it's not copying anything and waiting on ClipWait forever. You might try a Sleep, 300 after the MsgBox line so the other window has time to become active again after the MsgBox is dismissed before you start sending Tab keys. There might be some other reason it isn't tabbing to the right place or copying the text.

By the way, you can put a timeout on the ClipWait, and stop the script or whatever action you want to take if it times out (meaning it didn't grab any text).
User avatar
boiler
Posts: 17392
Joined: 21 Dec 2014, 02:44

Re: Script stops working

22 Oct 2020, 19:26

By the way, MsgBox, Vaccin will show the message "Vaccin" not the contents of the Vaccin variable. To see the contents of the variable, it would be MsgBox, %Vaccin%.
jameskhalil
Posts: 20
Joined: 07 Jun 2020, 13:56

Re: Script stops working

23 Oct 2020, 06:04

Sorry, I was testing in Notepad so you are right it was waiting indefinitely.
I will try it again.
jameskhalil
Posts: 20
Joined: 07 Jun 2020, 13:56

Re: Script stops working

23 Oct 2020, 22:10

Seems to work. Thank you!

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Chunjee, mikeyww and 181 guests