Jump to content

Get text from input or edit box


Recommended Posts

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
Link to comment
Share on other sites

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

$str = GUICtrlRead($tracking)

$str then equals the text in $tracking.

Edited by spudw2k
Link to comment
Share on other sites

  • Jos locked this topic
Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...