sir Posted July 4, 2009 Share Posted July 4, 2009 Actually i faced with this problem before but just ignore it, now i face with it again. i have writen many autoitscript, and i use it many place but in some computer it not work. the following is simple example script: Opt("WinTitleMatchMode", 2) HotKeySet("^{F12}", "Terminate") $i=0 ToolTIp('ControlClick(" Windows", "", "[CLASS:MozillaWindowClass; INSTANCE:6]") [Stop by Ctrl+{F12}]',0,50) While 1 If WinExists(" Windows") Then ControlClick(" My Brute", "", "[CLASS:MozillaWindowClass; INSTANCE:6]") $i+=1 ToolTIp('ControlClick(" Windows", "", "[CLASS:MozillaWindowClass; INSTANCE:6]") [Stop by Ctrl+{F12}] [no of click='&$i&']',0,50) ;[CLASS:MozillaWindowClass; INSTANCE:6] ;Sleep(5000) Sleep(10000) EndIf sleep(1000) WEnd Func Terminate() ToolTip("") Exit 0 EndFunc This script seem to work it this PC too but actually nothing is done. Could anyone tell what is the possible cause? Link to comment Share on other sites More sharing options...
ryoken Posted July 4, 2009 Share Posted July 4, 2009 It might be because of the OS your running it on. Some of my scripts don't work on Vistas because it tries to open a program without permission. What OS are you trying to run it on? Link to comment Share on other sites More sharing options...
sir Posted July 4, 2009 Author Share Posted July 4, 2009 It might be because of the OS your running it on.Some of my scripts don't work on Vistas because it tries to open a program without permission.What OS are you trying to run it on?I run it in XP only. Link to comment Share on other sites More sharing options...
PsaltyDS Posted July 4, 2009 Share Posted July 4, 2009 Actually i faced with this problem before but just ignore it, now i face with it again. i have writen many autoitscript, and i use it many place but in some computer it not work. the following is simple example script: Opt("WinTitleMatchMode", 2) HotKeySet("^{F12}", "Terminate") $i=0 ToolTIp('ControlClick(" Windows", "", "[CLASS:MozillaWindowClass; INSTANCE:6]") [Stop by Ctrl+{F12}]',0,50) While 1 If WinExists(" Windows") Then ControlClick(" My Brute", "", "[CLASS:MozillaWindowClass; INSTANCE:6]") $i+=1 ToolTIp('ControlClick(" Windows", "", "[CLASS:MozillaWindowClass; INSTANCE:6]") [Stop by Ctrl+{F12}] [no of click='&$i&']',0,50) ;[CLASS:MozillaWindowClass; INSTANCE:6] ;Sleep(5000) Sleep(10000) EndIf sleep(1000) WEnd Func Terminate() ToolTip("") Exit 0 EndFunc This script seem to work it this PC too but actually nothing is done. Could anyone tell what is the possible cause? What creates the "Windows" window? If it's an instance of FireFox, are you sure the control at INSTANCE:6 is the same one every time? You might check with something like this: $sWin = "[CLASS:MozillaUIWindowClass]" $hWin = WinGetHandle($sWin, "") ConsoleWrite("$sWin = " & $sWin & ", $hWin = " & $hWin & @LF) $i = 1 While 1 $hCont = ControlGetHandle($hWin, "", "[CLASS:MozillaWindowClass; INSTANCE:" & $i & "]") If @error Then ExitLoop $avPos = ControlGetPos($hWin, "", $hCont) ConsoleWrite("INSTANCE:" & $i & ", $hCont = " & $hCont & _ "X = " & $avPos[0] & ", Y = " & $avPos[1] & @LF) $i += 1 WEnd 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 Link to comment Share on other sites More sharing options...
sir Posted July 4, 2009 Author Share Posted July 4, 2009 What creates the "Windows" window? If it's an instance of FireFox, are you sure the control at INSTANCE:6 is the same one every time? You might check with something like this: $sWin = "[CLASS:MozillaUIWindowClass]" $hWin = WinGetHandle($sWin, "") ConsoleWrite("$sWin = " & $sWin & ", $hWin = " & $hWin & @LF) $i = 1 While 1 $hCont = ControlGetHandle($hWin, "", "[CLASS:MozillaWindowClass; INSTANCE:" & $i & "]") If @error Then ExitLoop $avPos = ControlGetPos($hWin, "", $hCont) ConsoleWrite("INSTANCE:" & $i & ", $hCont = " & $hCont & _ "X = " & $avPos[0] & ", Y = " & $avPos[1] & @LF) $i += 1 WEnd Actually this code ( and other) is work well in all computers except one of my laptop. I just show this code to tell that it is simple. for this code the counter $i is increment (that means the control is click), but in fact nothing is click thank you Link to comment Share on other sites More sharing options...
ventsyv Posted July 4, 2009 Share Posted July 4, 2009 Actually this code ( and other) is work well in all computers except one of my laptop.I just show this code to tell that it is simple.for this code the counter $i is increment (that means the control is click), but in fact nothing is click thank youI've noticed that too. I have a script that runs on my laptop, but when I put it on my desktop it "freezes" half way through the script. I clicked the button that wasn't getting clicked and the script picked up and kept on running fine from that point on. It is not a big deal, but I thought I just through it out there. Link to comment Share on other sites More sharing options...
Developers Jos Posted July 4, 2009 Developers Share Posted July 4, 2009 (edited) Actually this code ( and other) is work well in all computers except one of my laptop.I just show this code to tell that it is simple.for this code the counter $i is increment (that means the control is click), but in fact nothing is click thank youYou did check this laptop what the EXACT Window and Control information is for the control you want to click?I only see you stating it doesn't work, but not what you have tried to debug it.. Edited July 4, 2009 by Jos SciTE4AutoIt3 Full installer Download page  - Beta files    Read before posting   How to post scriptsource   Forum etiquette Forum Rules  Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
sir Posted July 5, 2009 Author Share Posted July 5, 2009 You did check this laptop what the EXACT Window and Control information is for the control you want to click?I only see you stating it doesn't work, but not what you have tried to debug it..Sorry my english is not good.OK, "does not work in my laptop" means the script show that it have click the button (becoz the counter is incremented) but in fact nothing is click.i also face the problem with other scripts, but those scripts are very long so i show only this simple script.thank you. Link to comment Share on other sites More sharing options...
PsaltyDS Posted July 5, 2009 Share Posted July 5, 2009 Sorry my english is not good. OK, "does not work in my laptop" means the script show that it have click the button (becoz the counter is incremented) but in fact nothing is click. i also face the problem with other scripts, but those scripts are very long so i show only this simple script. thank you. You've ignored the responses you already got. Exactly how did you determine that the control IDs (i.e. "[CLASS:MozillaWindowClass; INSTANCE:6]") didn't change in the failing environment? Something like an extra toolbar or add-on may have changed it. 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 Link to comment Share on other sites More sharing options...
sir Posted July 6, 2009 Author Share Posted July 6, 2009 You've ignored the responses you already got. Exactly how did you determine that the control IDs (i.e. "[CLASS:MozillaWindowClass; INSTANCE:6]") didn't change in the failing environment? Something like an extra toolbar or add-on may have changed it. thank you very much now i m with the computer that used to work. Now it not work here too. I dont know why: i change the code to Opt("WinTitleMatchMode", 2) HotKeySet("{Esc}", "Terminate") $i=0 $loop=0 ToolTIp('ControlClick(" My Brute", "", "[CLASS:MozillaWindowClass; INSTANCE:6]") [Stop by Ctrl+{F12}] # of click='&$i&'/'&$loop,0,50) While 1 $loop+=1 If WinExists(" My Brute") Then $clicked=ControlClick("My Brute", "", "[CLASS:MozillaWindowClass; INSTANCE:6]") $i+=1 Sleep(5000) EndIf EndIf ToolTIp('ControlClick("My Brute", "", "[CLASS:MozillaWindowClass; INSTANCE:6]") [Stop by Ctrl+{F12}] # of click='&$i&'/'&$loop,0,50) sleep(1000) WEnd Func Terminate() ToolTip("") Exit 0 EndFunc Now the $clicked=ControlClick() always return 0. I have checke the control instance with "autoit windows info", it still show something like this: >>>> Window <<<< Title: ballkun My Brute - Mozilla Firefox Class: MozillaUIWindowClass Position: -4, -4 Size: 1288, 968 Style: 0x15CF0000 ExStyle: 0x00000100 Handle: 0x005718A0 >>>> Control <<<< Class: MozillaWindowClass Instance: 6 ClassnameNN: MozillaWindowClass6 Advanced (Class): [CLASS:MozillaWindowClass; INSTANCE:6] ID: Text: Position: 537, 452 what is the problem now? Link to comment Share on other sites More sharing options...
sir Posted July 6, 2009 Author Share Posted July 6, 2009 thank you very much now i m with the computer that used to work. Now it not work here too. I dont know why: i change the code to Opt("WinTitleMatchMode", 2) HotKeySet("{Esc}", "Terminate") $i=0 $loop=0 ToolTIp('ControlClick(" My Brute", "", "[CLASS:MozillaWindowClass; INSTANCE:6]") [Stop by Ctrl+{F12}] # of click='&$i&'/'&$loop,0,50) While 1 $loop+=1 If WinExists(" My Brute") Then $clicked=ControlClick("My Brute", "", "[CLASS:MozillaWindowClass; INSTANCE:6]") $i+=1 Sleep(5000) EndIf EndIf ToolTIp('ControlClick("My Brute", "", "[CLASS:MozillaWindowClass; INSTANCE:6]") [Stop by Ctrl+{F12}] # of click='&$i&'/'&$loop,0,50) sleep(1000) WEnd Func Terminate() ToolTip("") Exit 0 EndFunc Now the $clicked=ControlClick() always return 0. I have checke the control instance with "autoit windows info", it still show something like this: >>>> Window <<<< Title: ballkun My Brute - Mozilla Firefox Class: MozillaUIWindowClass Position: -4, -4 Size: 1288, 968 Style: 0x15CF0000 ExStyle: 0x00000100 Handle: 0x005718A0 >>>> Control <<<< Class: MozillaWindowClass Instance: 6 ClassnameNN: MozillaWindowClass6 Advanced (Class): [CLASS:MozillaWindowClass; INSTANCE:6] ID: Text: Position: 537, 452 what is the problem now? Now it work again! I think it is becoz of firefox tab. Thank you everyone! However, i will post the new topic about "My autoit script not work in some computer" but different script. Please help me again ^/\^ 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