Camosnide Posted May 8, 2012 Share Posted May 8, 2012 Hey guys im like very very new to this i have managed to write something that will find a colour and click it. The problem im having is after i click play it is running the script and repeating the process over and over as it should BUT the clicking isnt actualy commanding as the program i wish it to click on is in the background. As soon as i swap SCAR Divi to the back ground and the program i wish it to work on is selected the script doesn't seem to work it runs but just doesnt happen due to SCAR being in the background....? Quote Link to comment Share on other sites More sharing options...
Neron Posted May 8, 2012 Share Posted May 8, 2012 There is no stupid question, (for newbee) there is just stupid answer. Paste code! Quote Link to comment Share on other sites More sharing options...
Camosnide Posted May 8, 2012 Author Share Posted May 8, 2012 Oh great! That makes me feel alot better. I'm realy enjoying this program and cant wait for my skills to expand. The script is: Program FindColorClickColor; Const Color = 2249071; // color you wish to click Procedure FindClick; Var X,Y,W,H: Integer; begin Wait(3000) GetClientDimensions(W,H); If FindColor(X,Y,Color,18,36,W,H) then Begin MoveWindMouse(X,Y,18,36); ClickMouse(X,Y,True); ClickMouse(X,Y,True); end; end; begin Repeat // Repeats for ever.. or until program is stopped. FindClick; Wait(150); Until False; end. It works apart from the clicks are not actually activating a click inside the client that is targeted because its still in the back ground. Due to SCAR Divi being the my current selected program. Soon as i swap Scar Divi to background and The targeted client becomes my selected program the script doesn't work. Quote Link to comment Share on other sites More sharing options...
LordJashin Posted May 8, 2012 Share Posted May 8, 2012 Oh great! That makes me feel alot better. I'm realy enjoying this program and cant wait for my skills to expand.The script is: Program FindColorClickColor; Const Color = 2249071; // color you wish to click Procedure FindClick; Var X,Y,W,H: Integer; begin Wait(3000) GetClientDimensions(W,H); If FindColor(X,Y,Color,18,36,W,H) then Begin MoveWindMouse(X,Y,18,36); ClickMouse(X,Y,True); ClickMouse(X,Y,True); end; end; begin Repeat // Repeats for ever.. or until program is stopped. FindClick; Wait(150); Until False; end. It works apart from the clicks are not actually activating a click inside the client that is targeted because its still in the back ground. Due to SCAR Divi being the my current selected program. Soon as i swap Scar Divi to background and The targeted client becomes my selected program the script doesn't work. When you Select a client, and play the script that window must be active soon after or Scar needs to bring it into view itself. There is some ways you can go about manipulating the client - which is whatever window you selected. [sCAR] // Select Client with button ActivateClient; // this brings it into view // Or you can select the client with this Code FindWindowTitlePart('Firefox', false); // Then do ActivateClient; // Some other client functions (If you want to know what these do, ask) GetClientDimensions(w, h); GetClientWindowHandle; SetClientWindowHandle; SetOnTop(GetClientWindowHandle, true); [/sCAR] Quote Link to comment Share on other sites More sharing options...
Camosnide Posted May 8, 2012 Author Share Posted May 8, 2012 Ok after reading your post this is now the script; Program FindColorClickColor; Const Color = 2249071; Procedure FindClick; Var X,Y,W,H: Integer; begin FindWindowTitlePart('Camosnides', false); ActivateClient; Wait(3000) GetClientDimensions(W,H); If FindColor(X,Y,Color,18,36,W,H) then Begin MoveWindMouse(X,Y,18,36); ClickMouse(X,Y,True); ClickMouse(X,Y,True); end; end; begin Repeat FindClick; Wait(150); Until False; end. It is selecting the Camosnides Client. But the script then stops to work even though Scar Divi says its still playing. ---------- Post added at 09:00 PM ---------- Previous post was at 08:56 PM ---------- How do i link my script so you can see it clearly like i can yours? would make it easier for you to help me out. Thanks for this by the way. ---------- Post added at 09:08 PM ---------- Previous post was at 09:00 PM ---------- OMG!!!! Hahaha I just looked on your profile and read a post you made about Windows 7 64 bit. Followed what you said and i have now fixed the problem. I am running in Windows 7 64 bit all i needed to do was run as admin... Sorry about that. Quote Link to comment Share on other sites More sharing options...
LordJashin Posted May 9, 2012 Share Posted May 9, 2012 Ok after reading your post this is now the script; Program FindColorClickColor; Const Color = 2249071; Procedure FindClick; Var X,Y,W,H: Integer; begin FindWindowTitlePart('Camosnides', false); ActivateClient; Wait(3000) GetClientDimensions(W,H); If FindColor(X,Y,Color,18,36,W,H) then Begin MoveWindMouse(X,Y,18,36); ClickMouse(X,Y,True); ClickMouse(X,Y,True); end; end; begin Repeat FindClick; Wait(150); Until False; end. It is selecting the Camosnides Client. But the script then stops to work even though Scar Divi says its still playing. ---------- Post added at 09:00 PM ---------- Previous post was at 08:56 PM ---------- How do i link my script so you can see it clearly like i can yours? would make it easier for you to help me out. Thanks for this by the way. ---------- Post added at 09:08 PM ---------- Previous post was at 09:00 PM ---------- OMG!!!! Hahaha I just looked on your profile and read a post you made about Windows 7 64 bit. Followed what you said and i have now fixed the problem. I am running in Windows 7 64 bit all i needed to do was run as admin... Sorry about that. For these forums, if you edit your post, after you posted Scar code in the SCAR bb tags e.g. [...SCAR][/sCAR...] it resets it to that above^. So in order to redo it correctly you have to copy and paste your code again in between the Scar tags. Good job for doing diligence on searching. Welcome to the Scar Divi forums if you are new, look at this, will really help you out - here Quote Link to comment Share on other sites More sharing options...