straikeris03

student

25 posts in this topic

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?

Share this post


Link to post
Share on other sites



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._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

Share this post


Link to post
Share on other sites

i'm working with crane, like i said this is only for test, i will redo all at work.

 

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

 

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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 :D 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

Share this post


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

1 person likes this

When you're dead, you don't know you're dead - it's only difficult for those that know you. It's the same way when you're stupid...

My Scripts: SCCM UDFInclude Source with Compiled Script, Windows Firewall UDF

Share this post


Link to post
Share on other sites

do i need to install Autoit in office computer, or script can work without it?

 

Share this post


Link to post
Share on other sites

#10 ·  Posted

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

 

Share this post


Link to post
Share on other sites

#11 ·  Posted

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.

Share this post


Link to post
Share on other sites

#12 ·  Posted

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.

 

 

 

Share this post


Link to post
Share on other sites

#13 ·  Posted

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

 

Share this post


Link to post
Share on other sites

#14 ·  Posted

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?

Share this post


Link to post
Share on other sites

#15 ·  Posted

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.

Share this post


Link to post
Share on other sites

#16 ·  Posted

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

Share this post


Link to post
Share on other sites

#17 ·  Posted

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.

 


When you're dead, you don't know you're dead - it's only difficult for those that know you. It's the same way when you're stupid...

My Scripts: SCCM UDFInclude Source with Compiled Script, Windows Firewall UDF

Share this post


Link to post
Share on other sites

#18 ·  Posted

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.

20161125_193255.jpg

Share this post


Link to post
Share on other sites

#19 ·  Posted

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.

Share this post


Link to post
Share on other sites

#20 ·  Posted (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 by JLogan3o13

When you're dead, you don't know you're dead - it's only difficult for those that know you. It's the same way when you're stupid...

My Scripts: SCCM UDFInclude Source with Compiled Script, Windows Firewall UDF

Share this post


Link to post
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