Need two (simple?) failsafe scripts to work for my WiFi Plug

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
SeeDRank_A
Posts: 5
Joined: 25 Sep 2022, 22:40

Need two (simple?) failsafe scripts to work for my WiFi Plug

Post by SeeDRank_A » 01 Oct 2022, 20:34

Hello, i am trying to get help with creating two scripts for my WiFi Plug using AHK and Unofficial Google Assistant.

For the first script, it is a script to "Power On". after all three (3) conditions are met, i would like to send my script i currently have as a command to Google Assistant afterwards:

" ` " needs to be in the DOWN status/position

" ` " is held for 2000ms

" ` " is released

" ` " Sends " ~ " to open Google Assistant

next line of currrent script made

etc.
Return
-

The second script is to Power Off:

" ` " needs to be in the DOWN status/position

" ` " is held for 5000ms

" ` " Sends " ~ " to open Google Assistant

next line of currrent script made

etc.
Return
-

So far i got a script for turning off and on my WiFi Plug but it doesnt have the fail safe conditions i want to have.

Code: Select all

`::
Send, ~ 
Sleep, 2000 
Send, Vape On{Enter} 
Return
and

Code: Select all

+~:: ;it works just like +`, it least for what i need
Send, ~
Sleep, 2000
Send, Vape Off{Enter}
Return
[Mod edit: [code][/code] tags added.]

Apologies for the no [tag][/tag], i am learning how to script and post at the same time. This script will be nice for others that use WiFi Plugs in the same way as this will make it harder to accidently turn on or off.


** if someone has a master guide/breakdown on how and what to tag, id appreciate it.

gregster
Posts: 9068
Joined: 30 Sep 2013, 06:48

Re: Need two (simple?) failsafe scripts to work for my WiFi Plug

Post by gregster » 01 Oct 2022, 21:03

SeeDRank_A wrote:
01 Oct 2022, 20:34
Apologies for the no [tag][/tag], i am learning how to script and post at the same time.
It's really simple. Just select the code and then press the fifth button from the left in the full editor, either labeled 'code' or '</>'. That's it.

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

Re: Need two (simple?) failsafe scripts to work for my WiFi Plug

Post by mikeyww » 02 Oct 2022, 07:29

If you hold the key for two seconds, then how will the script know if you intend to hold it for another three seconds? Additional details are needed in your description. Think through every step. For each key press, indicate whether you are doing it, or the script is sending it.

Here is my take on the script that you posted.

Code: Select all

`::
Send ~
Sleep, 2000
Send, Vape On`n
Return

~~::
Sleep, 2000
Send Vape Off`n
Return

Post Reply

Return to “Ask for Help (v1)”