Inconsistency running my script Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
hotsku11er
Posts: 2
Joined: 18 Jan 2022, 13:58

Inconsistency running my script

Post by hotsku11er » 18 Jan 2022, 16:51

Code: Select all

!q::  ; radwan
SendInput, John{Tab}
SendInput, Peterson{Tab}
SendInput, 133718{Tab}
SendInput, [email protected]{Tab}
SendInput, 0789850898{Tab}
SendInput, american{Tab}
return
!w::  ; radwan
SendInput, John{Tab}
SendInput, Peterson{Tab}
SendInput, 133718{Tab}
SendInput, [email protected]{Tab}
SendInput, 0789850898{Tab}
SendInput, american{Tab}
return
!e::  ; radwan
SendInput, John{Tab}
SendInput, Peterson{Tab}
SendInput, 133718{Tab}
SendInput, [email protected]{Tab}
SendInput, 0789850898{Tab}
SendInput, american{Tab}
return
!r::  ; radwan
SendInput, John{Tab}
SendInput, Peterson{Tab}
SendInput, 133718{Tab}
SendInput, [email protected]{Tab}
SendInput, 0789850898{Tab}
SendInput, american{Tab}
return
its essentially 15 copy of the above code, each with different string inputs for different student the goal is to use a hotkey to fill out a google form with 1 hotkey stroke
I have repeated the same line of code, changing the assigned key each time, !q,!w,!e, etc for each group of information
first of all is this the most efficient way to code this?
secondly, everytime I run the code on a google form, sometimes the "tab" is run before or after the text, in which I wll get instances where "JhonPet" is typed in the first section and "erson" is typed in the second section

User avatar
mikeyww
Posts: 26588
Joined: 09 Sep 2014, 18:38

Re: Inconsistency running my script  Topic is solved

Post by mikeyww » 18 Jan 2022, 17:37

There are so many different ways to do it. I think it depends on your workflow and preferences. With only 15 entries, you don't have to worry about big differences in efficiencies across the possibilities. One can use an INI or CSV external file, hard-code into the script with an array, use some other variables, leave as is, etc.

Regarding the letter mixups, in some cases, Send can be better than SendInput, because it builds in a delay after every character. You can then adjust the delay if needed. I have some Web automations where I need a SetKeyDelay greater than the default of 10 ms.

hotsku11er
Posts: 2
Joined: 18 Jan 2022, 13:58

Re: Inconsistency running my script

Post by hotsku11er » 18 Jan 2022, 19:56

what if i want to modify the code into the following

Code: Select all

!q & 1::  ; radwan
SendInput, Bob {Tab}
Sleep 60
return

!q & 2::
SendInput, the builder{Tab}
Sleep 60
return

!q & 3::
SendInput, 133718{Tab}
Sleep 60
return

!q & 4::
SendInput, [email protected]{Tab}
Sleep 60
return

!q & 5::
SendInput, 07841526{Tab}
Sleep 60
return

!q & 6::
SendInput, spanish{Tab}
return
In which I want alt + q + num , to send 1 line of info, and mapping a different number to each line of information, but when reading the AHK help it mentions that 3 key hotkeys are not supported what do you think is the best method to approach this?

Any info is very much appereciated

User avatar
mikeyww
Posts: 26588
Joined: 09 Sep 2014, 18:38

Re: Inconsistency running my script

Post by mikeyww » 19 Jan 2022, 06:19

Try the middle example from that same paragraph about custom combinations.

Post Reply

Return to “Ask for Help (v1)”