Jump to content
Sign in to follow this  
newroof

Problems with "for i to.." loop

Recommended Posts

newroof

Hi there,

I have a problem with a script. Runs fine for the first records in array and then stops.

Can anybody help me please?

Here is my script:

#include <File.au3>

#Include <Array.au3>

$Folder1 = "C:\working\"

$Folder2 = "c:\done\"

$Files1 = ""

$Files2 = ""

$File = ""

$FileWin = ""

opt("WinWaitDelay",100)

Opt("WinTitleMatchMode",4)

Opt("WinDetectHiddenText",1)

Opt("MouseCoordMode",0)

WinWait("Untitled - Application","")

If Not WinActive("Untitled - Application","") Then WinActivate("Untitled - Application","")

WinWaitActive("Untitled - Application","")

Local $Lines = "Files Found:" & @CRLF

$Files = _FileListToArray($Folder1)

For $i = 1 To UBound($Files)-1

$Files1 = $Folder1 & $Files[$i]

$Files2 = "c:\done\" & StringLeft($Files[$i], StringLen($Files[$i]) - 4) & ".doc"

$File = "c:\t\" & StringLeft($Files[$i], 9) & ".ext"

$FileWin = StringLeft($Files[$i], 9) & ".ext"

Send("{CTRLDOWN}o{CTRLUP}")

WinWait("Open","")

If Not WinActive("Open","") Then WinActivate("Open","")

WinWaitActive("Open","")

Send($File)

Send("{ENTER}")

WinWait($FileWin & " - Application","")

If Not WinActive($FileWin & " - Application","") Then WinActivate($FileWin & " - Application","")

WinWaitActive($FileWin & " - Application","")

Send("{CTRLDOWN}w{CTRLUP}")

WinWait("All Files (*.*)|*.*||","")

If Not WinActive("All Files (*.*)|*.*||","") Then WinActivate("All Files (*.*)|*.*||","")

WinWaitActive("All Files (*.*)|*.*||","")

Send($Files1)

Send("{ENTER}")

WinWait($FileWin & " - Application","")

If Not WinActive($FileWin & " - Application","") Then WinActivate($FileWin & " - Application","")

WinWaitActive($FileWin & " - Application","")

Send("{CTRLDOWN}s{CTRLUP}")

WinWait("Save","")

If Not WinActive("Save","") Then WinActivate("Save","")

WinWaitActive("Save","")

Send($Files2)

Send("{ENTER}")

WinWait($FileWin & " - Application","")

If Not WinActive($FileWin & " - Application","") Then WinActivate($FileWin & " - Application","")

WinWaitActive($FileWin & " - Application","")

Next

Share this post


Link to post
Share on other sites
PsaltyDS

Hi there,

I have a problem with a script. Runs fine for the first records in array and then stops.

Can anybody help me please?

Are you getting any indications at all? Any errors on the SciTE console? Any error pop-ups? Does it exit the script unexpectedly, or hang up the script? Can't tell much from "...and then stops."

:P


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
newroof

Thanks for trying to help.

More details the script reads the folder, execute the for i= to loop for the first records and then just waits (doing nothing). No error messages, nothing, looks like is waiting for something.

Are you getting any indications at all? Any errors on the SciTE console? Any error pop-ups? Does it exit the script unexpectedly, or hang up the script? Can't tell much from "...and then stops."

:P

Share this post


Link to post
Share on other sites
PsaltyDS

Thanks for trying to help.

More details the script reads the folder, execute the for i= to loop for the first records and then just waits (doing nothing). No error messages, nothing, looks like is waiting for something.

There are a lot of WinWait() commands in there. Add this to the top of you script (with the other options) and when you mouse over the tray icon, it will tell you what line it's hung up at. That will tell you which window it is not seeing:

Opt("TrayIconDebug", 1)

:P


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

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.