Script to correct spelling - GUI not working Topic is solved

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

Script to correct spelling - GUI not working

11 Apr 2017, 11:51

I have for some time enjoyed using the script to autocorrect spelling found here: https://autohotkey.com/board/topic/8990 ... it-better/ Code shown underneath:

Code: Select all

#NoEnv
#SingleInstance force

; send the corrected word on reload (will replace the selected word)
if(%0% > 1)
    Send, %2%

; a tiny GUI setup
Gui, Add, Edit, vfrom w300  ,%Hotstring%::
Gui, Add, Edit, vto  w300 ym0,%Hotstring%
Gui, Add, Button, Default, OK

#h::
	AutoTrim Off  
	ClipboardOld = %ClipboardAll%
	Clipboard =  
	Send ^c
	ClipWait 1
	if ErrorLevel  
		return
	StringReplace, Hotstring, Clipboard, ``, ````, All  
	StringReplace, Hotstring, Hotstring, `r`n, ``r, All
	StringReplace, Hotstring, Hotstring, `n, ``r, All
	StringReplace, Hotstring, Hotstring, %A_Tab%, ``t, All
	StringReplace, Hotstring, Hotstring, `;, ```;, All
	
	; trim the word (better imo)
	Hotstring :=  Trim(Hotstring)
	
	Clipboard = %ClipboardOld% 
	
	; setting the hotstrings in the GUI
	GuiControl,, to, %Hotstring%
	GuiControl,, from, %Hotstring%::
	
	; focus to the "to" gui
	GuiControl, Focus, to
	Gui, Show
	
	; send control + a in order toselecctthe text in the "to" gui (better imo)
	Send, ^a
return

; happens when pressing the OK button
ButtonOK:
    ; assembling the hotstring and save it to this file
    GuiControlGet, to
    GuiControlGet, from
    Hotstring := "::" from to
    FileAppend, `n%Hotstring%, %A_ScriptFullPath%  

    ; special reload statement with the word in the "to" gui
    Run, %A_ScriptFullPath% /restart %to%

    Sleep 200
    MsgBox, 4,, The hotstring just added appears to be improperly formatted.  Would you like to open the script for editing? Note that the bad hotstring is at the bottom of the script.
    IfMsgBox, Yes, Edit
return
But for reasons I do not understand, this no longer works. When pressing "Win+h" I can see from the W10 process line that an autohotkey is active, but it is hiding itself somewhere. I cannot hoover over it and move the window into the active desktop. So I am unable to get in contact with the dialog box.
Anyone who knows what could cause this and how I could remedy it? Thanks.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: No registered users and 281 guests