bobo12345 Posted September 26, 2007 Share Posted September 26, 2007 OK, I am new to AutoIt.Here is my script:AutoItSetOption("WinTitleMatchMode", 1)WinActivate("SlingPlayer","")ControlSend("SlingPlayer", "", "", "!{F4}", 0)exitdoesn'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)EndIfControlSend("SlingPlayer", "", "", "!{F4}", 0)exitthen 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 More sharing options...
herewasplato Posted September 26, 2007 Share Posted September 26, 2007 AutoItSetOption("WinTitleMatchMode", 1) WinActivate("SlingPlayer", "") WinWaitActive("SlingPlayer", "") ControlSend("SlingPlayer", "", "", "!{F4}", 0) Exit [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
bobo12345 Posted September 26, 2007 Author Share Posted September 26, 2007 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 More sharing options...
jvanegmond Posted September 26, 2007 Share Posted September 26, 2007 (edited) 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 thisOpt("WinTitleMatchMode", 4) WinActivate("ClassName=CFrameXXX","") WinSetState("ClassName=CFrameXXX","",@SW_RESTORE)oÝ÷ Øú)²i)b^^éî§Øb±«¢+ÙAɽÍÍ ±½Í ÅÕ½ÐíM±¥¹A±åȹáÅÕ½Ðì¤ Closes the window. Edited September 26, 2007 by Manadar github.com/jvanegmond Link to comment Share on other sites More sharing options...
bobo12345 Posted September 26, 2007 Author Share Posted September 26, 2007 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 More sharing options...
jvanegmond Posted September 26, 2007 Share Posted September 26, 2007 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. github.com/jvanegmond Link to comment Share on other sites More sharing options...
bobo12345 Posted September 26, 2007 Author Share Posted September 26, 2007 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...) Link to comment Share on other sites More sharing options...
bobo12345 Posted September 27, 2007 Author Share Posted September 27, 2007 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 More sharing options...
jvanegmond Posted September 27, 2007 Share Posted September 27, 2007 Haha bobo, very ingenious. I think that all you are trying to do is create a new window, focus it and then close it.. That might be easier using: GUICreate("",10,10) GUISetState() GUIDelete() github.com/jvanegmond Link to comment Share on other sites More sharing options...
bobo12345 Posted September 27, 2007 Author Share Posted September 27, 2007 (edited) Thanks Manadar, that's perfect. CODEAutoItSetOption("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 September 27, 2007 by bobo12345 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