Is there a way to create a HotString that pulls from one of those text boxes? For example, lets say I have a Name, Phone # and Email text box in the GUI. Can I have a HotString that functions like the following?
Code: Select all
::CRM1::FetchDataFromGUI()
FetchDataFromGUI() {
combinedData := Name.Value . " " . PhoneNumber.Value . " " . EmailAddress.Value
old_clip := ClipboardAll()
A_clipboard := combinedData
send "^v"
send "{Down}"
sleep 333 ;or clipwait
A_Clipboard := old_clip
}
If it helps, here is the relevant bit of code within my script
Code: Select all
::CRM1::FetchDataFromGUI()
FetchDataFromGUI() {
combinedData := MachineSN.Value
old_clip := ClipboardAll()
A_clipboard := combinedData
send "^v"
send "{Down}"
sleep 333 ;or clipwait
A_Clipboard := old_clip
}
; Open Hotline Helper GUI
#h::{
; GetCurrentMonitor: Gets the current monitor index based upon mouse position
GetCurrentMonitor() {
CoordMode "Mouse", "Screen"
MouseGetPos &MouseX, &MouseY
NumMonitors := MonitorGetCount()
Loop NumMonitors {
MonitorGet A_Index, &MonitorLeft, &MonitorTop, &MonitorRight, &MonitorBottom
If (MouseX >= MonitorLeft And MouseX < MonitorRight And MouseY >= MonitorTop And MouseY < MonitorBottom)
Return A_Index
}
Return 1 ; should never really execute
}
; Create a new GUI object
MyGui := Gui("+AlwaysOnTop", "Hotline Helper")
; Set up margins
pad := 10
MyGui.MarginX := MyGui.MarginY := pad
; Add tabs
MyGui.Add("Tab3",, ["Main","Shortcuts","Other"])
; Add controls to the Main GUI
MyGui.Add("Button","Default w80 section", "&TheWorks").OnEvent("Click", TheWorks_Btn)
MyGui.Add("Button","Default w80 ys", "&AIS").OnEvent("Click", AIS_Btn)
MyGui.Add("Button","Default w80 ys", "&CRM").OnEvent("Click", CRM_Btn)
MyGui.Add("Text", "xm y+10", " Machine SN:")
MachineSN := MyGui.Add("Edit","w100 vMachineSN")
MyGui.Add("Text", "xm y+10", " Customer Name:")
CustomerName := MyGui.Add("Edit","w200 vCustomerName")
MyGui.Add("Text", "xm y+10", " Phone Number:")
PhoneNumber := MyGui.Add("Edit","w125 vPhoneNumber")
MyGui.Add("Text", "xm y+10", " Email Address:")
EmailAddress := MyGui.Add("Edit","w200 vEmailAddress")
MyGui.Add("Text","xm y+10", " Alarm:")
Alarm := MyGui.Add("Edit","w300 r3 vAlarm")
MyGui.Add("Text","", " T/S:")
TS := MyGui.Add("Edit","w300 r6 vTS")
MyGui.Add("Text","", " Solution:")
Solution := MyGui.Add("Edit","w300 r4 vSolution")
MyGui.Add("Button","Default w80 section", "&Exit").OnEvent("Click", Exit_Btn)
MyGui.Add("Button","Default w80 ys", "&Wipe").OnEvent("Click", Wipe_Btn)
; Add controls to the Shortcuts GUI
; Show the GUI
CurrentMonitor := GetCurrentMonitor()
MonitorGet CurrentMonitor, &MonitorLeft, &MonitorTop, &MonitorRight, &MonitorBottom
MyGui.GetClientPos(&x, &y, &w, &h)
x := Integer(((MonitorRight - MonitorLeft - w) / 2) + MonitorLeft)
y := Integer(((MonitorBottom - MonitorTop - h) / 2) + MonitorTop)
MyGui.Show("x" x " y" y)
; Define button click functions
Exit_Btn(*) {
MyGui.Destroy()
}
Wipe_Btn(*) {
MachineSN.Value := "" ; Set the edit box's value to an empty string, clearing it
CustomerName.Value := "" ; Set the edit box's value to an empty string, clearing it
PhoneNumber.Value := "" ; Set the edit box's value to an empty string, clearing it
EmailAddress.Value := "" ; Set the edit box's value to an empty string, clearing it
Alarm.Value := "" ; Set the edit box's value to an empty string, clearing it
TS.Value := "" ; Set the edit box's value to an empty string, clearing it
Solution.Value := "" ; Set the edit box's value to an empty string, clearing it
}
AIS_Btn(*) {
Run "secretwebsiteurl" MachineSN.Value
}
CRM_Btn(*) {
MsgBox "This doesn't do anything. Yet."
}
TheWorks_Btn(*){
Run "secretwebsiteurl" MachineSN.Value
Run "secretwebsiteurl" MachineSN.Value
}
CloseGUI() {
ExitApp() ; Close the script
}
}
Return