Jump to content

student


Recommended Posts

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

  • Moderators

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

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 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

 

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

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

 

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

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

Link to comment
Share on other sites

  • Moderators
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.

"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

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

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

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

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

  • Moderators

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

  • Moderators

@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

"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

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...