Jump to content
Sign in to follow this  
sir

My autoit script not work in some computer

Recommended Posts

sir

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?

Share this post


Link to post
Share on other sites
ryoken

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?

Share this post


Link to post
Share on other sites
sir

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.

Share this post


Link to post
Share on other sites
PsaltyDS

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

Share this post


Link to post
Share on other sites
sir

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

Share this post


Link to post
Share on other sites
ventsyv

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

I'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.

Share this post


Link to post
Share on other sites
Jos

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

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..

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
sir

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.

Share this post


Link to post
Share on other sites
PsaltyDS

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

Share this post


Link to post
Share on other sites
sir

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?

Share this post


Link to post
Share on other sites
sir

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 ^/\^

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×