Jump to content

Script stops (freeze) -please help


newroof
 Share

Recommended Posts

I have this script - works fine for about 50 records and than stops (freeze). If I launch the script again, works for one or two records and then stops again. I doesnt process all records in _FileListToArray. No error messages.

I created a script using AU3Recorder. Can anybody help me - there is any way I can optimize it?

Thanks.

Here is the script:

#include <File.au3>

#Include <Array.au3>

$Folder1 = "C:\working\";<-- Fill this in correctly

$Folder2 = "c:\complete\";<-- Fill this in correctly

$Files1 = ""

$Files2 = ""

$File = ""

$FileWin = ""

$Files = _FileListToArray($Folder1)

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

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

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

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

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

ShellExecute($File, "Open")

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

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

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

Send("{CTRLDOWN}{SHIFTDOWN}f{CTRLUP}{SHIFTUP}")

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}{SHIFTDOWN}x{SHIFTUP}{CTRLUP}")

WinWait("Export file","")

If Not WinActive("Export file","") Then WinActivate("Export file","")

WinWaitActive("Export file","")

Send($Files2)

Send("{ENTER}")

WinWait("Export as JPG","")

If Not WinActive("Export as JPG","") Then WinActivate("Export as JPG","")

WinWaitActive("Export as JPG","")

Send("{ENTER}")

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

FileDelete($Files1)

Next

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...