I modified a piece of code I found online so that one push of Capslock copies the highlighted text on the screen, opens an internet tab to google, and runs a search on that text. The code itself works fine.
What I am trying to do is make that bit of code activate and deactivate based on the checkbox. What I am having happen is the code is active and running regardless of whether or not the checkbox is checked. My Capslock Search function will not turn off. I cannot figure out how to disable the function. I would appreciate any advice on what I am doing wrong in this code.
This code has been parsed down from my full code. This is the test sample I am working with to get the function to work. It does not have any code for the buttons.
Code: Select all
; Headlines
Gui, Font, Verdana s10 Bold ; SET HEADLINES FONT
Gui, Add, Text, x175 y30 +BackgroundTrans, Quickcopy
Gui, Font, Norm s8 ; DISABLE HEADLINES FONT, RESET TO NORMAL, SIZE 8 (DEFAULT SIZE AND FONT)
; Buttons Line 1
Gui, Add, Button, x42 y69 w70 h50 , Reviewed PQ w/ RF
Gui, Add, Button, x142 y69 w70 h50 , Reviewed Totals w/ RF
Gui, Add, Button, x242 y69 w70 h50 , Auth Amount
Gui, Add, Button, x342 y69 w70 h50 , Called RF. Left VM.
Gui, Add, Checkbox, x180 y130 vCheckbox gCAPS , Capslock Search
; Generated using SmartGUI Creator 4.0
Gui, Show, x1000 y75 h150 w450, Quickcopy
Return
; Setup CAPSLOCK SEARCH FUNCTION
CAPS: ; Capslock button searches google with highlighted info
Gui, Submit, Nohide
MsgBox, Value is %Checkbox% ; Pop up to tell me if I am returning a value in the variable, I had some issues with getting no value early on.
If Checkbox = 1
{
Capslock:: ; Capslock button searches google with highlighted info
{
Send, ^c
Sleep 50
Run, http://www.google.com/search?q=%clipboard%
}
^Capslock::Capslock ;CNTL Capslock will do normal capslock function
}
return
GuiClose:
ExitApp