Smurfin Posted December 23, 2008 Share Posted December 23, 2008 Hi, can anyone please help, I play online games using multi client, one has Priest job for healing and giving buffs, the other is main char window. I want to be able to control the priest while I'm active to my main char window, so I made a script to send mouse click to my priest window, I use ControlClick() code in the script, but sometimes it won't execute that code and I have to go to Priest window once then go back to my main to make it work. I can make it always work though by adding ControlFocus before controlclick, but if I did that, the Priest window then starting to take up cpu resources because by sending controlfocus to it, it becomes 'active' also. Is there any way to "Release Focus" ? if there is any, how can I do that ? below is a partial code I copy paste from the script func followme() Global $PIDF = WinGetProcess($iniCommandFollowToThisWindow) Global $PROCESS_INFO_F = _MemoryOpen($PIDF) $iniCharIDtobeFollowed = IniRead("SmurfIT.ini","Settings","Char ID to be Followed","") $iniCommandFollowToThisWindow = IniRead("SmurfIT.ini","Settings","CommandFollow_to_this_window","") if winexists($iniCommandFollowToThisWindow) then _MemoryPointerWrite($APP_BASE_ADDRESS, $PROCESS_INFO_F, $OFFSET_TARGET_TO_FOLLOW,dec($iniCharIDtobeFollowed)) $WinSize=WinGetClientSize($iniCommandFollowToThisWindow) If $WinSize[0]<=820 then $XwinModifier=20 If $WinSize[0]>820 then $XwinModifier=50 If $WinSize[0]>=1280 then $XwinModifier=70 If $WinSize[0]>1750 then $XwinModifier=90 If $WinSize[0]>2000 then $XwinModifier=120 ;msgbox(1,"tes",$XWinModifier) $XWin=($WinSize[0]/2)-$XwinModifier $YWin=50 ;WinActive($iniCommandFollowToThisWindow) ;<- I also tried this method but still randomly not accepting the controlclick code below ;controlgetfocus($iniCommandFollowToThisWindow);<- I also tried this method but still randomly not accepting the controlclick code below ;controlfocus($iniCommandFollowToThisWindow,"","") <- This one ALWAYS accepts controlclick ;controlgethandle($iniCommandFollowToThisWindow,"","") <- This one also ALWAYS accepts controlclick controlclick($iniCommandFollowToThisWindow,"","","right",1,$XWin,$YWin) controlclick($iniCommandFollowToThisWindow,"","","left",1,$Xwin+12,$YWin+10) ;ControlEnable ($iniCommandFollowToThisWindow,"","") _MemoryClose($PIDF) endif endfunc as you can see above, if I use ControlFocus or ControlGetHandle, it works as I expected, but that will make the window running and take up cpu resources and ingame framerate suffers badly. without adding anything sometimes it works and sometimes it not, if that happened, I need to switch once and go back to my main and it works again, but it's kinda defeat the purpose of having it remotely controlled while I active on my main. Can anyone please help how to release Focus/handle after I execute controlclick ? thanks in advance. Link to comment Share on other sites More sharing options...
ChangMinYang Posted December 23, 2008 Share Posted December 23, 2008 (edited) Hi, can anyone please help, I play online games using multi client, one has Priest job for healing and giving buffs, the other is main char window. I want to be able to control the priest while I'm active to my main char window, so I made a script to send mouse click to my priest window, I use ControlClick() code in the script, but sometimes it won't execute that code and I have to go to Priest window once then go back to my main to make it work. I can make it always work though by adding ControlFocus before controlclick, but if I did that, the Priest window then starting to take up cpu resources because by sending controlfocus to it, it becomes 'active' also. Is there any way to "Release Focus" ? if there is any, how can I do that ? below is a partial code I copy paste from the script func followme() Global $PIDF = WinGetProcess($iniCommandFollowToThisWindow) Global $PROCESS_INFO_F = _MemoryOpen($PIDF) $iniCharIDtobeFollowed = IniRead("SmurfIT.ini","Settings","Char ID to be Followed","") $iniCommandFollowToThisWindow = IniRead("SmurfIT.ini","Settings","CommandFollow_to_this_window","") if winexists($iniCommandFollowToThisWindow) then _MemoryPointerWrite($APP_BASE_ADDRESS, $PROCESS_INFO_F, $OFFSET_TARGET_TO_FOLLOW,dec($iniCharIDtobeFollowed)) $WinSize=WinGetClientSize($iniCommandFollowToThisWindow) If $WinSize[0]<=820 then $XwinModifier=20 If $WinSize[0]>820 then $XwinModifier=50 If $WinSize[0]>=1280 then $XwinModifier=70 If $WinSize[0]>1750 then $XwinModifier=90 If $WinSize[0]>2000 then $XwinModifier=120 ;msgbox(1,"tes",$XWinModifier) $XWin=($WinSize[0]/2)-$XwinModifier $YWin=50 ;WinActive($iniCommandFollowToThisWindow);<- I also tried this method but still randomly not accepting the controlclick code below ;controlgetfocus($iniCommandFollowToThisWindow);<- I also tried this method but still randomly not accepting the controlclick code below ;controlfocus($iniCommandFollowToThisWindow,"","") <- This one ALWAYS accepts controlclick ;controlgethandle($iniCommandFollowToThisWindow,"","") <- This one also ALWAYS accepts controlclick controlclick($iniCommandFollowToThisWindow,"","","right",1,$XWin,$YWin) controlclick($iniCommandFollowToThisWindow,"","","left",1,$Xwin+12,$YWin+10) ;ControlEnable ($iniCommandFollowToThisWindow,"","") _MemoryClose($PIDF) endif endfunc as you can see above, if I use ControlFocus or ControlGetHandle, it works as I expected, but that will make the window running and take up cpu resources and ingame framerate suffers badly. without adding anything sometimes it works and sometimes it not, if that happened, I need to switch once and go back to my main and it works again, but it's kinda defeat the purpose of having it remotely controlled while I active on my main. Can anyone please help how to release Focus/handle after I execute controlclick ? thanks in advance. ControlDisable Disables or "grays-out" a control. ControlDisable ( "title", "text", controlID) Parameters titleThe title of the window to access.textThe text of the window to access.controlIDThe control to interact with. See Controls. Return Value Success:Returns 1.Failure:Returns 0. Remarks None. Edited December 23, 2008 by GoodMan Link to comment Share on other sites More sharing options...
Smurfin Posted December 23, 2008 Author Share Posted December 23, 2008 I have tried that also, but that disable mouse control over the affected window. It's not about the control I think but more to the Focus given to the window. Link to comment Share on other sites More sharing options...
torels Posted December 23, 2008 Share Posted December 23, 2008 set the focus on another window Some Projects:[list][*]ZIP UDF using no external files[*]iPod Music Transfer [*]iTunes UDF - fully integrate iTunes with au3[*]iTunes info (taskbar player hover)[*]Instant Run - run scripts without saving them before :)[*]Get Tube - YouTube Downloader[*]Lyric Finder 2 - Find Lyrics to any of your song[*]DeskBox - A Desktop Extension Tool[/list]indifference will ruin the world, but in the end... WHO CARES :P---------------http://torels.altervista.org Link to comment Share on other sites More sharing options...
Smurfin Posted December 23, 2008 Author Share Posted December 23, 2008 already did that, in fact I played four char ID, and four of them gained focus, and that eats lots of resources and the one window I active on suffer performance/framerate hit badly. 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