straikeris03 Posted November 23, 2016 Share Posted November 23, 2016 In my work always pops up, program error, and i have to press enter on window and to reload program. So for that reason i started to learn about Autoit scripting. I already found how to relaunch the program ShellExecute("C:\Program Files (x86)\Steam\Steam.exe") i'm creating it at home and will test in few days in work, for now i don't know locations and other needed information, so just trying to do part by part. and for now i need that Autoit detects that Pop up window and press "enter" #include <MsgBoxConstants.au3> MsgBox($MB_SYSTEMMODAL, "a", "b" ) WinWaitActive("a", "", 3) ;Waits 3 seconds to see if the a window appears If WinExists("a") <> 0 Then ;If the a window exists Send("{ENTER}") ;Sends the Enter key, which will close the menu by selecting the default "OK" button. WinWaitClose("a", "", 10) ;Waits up to 10 seconds for the window to close. EndIf this seems fine but not working, it creates window "a" but not pressing Enter, why? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted November 23, 2016 Moderators Share Posted November 23, 2016 straikeris03, Welcome to the AutoIt forum. Quote In my work And yet you launch Steam.exe? Are you not actually playing games? If that is indeed the case, you appear to have missed the Forum rules on your way in. Please read them now - particularly the bit about not discussing game launching. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
straikeris03 Posted November 23, 2016 Author Share Posted November 23, 2016 i'm working with crane, like i said this is only for test, i will redo all at work. Link to comment Share on other sites More sharing options...
straikeris03 Posted November 23, 2016 Author Share Posted November 23, 2016 the problem is that error occurred with crane script, that it drops error every 10-15min. and you have to relaunch it. We can't find person who wrote it and company who does monthly repairs said that to write new one would cost like 8-9k eu, so i thought autoit could help us. I think the problem occurred then flashdrive died. Link to comment Share on other sites More sharing options...
straikeris03 Posted November 23, 2016 Author Share Posted November 23, 2016 i would do all with auto mouse moves, but there are other people without me, we have to check weights and cycles we made every hour so it would be troublesome for them every time to close and reopen program (autoit). anyway if anyone could tell why it does not see table "a" and why does not press "enter" would be great. Link to comment Share on other sites More sharing options...
MuffinMan Posted November 23, 2016 Share Posted November 23, 2016 It sounds like you sufficiently answered the mods question regarding game automation... The Msgbox command stops the script from running, so the subsequent lines of code won't run until after you've closed the box. I think you are very close, try another program you start outside the script to test it, maybe the file save dialog in Word, Excel, etc? You'll probably want to investigate a loop like While... Wend to keep your script running. Link to comment Share on other sites More sharing options...
straikeris03 Posted November 23, 2016 Author Share Posted November 23, 2016 thx, you there right, it works now and i can move on now i just need to relaunch it and bid start and end program buttons i start to like it next move will be to take weights and cycles and put it in table Run("C:\Program Files\DVD Maker\DVDMaker.exe") WinWaitActive("C:\Program Files\DVD Maker\DVDMaker.exe", "", 3) If WinExists("Windows DVD Maker") <> 0 Then Send("{ENTER}") WinWaitClose("Windows DVD Maker", "", 10) EndIf Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted November 23, 2016 Moderators Share Posted November 23, 2016 51 minutes ago, MuffinMan said: It sounds like you sufficiently answered the mods question regarding game automation... In the future, when a Mod steps into a thread to request more information, please follow the route of common sense and wait until they say one way or another rather than speaking for us. MuffinMan 1 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
straikeris03 Posted November 23, 2016 Author Share Posted November 23, 2016 do i need to install Autoit in office computer, or script can work without it? Link to comment Share on other sites More sharing options...
aa2zz6 Posted November 24, 2016 Share Posted November 24, 2016 Does the popup force close your program? If it's a popup then couldn't you use the AutoIt window tool, find the Class, and use WinClose to shut it off? $hWnd1 = WinGetHandle("[CLASS:GOES HERE]"); Use AutoIt window tool If IsHWnd($hWnd1) Then WinActivate($hWnd1) WinClose("[CLASS:GOES HERE]") EndIf EndIf While sleep(10000); how often does it popup? WEnd Link to comment Share on other sites More sharing options...
snoopie Posted November 24, 2016 Share Posted November 24, 2016 9 hours ago, straikeris03 said: do i need to install Autoit in office computer, or script can work without it? You can compile your script into an .exe (Scite F7) which runs as a single file executable on windows machines. You're better off with WinExists() and then WinClose() or WinKill(). If that doesn't work use ControlClick(). That way your popup doesn't have to be active and you're not sending system wide ENTER keys which may interfere with the current user. Link to comment Share on other sites More sharing options...
straikeris03 Posted November 24, 2016 Author Share Posted November 24, 2016 9 hours ago, aa2zz6 said: Does the popup force close your program? yes it forces to restart the program, i can't tell time, sometimes it's 10min, sometimes more. Link to comment Share on other sites More sharing options...
straikeris03 Posted November 24, 2016 Author Share Posted November 24, 2016 3 hours ago, snoopie said: That way your popup doesn't have to be active and you're not sending system wide ENTER keys which may interfere with the current user. that's why i wanted autoit to detect that pop up window and just then to press enter, i will try the commands you said. thx for information Link to comment Share on other sites More sharing options...
straikeris03 Posted November 24, 2016 Author Share Posted November 24, 2016 ShellExecute ( "C:\Program Files (x86)\Microsoft Office\OFFICE11\EXCEL.exe" ) Sleep (5000) Send ( "aaa" ) WinClose( "Microsoft Excel - Book1" ) ;WinClose( "Microsoft Excel" ) If WinExists ( "[Microsoft Excel]" ) Then ;this sould wait for pop up window, for now it's excel save window Sleep (5000) WinClose( "[Microsoft Excel]" ) ; will close Run("C:\Program Files (x86)\Microsoft Office\OFFICE11\EXCEL.exe") ;relaunch program WinWaitActive("EXCEL7", "", 3) ; check if program is set Send( "{ENTER}" ) ; another pop up window to press ok and start work EndIf something is missing, launching program but not detected, windows excel save window. probably something missing with time, any help? Link to comment Share on other sites More sharing options...
aa2zz6 Posted November 24, 2016 Share Posted November 24, 2016 How does Excel relate to the program that your working with at work? If it does relate, then I would look at the excel example of opening excel, inputting data to a cell, saving the document, and closing the program. Link to comment Share on other sites More sharing options...
straikeris03 Posted November 24, 2016 Author Share Posted November 24, 2016 like i said i'm just try to do that this thing would work with anything, i will change category or "CLASS" at work. well tomorrow starts my shift, will try to test at work Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted November 25, 2016 Moderators Share Posted November 25, 2016 Why don't you post what you're actually trying to do. You've been questioned by a Mod once already, and came back with a very lame explanation about working with a crane (I worked on cranes for 10 years, never needed a script to operate them). You are now switching the application you're testing with, accompanied by an equally poor explanation of wanting it to work with "everything". You are being very vague about you want, so please help us help you and explain in detail exactly what application you're working with and what your end goal is. And in case this is unclear for anyone else as it was earlier in this thread, please do not respond further until a Mod says the topic can move forward. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
straikeris03 Posted November 26, 2016 Author Share Posted November 26, 2016 i dont know why i even try asking here, all i get here is suspect and no help, and those who help get in trouble. for now i put flashdrive in another socket and seems it helped but not sure for how long. Link to comment Share on other sites More sharing options...
straikeris03 Posted November 26, 2016 Author Share Posted November 26, 2016 all i want to do is autoit to detect that error window, close it and relaunch program. error window pops up in different times, sometimes 10min and sometimes could last for hours. Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted November 26, 2016 Moderators Share Posted November 26, 2016 (edited) @straikeris03 if you would include some of this information in your initial post instead of purposely being vague about what you're after, perhaps you would get assistance more quickly. Had you mentioned Citect in the first place, things would have been much easier. My first question would be, since it is a .Net application and I know for a fact that the controls are exposed, why are you not using the control commands (ControlClick, etc.) to get rid of the popup? Edit: And now that I look at the picture more closely, it appears your demo period has expired. So why are you trying to dismiss or bypass the popup rather than purchasing the software legitimately? Edited November 26, 2016 by JLogan3o13 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! 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