99Cent Posted March 17, 2006 Share Posted March 17, 2006 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 expandcollapse popup; 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 More sharing options...
Valuater Posted March 17, 2006 Share Posted March 17, 2006 (edited) 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 March 17, 2006 by Valuater Link to comment Share on other sites More sharing options...
Valuater Posted March 17, 2006 Share Posted March 17, 2006 i should have mentioned there is a great tutorial that demonstratesAu3info and using it with other windows herehttp://www.autoitscript.com/forum/index.php?showtopic=21048#8 Link to comment Share on other sites More sharing options...
99Cent Posted March 17, 2006 Author Share Posted March 17, 2006 Thank you very much I got it. also, thanks for the link Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now