Error in script (+hide)

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Gururaj

Error in script (+hide)

17 Dec 2017, 23:30

I made an AHK Script about 5 years ago, and it worked well, thanks to several members of this forum.
Basically the script is used to select and search one of my Japanese-English glossaries when I select a specific phrase using a text editor called TextPad, which searches the phrase and comes up with the results.
It used to work fine but now doesn't. I have forgotten the basics of script writing and need to use this script again for my work. Will somebody kindly assist? The script is pasted below (not a large one). When I tried to edit the script I got the error shown below the script. Now, when I select a phrase in MS Word and hit windows key +Z or Windows key +X, nothing happens. The only changes I made to the script after five years is to give the paths to the various glossary files to search and the path to the TextPad program.
Thanks in advance for any assistance.
Gururaj Rao

---------------------
Gui, Add, Radio, x7 y40 w240 h20 Checked vGlossary, All Tech
Gui, Add, Radio, x7 y60 w240 h20, Auto Engineering
Gui, Add, Radio, x7 y80 w240 h20, Marine Engineering
Gui, Add, Radio, x7 y100 w240 h20, Kagaku
Gui, Add, Radio, x7 y120 w240 h20, General
Gui, Add, Radio, x7 y140 w240 h20, Chemical
Gui, Add, Radio, x7 y160 w240 h20, Patents
Gui, Add, Text, x7 y10 w240 h20, Select Glossary:
Gui, Add, Button, x86 y120 w70 h20 Default, Ok
Gui, Show, h185 w251 +hide, Selection
RunOnce = 0
Return

#z::
RunOnce = 0
#x::
Send,^c
IfWinExist, C:\Program Files\TextPad 8\textpad.exe
{
WinActivate
}
else
{
Run, C:\Program Files\TextPad 8\textpad.exe
WinWait, C:\Program Files\TextPad 8\textpad.exe
WinActivate
}
Send,!SI^v
if (RunOnce = 0 or SendThis =)
{
Gui, Show, h185 w251, Selection
WinGet, SelId, ID, Selection
WinWaitClose, ahk_id %SelId%
if SendThis <>
{
Send,!d
Send, %SendThis%
}
}
Send, {Enter}
Return

ButtonOk:
Gui, Submit
if Glossary = 1
SendThis = C:\Users\Gururaj\Documents\MEGA\JDICS\JTECHDIC
else if Glossary = 2
SendThis = C:\Users\Gururaj\Documents\MEGA\JDICS\JTECHDIC\JAUTO
else if Glossary = 3
SendThis = C:\Users\Gururaj\Documents\MEGA\JDICS\JNADIC
else if Glossary = 4
SendThis = C:\Users\Gururaj\Documents\MEGA\JDICS\kagaku
else if Glossary = 5
SendThis = C:\Users\Gururaj\Documents\MEGA\JDICS\JGENDIC
else if Glossary = 6
SendThis = C:\Users\Gururaj\Documents\MEGA\JDICS\JTECHDIC\JCHEM
else if Glossary = 7
SendThis = C:\Users\Gururaj\Documents\MEGA\JDICS\JTECHDIC\JPATENT
RunOnce = 1
Return
END OF SCRIPT---------------------------------------------------------

ERROR MESSAGE -------------------------------------------
Error: Invalid Option
Specifically: + Hide

Gui, Add, Radio, x7 y80 w240 h20, Marine Engineering
Gui, Add, Radio, x7 y100 w240 h20, Kagaku
Gui, Add, Radio, x7 y120 w240 h20, General
Gui, Add, Radio, x7 y140 w240 h20, Chemical
Gui, Add, Radio, x7 y160 w240 h20, Patents
Gui, Add, Text, x7 y10 w240 h20, Select Glossary:
Gui, Add, Button, x86 y120 w70 h20 Default, Ok
Gui, Show, h185 w251 +hide, Selection <--------------------
RunOnce = 0
Return

#z::
RunOnce = 0
#x::
Send,^c
IfWinExist, C:\Program Files\TextPad 8\textpad.exe

The current thread will exit.
END OF ERROR MESSAGE ---------------------------
trust_me
Posts: 98
Joined: 29 Jul 2017, 10:46

Re: Error in script (+hide)

18 Dec 2017, 03:37

Specifically: + Hide
The option is "hide" not "+hide"

Gui, Show, h185 w251 hide, Selection
Gururaj

Re: Error in script (+hide)

18 Dec 2017, 05:42

Thank you, I removed the offending + mark.
Now TextPad the editor program opens, but no luck. The phrase is not pasted in the search window nor does the GUI for selecting the glossary appears!
I seemed to remember that there was a debug feature that you could use to test the script?

Gururaj
trust_me
Posts: 98
Joined: 29 Jul 2017, 10:46

Re: Error in script (+hide)

18 Dec 2017, 07:33

You can add these two hotkeys ( of any hotkey combination you prefer that do not interfere with textpad )to have a list of last executed lines and content of variables:

!v::listvars
!l::listlines

My guess is that your program stops at WinWait, C:\Program Files\TextPad 8\textpad.exe

I think it should be:
WinWait, ahk_exe C:\Program Files\TextPad 8\textpad.exe
Use ahk_exe to identify a window belonging to any process with the given name or path.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Lamron750 and 244 guests