Sign in to follow this  
Followers 0
happy2help

Converted v2.64 script to v3 and it wont work - HELP

6 posts in this topic

Hi All

I hope you can help me. I used to belong to the v2.64 gang and done loads of scripting with it. Now I'm using Vista, AutoIt2 is not compatible so i need to learn the new language!

I start by unpacking the RARs and press pause. Then the script allows 1 to unpack, waits till it has finished and unpacked the next until completed.

Here is my v2.64 script (basic, but done the job)

WinWait, Extracting, ,

sleep, 5000

next:

IfWinActive, Paused, , Send, c

ch:

Sleep, 5000

WinWaitClose, Extracting, ,

Sleep, 1000

IfWinExist , Testing, , goto, ch

IfWinNotExist , Paused, , sleep, 62000

WinActivate, Paused, ,

goto, next

This worked fine, but when i converted it i got a lot of errors.

This is my v3.2.12.1 version so far. Yes i know it doesn't work!!

while (1)

    WinWait ( 'Extracting' )

    Sleep ( 5000 )

    while (1)

        if WinActive ( 'Paused' ) then
        
        Send ( 'c' )
        
        endif

        while (1)

            Sleep ( 5000 )

            WinWaitClose ( 'Extracting' )

            Sleep ( 1000 )

                if WinExists ( 'Testing' ) then

                wend
            
                EndIf

                if NOT WinExists ( 'Paused' ) then
        
                sleep (62000)
        
                endif

            WinActivate ( 'Paused' )

        wend
        
    wend
        
wend

I'm sorry, but i can't get my head round the lack of goto command and how to replace that command.

Please help!

Share this post


Link to post
Share on other sites



First there are no goto commands but there are functions.

Since I'm not 100% certain what you are trying to attempt step by step, here's an example of your script with comments.. If you provide me a step by step routine, I can show you how to make it work.

While (1)
    Sleep(0100)
    myFunction()
    mySecondFunction()
WEnd

Func myFunction()
    WinWait('Extracting')
    If WinActive('Paused') Then
        Send('c')
    EndIf
    WinWaitClose('Extracting')
EndFunc   ;==>myFunction

Func mySecondFunction()
    If WinExists('Testing') Then
        ; EMPTY (What are you wanting to do here?)
    EndIf
    If Not WinExists('Paused') Then
        Sleep(62000)
    EndIf
    WinActivate('Paused')
EndFunc   ;==>mySecondFunction

My Projects: [topic="89413"]GoogleHack Search[/topic], [topic="67095"]Swiss File Knife GUI[/topic], [topic="69072"]Mouse Location Pointer[/topic], [topic="86040"]Standard Deviation Calculator[/topic]

Share this post


Link to post
Share on other sites

You are trapped in your loops. Each of those nested loops needs a way to get out of the loop. Like, for example:

If WinWaitClose('Extracting') Then ExitLoop

:)


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

WinWait, Extracting, , ; waits until the first file has started to unpack

sleep, 5000

next:

IfWinActive, Paused, , Send, c ; if first file has finished and gone, then there is only windows with "paused" left, then select continue

ch:

Sleep, 5000

WinWaitClose, Extracting, , ; if not, this waits till its finished

Sleep, 1000

IfWinExist , Testing, , goto, ch ; if a "testing" window comes up, then go back to CH and try again

IfWinNotExist , Paused, , sleep, 62000 ; if there is no more "paused" windows, then sleep for a long while

WinActivate, Paused, , ; activate the next "paused" and go back to NEXT

goto, next

Share this post


Link to post
Share on other sites

WinWait, Extracting, , ; waits until the first file has started to unpack

sleep, 5000

next:

IfWinActive, Paused, , Send, c ; if first file has finished and gone, then there is only windows with "paused" left, then select continue

ch:

Sleep, 5000

WinWaitClose, Extracting, , ; if not, this waits till its finished

Sleep, 1000

IfWinExist , Testing, , goto, ch ; if a "testing" window comes up, then go back to CH and try again

IfWinNotExist , Paused, , sleep, 62000 ; if there is no more "paused" windows, then sleep for a long while

WinActivate, Paused, , ; activate the next "paused" and go back to NEXT

goto, next

Umm... the problem is not that the script is too complicated to understand. :)

Lets take it one step at a time, since you do want to learn the current version of AutoIt, right?

"IfWinActive, Paused, , Send, c" would now be more like this:

If WinActive("Paused") Then Send("c")

Check it out in the help file and try out the example scripts there.

:)


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

Tried compiling this script and it seams to be working

WinWait('Extracting')
While (1)
    Sleep(0100)
    myFunction()
    mySecondFunction()
WEnd

Func myFunction()
    If WinActive('Paused') Then
        Send('c')
    EndIf
    Sleep(5000)
    WinWaitClose('Extracting')
EndFunc  ;==>myFunction

Func mySecondFunction()
    If WinExists('Testing') Then
        Sleep(5000); EMPTY (What are you wanting to do here?)
    EndIf
    If Not WinExists('Paused') Then
        Sleep(62000)
    EndIf
    WinActivate('Paused')
EndFunc  ;==>mySecondFunction

want to add the function to check if 2 windows say "extracting" then 1 window is paused, so i can add RARs and it will pause all but 1 window will get paused.

any suggestions, help will be most welcome

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  
Followers 0