Sign in to follow this  
Followers 0
Linkman81

Get text from input or edit box

3 posts in this topic

#1 ·  Posted (edited)

Hi there. I'm a weekend AutoIt user...usually to automate some game I'm playing to farm gold, or to open up my favorite DOS games with DosBox. I'm recently trying to mess with GUIs and I can't seem to figure out how to retrieve the text entered into an input box or edit box. I wanted to make a GUI where I could enter text in an input box or edit box (I guess I assume you can accomplish the same thing with both types of boxes. Correct me if I'm wrong) and then the script would type that text into a web pages input box for me later. I just can't figure out the command to retrieve the text that was entered into the box. I've tried messing with GUICTRLREAD but I can't get it to work. This is my current script. It is to track my UPS packages. It opens up an Internet explorer window and does all the typing for me.

#include <GUIConstants.au3>
GUICreate("Track Packages", 340, 120)
$tracking = GuiCtrlCreateEdit("Enter Tracking Numbers Here", 10, 10, 160, 80)
$button = GuiCtrlCreateButton("Track!", 200, 50, 100, 30)

GuiSetState(@SW_SHOW)
While 1
$msg = GUIGetMsg()
Select
    Case $msg = $button
        Run ("C:\program files\internet explorer\iexplore.exe")
        WinWaitActive ("Google - Windows Internet Explorer")
        Sleep (1000)
        Send ("^o")
        Sleep (1000)
        Send ("www.ups.com/tracking/tracking.html")
        Sleep (500)
        Send ("{enter}")
        WinWaitActive ("UPS: Tracking Information - Windows Internet Explorer")
        Sleep (1000)
        Send ("^f")
        Sleep (500)
        Send ("Tracking Numbers:")
        Send ("{enter}")
        Sleep (500)
        Send ("{esc}")
        Sleep (500)
        Send ("{tab}")
        Sleep (500)
        guictrlread ($tracking,1);???????????????????????????????????????????
        Sleep (500)
        Send ("{TAB 2}")
        Sleep (500)
        Send ("{enter}")
    Case $msg = $GUI_EVENT_CLOSE
      ExitLoop
  EndSelect
WEnd

Someone please help me to know what the heck I need to do to retrieve the text.

Brandon

Edited by Linkman81

Share this post


Link to post
Share on other sites



Here is a simple example in how you get the data that is typed into an inputbox:

$name = InputBox("Name","Type in your name","Name Here")
MsgBox(0,"Name","Your name is: " & $name)

Regards

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Use the GUICtrlRead() Function to read your $tracking Edit ctrl.

$str = GUICtrlRead($tracking)

$str then equals the text in $tracking.

Edited by spudw2k

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