Jump to content
Sign in to follow this  
cotax

opening program, window is not selected / highlighted

Recommended Posts

cotax

Hi,

i got a little problem, ive made a script to instal and configure fraps.

now everyting runs fine, but the problem is:

when it opens c:\fraps\fraps.exe

the programs starts, but the window is not selected so the script will not execute.

When i press anywhere in/on the program the script wil take over and do what it need to do.

how can i get it that when it starts fraps the window is selected / Highlighted so the script will run directly without pressing the window first?

Edited by cotax

Share this post


Link to post
Share on other sites
Melba23

cotax,

Look at WinActivate and WinWaitActive in the Help file. These commands will let you activate the window (as if you clicked on it) and then pause the script until the window is actually active. :idea:

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
cotax

this is what i use, it works great, but the only thing is i need to click te window before it starts

offcourse i can at a mouseclick in it, but it needs to do it on it self.

any idea's?

Run("C:\Fraps\fraps.exe")

WinActivate("FRAPS general")
WinWaitActive("FRAPS general", "")
ControlClick("FRAPS general", "", "[CLASS:Button; INSTANCE:3]")
ControlClick("FRAPS general", "", "[CLASS:Button; INSTANCE:4]")
ControlClick("FRAPS general", "", "[CLASS:Button; INSTANCE:5]")
ControlClick("FRAPS general", "", "[CLASS:Button; INSTANCE:8]")


WinActivate("FRAPS fps")
WinWaitActive("FRAPS fps")
ControlClick("FRAPS fps", "", "[CLASS:Button; INSTANCE:8]")
ControlClick("FRAPS fps", "", "[CLASS:Button; INSTANCE:14]")

WinActivate("FRAPS movies")
WinWaitActive("FRAPS movies")
ControlClick("FRAPS movies", "", "[CLASS:Button; INSTANCE:12]")
ControlClick("FRAPS movies", "", "[CLASS:Button; INSTANCE:13]")


WinActivate("FRAPS screenshots")
WinWaitActive("FRAPS screenshots")
ControlClick("FRAPS screenshots", "", "[CLASS:Button; INSTANCE:8]")

WinSetState("FRAPS general", "", "@SW_MINIMIZE")

Share this post


Link to post
Share on other sites
cotax

//Edit adding a mouse click wont work, becouse when fraps is opened it selects an other window (whats running on background)

so it just selects a window but fraps itself wont stay active, thats wy i need to manually click the window.

i really want this resolved, so if anyone can help me out with this, it would be verry nice. :idea:

Share this post


Link to post
Share on other sites
MHz

You are using Control*() functions so you may not need to try and activate the windows.

Give this a try:

Run("C:\Fraps\fraps.exe")

WinWait("FRAPS general")
ControlClick("FRAPS general", "", "Button3")
ControlClick("FRAPS general", "", "Button4")
ControlClick("FRAPS general", "", "Button5")
ControlClick("FRAPS general", "", "Button8")

WinWait("FRAPS fps")
ControlClick("FRAPS fps", "", "Button8")
ControlClick("FRAPS fps", "", "Button14")

WinWait("FRAPS movies")
ControlClick("FRAPS movies", "", "Button12")
ControlClick("FRAPS movies", "", "Button13")

WinWait("FRAPS screenshots")
ControlClick("FRAPS screenshots", "", "Button8")

WinSetState("FRAPS general", "", "@SW_MINIMIZE")

FYI, your previous script would possibly need WinWait() as well just before using WinActivate() normally except for an inactive FRAPS as you mention.

Share this post


Link to post
Share on other sites
cotax

@ MHz

Thanks alot this works verry well :idea:

I dont get it why my script doesnt work at the start.

and u use

WinWait("FRAPS fps")
ControlClick("FRAPS fps", "", "Button8")
ControlClick("FRAPS fps", "", "Button14")

to go to next window but how does it works? normally u need to activate the window right?

WinActivate("FRAPS fps")

but how does it know that it needs to go to the "FRAPS fps" tab? becouse at this point u only say winwait.

or it doesnt care becouse i said control click on that page?

again thanks alot, ur script works great. u dont need too but if u can explain it to me, it would be verry usefull.

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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.