Jump to content

WinActivate problem (newb alert)


bobo12345
 Share

Recommended Posts

OK, I am new to AutoIt.

Here is my script:

AutoItSetOption("WinTitleMatchMode", 1)

WinActivate("SlingPlayer","")

ControlSend("SlingPlayer", "", "", "!{F4}", 0)

exit

doesn't work. WinActivate brings the Slingpayer window to the front, but its title bar colour indicates that it is not really active.

If I use:

AutoItSetOption("WinTitleMatchMode", 1)

WinActivate("SlingPlayer","")

If WinActive("SlingPlayer") Then

MsgBox(0, "", "Closing Slingplayer...",1)

EndIf

ControlSend("SlingPlayer", "", "", "!{F4}", 0)

exit

then it works fine, I guess because after the MsgBox's "OK" is automatically clicked, the focus is on the SlingPlayer window (I can tell by the colour of its title bar).

Any ideas how I can get this working without having to have the MsgBox? thanks

Link to comment
Share on other sites

This doesn't work either. The SlingPlayer window comes to the front, but because it's not really active, the ALT+F4 isn't being passed to it.

If I click on the SlingPlayer window (after the script has brought it to the front), the title bar color changes, and then it becomes "properly" active.

Anything else I can try?

Link to comment
Share on other sites

If your purpose is to close the window, and thus ending the process you may want to take a look at the ProcessClose functions, saving you a lot of trouble.

Else, make sure that AutoIt recognizes your window properly, maybe use another WInTitleMatchMode.

Edit: I just installed SlingPlayer, and it has some strange behavior..

Doing this

Opt("WinTitleMatchMode", 4)

WinActivate("ClassName=CFrameXXX","")
WinSetState("ClassName=CFrameXXX","",@SW_RESTORE)oÝ÷ Øú)²­i)b^^éî§Øb±«­¢+ÙAɽÍÍ
±½Í ÅÕ½ÐíM±¥¹A±åȹáÅÕ½Ðì¤
Closes the window. Edited by Manadar
Link to comment
Share on other sites

yes, I also noticed that the SlingRemote pops up when using @SW_RESTORE.

I could kill the process to close Slingplayer, but I also need proper focus so I can change channels, volume, etc.

I tried all possible values for WInTitleMatchMode but no luck. The SlingPlayer window pops to the front as the script is run, but unfortunately it doesn't have the focus. The MsgBox thing in my original post does make everything work, except it's a bit of an ugly workaround.

Link to comment
Share on other sites

yes, I also noticed that the SlingRemote pops up when using @SW_RESTORE.

I could kill the process to close Slingplayer, but I also need proper focus so I can change channels, volume, etc.

I tried all possible values for WInTitleMatchMode but no luck. The SlingPlayer window pops to the front as the script is run, but unfortunately it doesn't have the focus. The MsgBox thing in my original post does make everything work, except it's a bit of an ugly workaround.

I am guessing this window doesn't want to be automated, or the developers haven't thought about people automizing this..

I just installed it again, finding no suitable solution, but perhaps you could look again if you can set some hotkeys and use AutoIt's Send function to control the program. Otherwise, I think you will have to do with MouseClick's.

Link to comment
Share on other sites

MsgBox(0, "", "Closing Slingplayer...",1)

Is there anyway I can get the MsgBox to disappear quicker? (don't want to wait one second when doing stuff like sending keystrokes to change channels...)

Is there a way I can automatically send "enter" to the msgbox which is generated by AutoIT? I would like the msgbox to close instantly.

Link to comment
Share on other sites

Thanks Manadar, that's perfect.

CODE
AutoItSetOption("WinTitleMatchMode", 1)

WinActivate("SlingPlayer","")

If WinActive("SlingPlayer") Then

GUICreate("",10,10)

GUISetState()

GUIDelete()

EndIf

ControlSend("SlingPlayer", "", "", "!{F4}", 0)

exit

The code above makes the Slingplayer window focused, and I can pass ALT+F4, change channels, etc. to it. Thank you :)

Edited by bobo12345
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...