ArmandoXS 0 Posted May 11, 2010 expandcollapse popup$i=0 ;Main Loop varible $l=0 ;Secondary Loop varible While $i=0 $T=Random(0,30,1) ProcessExists("PWO.exe") If @error Then MouseClick("left",30,608,2,1) Sleep(15000) MouseClick("left",427,562,1,3) SLeep(30000) MouseClick("left",451,404,3,2) Sleep(100) MouseClick("left",155,679,1,2) EndIf Sleep(5000) MouseClick("left",171,445,1,1) Do $l=$l+1 MouseClick("left",171,445,1,1) MouseClick("left",171,445,1,1) MouseClick("left",171,445,1,1) PixelSearch(460,175,460,175,0x132F34) If Not @error Then Sleep(3000) MouseClick("left",212,559,1,3) Sleep(500) MouseClick("left",166,495,2,2) Sleep(13000) EndIf Select Case $T=0 Sleep(10000) Case $T=1 Sleep(10100) Case $T=2 Sleep(10200) Case $T=3 Sleep(10300) Case $T=4 Sleep(10400) Case $T=5 Sleep(10500) Case $T=6 Sleep(10600) Case $T=7 Sleep(10700) Case $T=8 Sleep(10800) Case $T=9 Sleep(10900) Case $T=10 Sleep(11000) Case $T=11 Sleep(11100) Case $T=12 Sleep(11200) Case $T=13 Sleep(11300) Case $T=14 Sleep(11400) Case $T=15 Sleep(11500) Case $T=16 Sleep(11600) Case $T=17 Sleep(11700) Case $T=18 Sleep(11800) Case $T=19 Sleep(11900) Case $T=20 Sleep(12000) Case $T=21 Sleep(12100) Case $T=22 Sleep(12200) Case $T=23 Sleep(12300) Case $T=24 Sleep(12400) Case $T=25 Sleep(12500) Case $T=26 Sleep(12600) Case $T=27 Sleep(12700) Case $T=28 Sleep(12800) Case $T=29 Sleep(12900) Case $T=30 Sleep(13000) EndSelect Until $l=6 $l=0 WEndWell this is the problem; In my program the mouseclicks or preferly the first one, is some how cut short or isnt on target to the coordinates I provided in the command... But here it comes the wierd part; i made a new file and copied the exact mouseclick command that wasnt hitting the right spot and when i tried it then it worked perfectly!?!?!? Is there some command I stated to make it do this or something? HELP! Share this post Link to post Share on other sites
PsaltyDS 39 Posted May 11, 2010 You might explicitly set/experiment with your MouseCoordMode option, and PixelCoordMode, if that's how you determined what the value should be. Also, that Select/Case is just silly. How about just this instead: Sleep(10000 + ($T * 100)) Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Share this post Link to post Share on other sites
ArmandoXS 0 Posted May 11, 2010 You might explicitly set/experiment with your MouseCoordMode option, and PixelCoordMode, if that's how you determined what the value should be. Also, that Select/Case is just silly. How about just this instead: Sleep(10000 + ($T * 100)) lol well its a little to late for that but i will add it in.. but you are saying to loose the mouseclick options? Share this post Link to post Share on other sites
Tvern 11 Posted May 11, 2010 I can't explain why running the same file from different locations would cause different behavior, but I couldn't resist suggesting some changes to your script. While 1 ;unless this is part of a bigger script this will cause the same infinite loop (!) as your original constructions. If ProcessExists("PWO.exe") <> 0 Then ;runs if the process does not exist. Checed for return code as it does not set @error ;perhaps add a winactivate, winwaitactive, etc here. MouseClick("left",30,608,2,1) Sleep(15000) MouseClick("left",427,562,1,3) SLeep(30000) MouseClick("left",451,404,3,2) Sleep(100) MouseClick("left",155,679,1,2) EndIf Sleep(5000) ;perhaps add a winactivate, winwaitactive, etc here. MouseClick("left",171,445,1,1) For $l = 1 To 6 ;replaced Do...Until with this construction ;perhaps add a winactivate, winwaitactive, etc here. MouseClick("left",171,445,1,1) MouseClick("left",171,445,1,1) MouseClick("left",171,445,1,1) PixelSearch(460,175,460,175,0x132F34) If Not @error Then Sleep(3000) MouseClick("left",212,559,1,3) Sleep(500) MouseClick("left",166,495,2,2) Sleep(13000) EndIf Sleep(Random(100,130,1)*100) ;this replaced the enire swich statement Next WEnd Hope it helps Share this post Link to post Share on other sites
ArmandoXS 0 Posted May 11, 2010 I can't explain why running the same file from different locations would cause different behavior, but I couldn't resist suggesting some changes to your script. While 1 ;unless this is part of a bigger script this will cause the same infinite loop (!) as your original constructions. If ProcessExists("PWO.exe") <> 0 Then ;runs if the process does not exist. Checed for return code as it does not set @error ;perhaps add a winactivate, winwaitactive, etc here. MouseClick("left",30,608,2,1) Sleep(15000) MouseClick("left",427,562,1,3) SLeep(30000) MouseClick("left",451,404,3,2) Sleep(100) MouseClick("left",155,679,1,2) EndIf Sleep(5000) ;perhaps add a winactivate, winwaitactive, etc here. MouseClick("left",171,445,1,1) For $l = 1 To 6 ;replaced Do...Until with this construction ;perhaps add a winactivate, winwaitactive, etc here. MouseClick("left",171,445,1,1) MouseClick("left",171,445,1,1) MouseClick("left",171,445,1,1) PixelSearch(460,175,460,175,0x132F34) If Not @error Then Sleep(3000) MouseClick("left",212,559,1,3) Sleep(500) MouseClick("left",166,495,2,2) Sleep(13000) EndIf Sleep(Random(100,130,1)*100) ;this replaced the enire swich statement Next WEnd Hope it helps thanks for the script i tried it but with my luck i had the same problem the mouse clicked about 2" from where it should of... Ive even double checked and triple checked the cords. at which i set them it should of worked Share this post Link to post Share on other sites
ArmandoXS 0 Posted May 11, 2010 (edited) FIXED!!! I found out what was the problem its a wierd fix and i dont understand fully why it didnt work but here is how i fixed it.. the orginal code.. While $i=0 $T=Random(0,30,1) ProcessExists("PWO.exe") If @error Then MouseClick("left",30,608,2,1) Sleep(15000) MouseClick("left",427,562,1,3) SLeep(30000) MouseClick("left",451,404,3,2) Sleep(100) MouseClick("left",155,679,1,2) Needs to be changed to $Processchk=ProcessExists("PWO.exe") If $Processchk=0 Then MouseClick("left",30,608,2,1) Sleep(15000) MouseClick("left",427,562,1,3) SLeep(30000) MouseClick("left",451,404,3,2) Sleep(100) MouseClick("left",155,679,1,2) Making ProcessExists a varible and then checking if there was an error by checking if a 0 was returned Edited May 11, 2010 by DarkDragon Share this post Link to post Share on other sites
Tvern 11 Posted May 12, 2010 That's actually what this line did in the adjusted script:If ProcessExists("PWO.exe") <> 0 Then or even shorter:If ProcessExists("PWO.exe") ThenIf you look at the helpfile for ProcessExists you'll see that it doesn't set @error, so checking it will never work.There are other funtions that don't set @error, so it's always best to check the return values in the helpfile if you're unsure. Share this post Link to post Share on other sites