Page 1 of 1
How do you make a text box that sets a variables value to what is typed? PLEASE HELP! Read thread for more info.
#1
Posted 26 November 2008 - 10:18 AM
I want to make a text box that pops up and asks what they want to be in the variable.
I tried this (oh and btw credit to the autoit examples because this is a copy off of some of it):
CODE:
Example()
Func Example()
Local $myedit, $msg, $TYPEME
$var = "foo"
GUICreate("My GUI edit") ; will create a dialog box that when displayed is centered
$myedit = GUICtrlCreateEdit("" & $var & @CRLF, 176, 32, 121, 97, $ES_AUTOVSCROLL + $WS_VSCROLL)
GUISetState()
Send("{END}")
; Run the GUI until the dialog is closed
While 1
$msg = GUIGetMsg()
If $msg = $GUI_EVENT_CLOSE Then ExitLoop
WEnd
GUIDelete()
MsgBox(64, $var, "test to see if the change worked")
EndFunc ;==>Example
END CODE
But when I modify the text box, it reverts the variable to "foo" again, how do I make the text box actually EDIT it rather than ignoring the changes? Please help!
Racecar 56
I tried this (oh and btw credit to the autoit examples because this is a copy off of some of it):
CODE:
Example()
Func Example()
Local $myedit, $msg, $TYPEME
$var = "foo"
GUICreate("My GUI edit") ; will create a dialog box that when displayed is centered
$myedit = GUICtrlCreateEdit("" & $var & @CRLF, 176, 32, 121, 97, $ES_AUTOVSCROLL + $WS_VSCROLL)
GUISetState()
Send("{END}")
; Run the GUI until the dialog is closed
While 1
$msg = GUIGetMsg()
If $msg = $GUI_EVENT_CLOSE Then ExitLoop
WEnd
GUIDelete()
MsgBox(64, $var, "test to see if the change worked")
EndFunc ;==>Example
END CODE
But when I modify the text box, it reverts the variable to "foo" again, how do I make the text box actually EDIT it rather than ignoring the changes? Please help!
Racecar 56
#3
Posted 26 November 2008 - 10:34 AM
Example() Func Example() Local $myedit, $msg, $TYPEME $var = "foo" GUICreate("My GUI edit"); will create a dialog box that when displayed is centered $myedit = GUICtrlCreateEdit("" & $var & @CRLF, 176, 32, 121, 97, $ES_AUTOVSCROLL + $WS_VSCROLL) GUISetState() Send("{END}") ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd $var = GUICtrlRead($myedit) GUIDelete() MsgBox(64, $var, "test to see if the change worked") EndFunc;==>Example
This post has been edited by Zedna: 26 November 2008 - 10:34 AM
#4
Posted 26 November 2008 - 10:41 AM
Zedna, on Nov 26 2008, 03:34 AM, said:
Example() Func Example() Local $myedit, $msg, $TYPEME $var = "foo" GUICreate("My GUI edit"); will create a dialog box that when displayed is centered $myedit = GUICtrlCreateEdit("" & $var & @CRLF, 176, 32, 121, 97, $ES_AUTOVSCROLL + $WS_VSCROLL) GUISetState() Send("{END}") ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd $var = GUICtrlRead($myedit) GUIDelete() MsgBox(64, $var, "test to see if the change worked") EndFunc;==>Example
Thanks alot! :D
EDIT: Oh shoot! It puts 1's after it types! Here is the full code (to see if any of you out there can improve it :) ) :
CODE
#cs ----------------------------------------------------------------------------
AutoIt Version: 3.2.12.1
Author: Racecar56
Script Function:
Template AutoIt script.
#ce ----------------------------------------------------------------------------
; Script Start - Add your code below here
;----------==Includes==----------
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <EditConstants.au3>
#include <StaticConstants.au3>
;----------==Options==-----------
Opt('MustDeclareVars', 1)
;----------==Local==-------------
Local $var
;----------==Script==------------
Global $oMyError
Example()
Func Example()
Local $myedit, $msg, $TYPEME
$var = "foo"
GUICreate("My GUI edit"); will create a dialog box that when displayed is centered
$myedit = GUICtrlCreateEdit("" & $var & @CRLF, 176, 32, 121, 97, $ES_AUTOVSCROLL + $WS_VSCROLL)
GUISetState()
Send("{END}")
; Run the GUI until the dialog is closed
While 1
$msg = GUIGetMsg()
If $msg = $GUI_EVENT_CLOSE Then ExitLoop
WEnd
$var = GUICtrlRead($myedit)
GUIDelete()
MsgBox(64, $var, "test to see if the change worked")
EndFunc;==>Example
Local $i
$i = 0
While $i <= 0
$var = Send( $var )
Sleep(05)
WEnd
END OF CODE
This post has been edited by RacecarSoft: 26 November 2008 - 10:48 AM
#5
Posted 26 November 2008 - 11:03 AM
RacecarSoft, on Nov 26 2008, 03:41 AM, said:
Thanks alot! :D
EDIT: Oh shoot! It puts 1's after it types! Here is the full code (to see if any of you out there can improve it :) ) :
CODE
#cs ----------------------------------------------------------------------------
AutoIt Version: 3.2.12.1
Author: Racecar56
Script Function:
Template AutoIt script.
#ce ----------------------------------------------------------------------------
; Script Start - Add your code below here
;----------==Includes==----------
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <EditConstants.au3>
#include <StaticConstants.au3>
;----------==Options==-----------
Opt('MustDeclareVars', 1)
;----------==Local==-------------
Local $var
;----------==Script==------------
Global $oMyError
Example()
Func Example()
Local $myedit, $msg, $TYPEME
$var = "foo"
GUICreate("My GUI edit"); will create a dialog box that when displayed is centered
$myedit = GUICtrlCreateEdit("" & $var & @CRLF, 176, 32, 121, 97, $ES_AUTOVSCROLL + $WS_VSCROLL)
GUISetState()
Send("{END}")
; Run the GUI until the dialog is closed
While 1
$msg = GUIGetMsg()
If $msg = $GUI_EVENT_CLOSE Then ExitLoop
WEnd
$var = GUICtrlRead($myedit)
GUIDelete()
MsgBox(64, $var, "test to see if the change worked")
EndFunc;==>Example
Local $i
$i = 0
While $i <= 0
$var = Send( $var )
Sleep(05)
WEnd
END OF CODE
EDIT: Oh shoot! It puts 1's after it types! Here is the full code (to see if any of you out there can improve it :) ) :
CODE
#cs ----------------------------------------------------------------------------
AutoIt Version: 3.2.12.1
Author: Racecar56
Script Function:
Template AutoIt script.
#ce ----------------------------------------------------------------------------
; Script Start - Add your code below here
;----------==Includes==----------
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <EditConstants.au3>
#include <StaticConstants.au3>
;----------==Options==-----------
Opt('MustDeclareVars', 1)
;----------==Local==-------------
Local $var
;----------==Script==------------
Global $oMyError
Example()
Func Example()
Local $myedit, $msg, $TYPEME
$var = "foo"
GUICreate("My GUI edit"); will create a dialog box that when displayed is centered
$myedit = GUICtrlCreateEdit("" & $var & @CRLF, 176, 32, 121, 97, $ES_AUTOVSCROLL + $WS_VSCROLL)
GUISetState()
Send("{END}")
; Run the GUI until the dialog is closed
While 1
$msg = GUIGetMsg()
If $msg = $GUI_EVENT_CLOSE Then ExitLoop
WEnd
$var = GUICtrlRead($myedit)
GUIDelete()
MsgBox(64, $var, "test to see if the change worked")
EndFunc;==>Example
Local $i
$i = 0
While $i <= 0
$var = Send( $var )
Sleep(05)
WEnd
END OF CODE
Anybody there? (sorry for dubble post)
#7
Posted 26 November 2008 - 11:40 AM
Page 1 of 1

Sign In
Register
Help
MultiQuote