Jump to content

Read Text


Recommended Posts

I use this program for work called ADP to sign in to tickets I am working on.

When the ADP program first starts up, it goes to a screen that you have to enter the command TK {ENTER} to get to the Tech section and that is where a RO number needs to be entered.

Most the time the ADP window will just be on the enter RO section but there is a chance that it will be left on the 1st page where TK will need to be entered in 1st.

I need Autoit to read a line text on the page that is open to know if it needs to enter in TK first or just start with he RO number.

This is how I am starting this process

; Make GUI
#include <GuiConstants.au3>
GuiCreate("Nissan Auto-RO", 320, 140)
Opt("GUIOnEventMode",1)

; Define Variables
$txtData =""
$techData =""

;Make label
GuiCtrlCreateLabel("RO Number:", 0, 0, 240, 40)
GuiCtrlCreateLabel("Tech Number:", 0, 40, 240, 40)

;Make inputbox
$txtData = GuiCtrlCreateInput("", 0, 15, 230, 20)
$techData = GuiCtrlCreateInput("", 0, 55, 230, 20)

;Make button
$exebutton = GuiCtrlCreateButton("OK",240, 50, 60, 20)
;Say what function to run on button click.
GUICtrlSetOnEvent($exebutton,"submit")

;GuiEvent
GUISetOnEvent($GUI_EVENT_CLOSE,"OnExit")

;Display GUI
GuiSetState()

;Loop
While 1
   Sleep (10)
Wend

;############## Functions ###############

Func submit()
;Get the data from the form
    $disData = GUICtrlRead($txtData)
    $NumData = GUICtrlRead($techData)
;display the form
;Run("notepad.exe")
    WinActivate ( "ADP.EXE.txt - Notepad")
    WinSetState ( "ADP.EXE.txt - Notepad", "", @SW_MAXIMIZE  )


    Sleep(2000)
    Send($disData)
    Send("{ENTER}")
    Send($NumData)
;MsgBox(0, "Thank you.", $disData )
EndFunc

Func OnExit()
    Exit
EndFunc

I have this text opening up in notepad until I get it working right and the I would be changing the name in the WinActivate to the ADP window title.

Link to comment
Share on other sites

1

Welcome to the Forums

2

Nice presentation of your first post, script and question

3

i would suggest you familiarize yourself with the AU3Info.exe Window

( it's located in the Autoit3 folder)

with that info... we can do a loop to see which window is visible

example

While 1

if Winactive(first title, text ) then

do this

exitloop

endif

if Winactive(second title, text ) then

do this

exitloop

endif

wend

8)

Edited by Valuater

NEWHeader1.png

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

  • Recently Browsing   0 members

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