Sign in to follow this  
Followers 0
RacecarSoft

How do you make a text box that sets a variables value to what is typed?

8 posts in this topic

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


[s]Visit My Website[/s] (this isn't up 24/7). (SITE DOWN) This is now a HP MediaSmart site, I'm trying to get my server working the way I want it to.24/7 site (make sure you have noscript, sorry!): 24/7 [u]WARNING: MUST have NoScript so you can block quantserve/quantcast![/u] If you don't, the evil freewebs/webs/quantcast/quantserve/WHATEVER virus will get you![spoiler]Hey, look! It's a spoiler![/spoiler]Software: KeyPress, Advanced Calculator (not autoit), WUK (Windows Update Killer)my account over a year old : >... I do Linux.

Share this post


Link to post
Share on other sites



$input = InputBox("Window title", "Enter your variable:")
MsgBox(0,"User input is..",$input)

:)

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

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

Edited by Zedna

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

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! :)

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

Edited by RacecarSoft

[s]Visit My Website[/s] (this isn't up 24/7). (SITE DOWN) This is now a HP MediaSmart site, I'm trying to get my server working the way I want it to.24/7 site (make sure you have noscript, sorry!): 24/7 [u]WARNING: MUST have NoScript so you can block quantserve/quantcast![/u] If you don't, the evil freewebs/webs/quantcast/quantserve/WHATEVER virus will get you![spoiler]Hey, look! It's a spoiler![/spoiler]Software: KeyPress, Advanced Calculator (not autoit), WUK (Windows Update Killer)my account over a year old : >... I do Linux.

Share this post


Link to post
Share on other sites

Thanks alot! :)

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)


[s]Visit My Website[/s] (this isn't up 24/7). (SITE DOWN) This is now a HP MediaSmart site, I'm trying to get my server working the way I want it to.24/7 site (make sure you have noscript, sorry!): 24/7 [u]WARNING: MUST have NoScript so you can block quantserve/quantcast![/u] If you don't, the evil freewebs/webs/quantcast/quantserve/WHATEVER virus will get you![spoiler]Hey, look! It's a spoiler![/spoiler]Software: KeyPress, Advanced Calculator (not autoit), WUK (Windows Update Killer)my account over a year old : >... I do Linux.

Share this post


Link to post
Share on other sites

Please wait 24 hours before bumping your post.

You might want to look here specifically.

Local $i

$i = 0

While $i <= 0

$var = Send( $var )

Sleep(05)

WEnd

You reset $var to be the return value of send.... :)

Cheers,

Brett

Share this post


Link to post
Share on other sites

Please wait 24 hours before bumping your post.

You might want to look here specifically.

Local $i

$i = 0

While $i <= 0

$var = Send( $var )

Sleep(05)

WEnd

You reset $var to be the return value of send.... :)

Cheers,

Brett

Oh, thanks!


[s]Visit My Website[/s] (this isn't up 24/7). (SITE DOWN) This is now a HP MediaSmart site, I'm trying to get my server working the way I want it to.24/7 site (make sure you have noscript, sorry!): 24/7 [u]WARNING: MUST have NoScript so you can block quantserve/quantcast![/u] If you don't, the evil freewebs/webs/quantcast/quantserve/WHATEVER virus will get you![spoiler]Hey, look! It's a spoiler![/spoiler]Software: KeyPress, Advanced Calculator (not autoit), WUK (Windows Update Killer)my account over a year old : >... I do Linux.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0