viriiman Posted January 18, 2007 Share Posted January 18, 2007 I know something's wrong, I just don't know where: CODERun("C:\pqr\Get_Network_Adapter_Address.exe") Do $text = WinGetText("", "") If $text = ("NOT found in Server Database") Then Run("notepad.exe C:\pqr\users.ini") Sleep(500) Run("cmd.exe") Sleep(500) Send("ipconfig /all") Send("{ENTER}") WinWaitClose("users.ini - Notepad") Send("{ENTER 2}") ElseIf $text = ("Insert Text Here") Then WinWaitActive("Title" , "Text") Send("(ENTER)") WinWaitActive("Title" , "Text") Send("(ENTER)") EndIf Until WinWaitClose("NIC Address and Computer Name") The first half is (pretty much) completed code. If the MAC address isn't located in the database, the script pulls up a dos prompt, sends it the ipconfig so I can get the MAC, and the opens up the .ini file I need to put the MAC address in. The second half needs to wait until I have access to a PC to replicate what happens is if does successfully locate the mac in the database. It's all dialog boxes that pop up, which I should be able to deal with. The trick is not every location will give me this error (some places I visit will allow the program to automatically get the MAC address, other places it won't). At the end of the script, it's going to run the final program (which I think I can handle). I also am using the WinGetText because the titles of the dialog boxes are the same if the program succeeds or fails. Hope all of this info is helpful. I've tried for about two hours now to figure this out on my own (and with the help of other posts in the fourms and the help file), but I'm just stumped. THANKS! Link to comment Share on other sites More sharing options...
Zedna Posted January 18, 2007 Share Posted January 18, 2007 (edited) First of all: After EVERY Run() add WinWaitActive() function. Edited January 18, 2007 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Developers Jos Posted January 18, 2007 Developers Share Posted January 18, 2007 (edited) First of all: After EVERY Run() add WinWaitActive() function.Just WinWait() will do ... WinWaitActive() could be tricky when the window doesn't get the focus .. Also WinGetText() should have one of the first two parameters filled in that makes the target window unique and thus properly selected. Edited January 18, 2007 by JdeB SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Zedna Posted January 18, 2007 Share Posted January 18, 2007 Just WinWait() will do ... WinWaitActive() could be tricky when the window doesn't get the focus .. He is using Send() which works only with active window.So maybe combination: WinWait() + WinActivate() Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
viriiman Posted January 19, 2007 Author Share Posted January 19, 2007 He is using Send() which works only with active window.So maybe combination: WinWait() + WinActivate()The reason (in the first section) that I don't user WinWait is because the title of the screen can differ as it's a DOS prompt. The sleep and send works well.My concern is that I haven't written the code correctly. I have the second half of the info I need and will be putting it in shortly. Link to comment Share on other sites More sharing options...
viriiman Posted January 19, 2007 Author Share Posted January 19, 2007 (edited) CODERun("C:\pqr\Get_Network_Adapter_Address.exe") Do $text = WinGetText("", "") If $text = ("NOT found in Server Database") Then Run("notepad.exe C:\pqr\users.ini") Sleep(500) Run("cmd.exe") Sleep(500) Send("ipconfig /all") Send("{ENTER}") WinWaitClose("users.ini - Notepad") Send("{ENTER 2}") ElseIf $text = ("NIC Address and Computer Name updated Successfully") Then Send("(ENTER)") EndIf Until WinWaitClose("NIC Address and Computer Name") Run("C:\pqr\program.exe") (The above is the final code) With the above code, when it gets to the dialog box that says "Not found in databse", it doesn't open notepad and barrels on through right to the C:\pqr\program.exe What did I do wrong? Edited January 19, 2007 by viriiman 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