 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Mkbailey755
Joined: 20 Aug 2007 Posts: 178
|
Posted: Mon Jul 21, 2008 1:11 am Post subject: Edit box not accepting variable %Account% |
|
|
I have been working on a problem that I thought I solved but its still not working.
| Code: |
Gui, Add, Edit, x16 y40 w110 h25 gAccount vAccount, ;Edit box for the GUI
Test:
msgbox, %Account%
return
|
I type Account numbers in the edit box and should store the info in the Edit box as vAccount, correct?
the Msgbox shows blank. Can edit boxes have variable?
Im thinking I need to use a GuicontrolGet. Im really having a hard time understanding this
I use the variable to use FileRead, content,%Accounts%.txt it makes a file called .txt even though I type 032 in the account edit box the glabel works fine
| Code: | Account:
Keywait Enter, D
FormatTime, var2,, MMMM dd yyyy hh:mm:ss
ControlSend,Edit2,%var2%`n,Notes System,
FileRead, content,C:\Note System\%Account%.txt
Gui, 2:Add, Edit, x0 y0 w270 h350 +Wrap +ReadOnly ,%content%
Gui, 2:Show, x355 y275 h355 w275, Account Info
return |
Complete Code
| Code: |
#NoEnv
#SingleInstance
Gui, Add, DateTime, x206 y7 w100 h30,
;Edit box for Account number
Gui, Add, Edit, x16 y40 w110 h25 gAccount vAccount,
;end edit box
Gui, Add, DropDownList, x16 y70 w110 h400 Choose1 gDDL_Application vLabel, Application||WinXP|Vista|MacOs|I.E|Firefox|WebCam|Other
Gui, Add, DropDownList, x16 y100 w110 h400 gDDL_Problem vProblem Choose1, Problem,
Gui, Add, Listbox, x136 y40 w200 h110 gLB_Solution vSolution Choose1 +Wrap, Solution
Gui, Add, Edit, x16 y210 w300 h100 vEdit +Wrap,
Gui, Add, Edit, x16 y310 w300 h100 gFix vFix +Wrap +ReadOnly,
Gui, Add, Button, x16 y415 w149 h30 gLog ,Create Notes
Gui, Add, Button, x167 y415 w149 h30 gTest ,Test
Gui, Show, x144 y306 h450 w343, Notes System
Return
Account:
Keywait Enter, D
FormatTime, var2,, MMMM dd yyyy hh:mm:ss
ControlSend,Edit2,%var2%`n,Notes System,
FileRead, content,C:\Note System\%Account%.txt
Gui, 2:Add, Edit, x0 y0 w270 h350 +Wrap +ReadOnly ,%content%
Gui, 2:Show, x355 y275 h355 w275, Account Info
return
DDL_Application:
FormatTime, var2,, MMMM dd yyyy hh:mm:ss
ControlSend,Edit2,%var2%`n,Notes System,
Gui, Submit, NoHide
If IsLabel(Label)
GoSub, %Label%
Return
Vista:
Control, EditPaste, Edit2,Windows Vista`n, Notes System,
GuiControl, , Problem, |Problem||Problem1||Problem2|Problem3|Problem4|Problem5|Problem6|Vista
Return
WinXP:
ControlSend, Edit2,Windows XP`n, Notes System,
GuiControl, , Problem, |Problem||Problem1|Problem2|Problem3|Problem4|Problem5|Problem6|XP
Return
MacOs:
ControlSetText, Edit2, Macintosh`n, Notes System,
GuiControl, , Problem, |Problem||Problem1|Problem2|Problem3|Problem4|Problem5|Problem6|Mac Os
Return
I.E:
ControlSend, Edit2,Inernet Explorer 7/6`n, Notes System,
GuiControl, , Problem, |Problem||Problem1|Problem2|Problem3|Problem4|Problem5|Problem6|I.E
Return
Firefox:
ControlSend, Edit2,Firefox`n, Notes System,
GuiControl, , Problem, |Problem||Problem1|Problem2|Problem3|Problem4|Problem5|Problem6|Firefox
Return
Other:
ControlSend, Edit2,Other`n, Notes System,
GuiControl, ,Other,|Other||Other
Return
DDL_Problem:
Gui, Submit, NoHide
If IsLabel(Label)
GoSub, %Problem%
Return
Problem1:
ControlSend, Edit2,Problem1`n, Notes System,
GuiControl, , Solution, |Solution||Solution1:the quick fox jumped over the lazy dog|Solution2|Solution3|Solution4|Solution5|Solution6|Solution7|Solution8|
return
Problem2:
ControlSend, Edit2,Problem2`n, Notes System,
GuiControl, , Solution, |Solution||Solution1|Solution2|Solution3|Solution4|Solution5|Solution6|Solution7|Solution8|
return
Problem3:
ControlSend, Edit2,Problem3`n, Notes System,
GuiControl, , Solution, |Solution||Solution1|Solution2|Solution3|Solution4|Solution5|Solution6|Solution7|Solution8|
return
Problem4:
ControlSend, Edit2,Problem4`n, Notes System,
GuiControl, , Solution, |Solution||Solution1|Solution2|Solution3|Solution4|Solution5|Solution6|Solution7|Solution8|
return
Problem5:
ControlSend, Edit2,Problem5`n, Notes System,
GuiControl, , Solution, |Solution||Solution1|Solution2|Solution3|Solution4|Solution5|Solution6|Solution7|Solution8|
return
Problem6:
ControlSend, Edit2,Problem6`n, Notes System,
GuiControl, , Solution, |Solution||Solution1|Solution2|Solution3|Solution4|Solution5|Solution6|Solution7|Solution8|
return
LB_Solution:
Gui, Submit, NoHide
If IsLabel(Label)
GuiControlGet, Solution
ControlSend, Edit2,%Solution%`n, Notes System,
return
Log:
ControlGetText, Notes, Edit2, Notes System, ,
FileAppend, %Notes%`n, C:\%Account%.txt
return
Test:
msgbox,Account
GuiClose:
ExitApp
|
|
|
| Back to top |
|
 |
SpiderGames
Joined: 09 Jun 2008 Posts: 464 Location: Canada
|
Posted: Mon Jul 21, 2008 1:26 am Post subject: |
|
|
Well this shoudl work it worked for me...
| Code: |
Gui, Add, Edit, x16 y40 w110 h25 vAccount,
Gui, Add, button,, Ok
Gui, Show
Return,
ButtonOk:
Gui, Submit ;This is what you were missing... add ",NoHide" to keep gui showing...
msgbox, %Account%
return,
|
=P _________________
Xfire: SpiderGames77 |
|
| Back to top |
|
 |
Mkbailey755
Joined: 20 Aug 2007 Posts: 178
|
Posted: Mon Jul 21, 2008 1:32 am Post subject: |
|
|
| Sweet! thanks, Im going to read up more on GUI Submit but can you give me a brief explanation on GUISubmit? |
|
| Back to top |
|
 |
SpiderGames
Joined: 09 Jun 2008 Posts: 464 Location: Canada
|
Posted: Mon Jul 21, 2008 1:53 am Post subject: |
|
|
Sure...
When you have an edit box it will let you put any variable you want in it. It wont store this variable untill it is "submited" via Gui, Submit. This stops you form doign somethign like this...
You go to type "i like fish" in an edit box.
While your typeing "i" will be saved, then "i " then "i l" then "i li"... and so on.
Get it?
| Code: |
Gui, Submit, NoHide ; Stops Gui Closing...
|
_________________
Xfire: SpiderGames77 |
|
| Back to top |
|
 |
Krogdor
Joined: 18 Apr 2008 Posts: 1145 Location: The Interwebs
|
Posted: Mon Jul 21, 2008 1:56 am Post subject: |
|
|
| Gui, Submit gets the state of all the input-capable controls in the GUI and saves them in their respective variables. Normally it also hides the window (the same as pressing the "X" button) but by adding the NoHide option (Gui, Submit, NoHide) the window will stay visible. |
|
| Back to top |
|
 |
SKAN
Joined: 26 Dec 2005 Posts: 6264
|
Posted: Mon Jul 21, 2008 2:41 am Post subject: |
|
|
Gui,Submit will be required when dealing with large number of controls and associated variables. It is better to use individual GuiControlGet to retrieve individual var contents.
| Code: | Gui, Add, Edit, x16 y40 w110 h25 vAccount ,
Gui, Add, Button,, Ok
Gui, Show
Return
ButtonOk:
GuiControlGet, Account
MsgBox, %Account%
Return |
 _________________
 |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|