Jump to content
Sign in to follow this  
4Bravo

Application, or possible windows developing errors after a while on batch

Recommended Posts

4Bravo

I'm running a batch process in Adobe Flash on a few hundred files in an array. Everything runs fine for about an hour or so, but then it says one of the files that it's opened successfully on every loop before won't open, throws up an error. I stop the script, try to open it manually and it won't open.

I log off, log back in and everything goes back to normal. Is this a memory problem? Any suggestions on how to keep Windows from developing errors in the long run? Here's the code I'm using:

#include <Array.au3>
#include <FileOperations.au3>
#include <RecFileListToArray.au3>
Opt("WinWaitDelay", 200)
$sPath = "D:\Animations\CYOA\Animation\Stock_Animations\Boy\Talking"
$justFILE = _RecFileListToArray($sPath, "*.fla", 1, 1, 0, 0)
$flaDIR = _RecFileListToArray($sPath, "*.fla", 1, 1, 0, 2)
For $i = 1 To $justFILE[0]
    $justFILE[$i] = StringTrimRight($justFILE[$i], 4)
;MsgBox (1, '', $justFILE[$i])
next

; _ArrayDisplay($FileList)
For $i = 1 To $flaDIR[0]
;MsgBox (1, '', $flaDIR[$i])
    Run("C:\Program Files (x86)\Adobe\Adobe Flash CS5.5\flash.exe " & $flaDIR[$i])
    WinWaitActive($justFILE[$i])
Sleep(2000)
    ; send export command
    Send("^!C")
    WinWaitActive("Adobe Flash CS5.5")
    ; close .fla file
    Send("^X")
Next

Share this post


Link to post
Share on other sites
Melba23

4Bravo,

Given that you say the error is caused by not being able to open a file, my immediate thought is that you are not properly closing the file on the previous pass.

Perhaps you could add a check after the Send("^x") line to confirm that it has indeed closed (a loop with ProcessExists should do the trick - Run returns the process ID) and force it if required with ProcessClose. :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
water

Which Windows version do you run?

Is it always the same file?

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
4Bravo

I'm running windows 7, and the file changes.

M23, flash doesn't close after the loop, it stays open for the next file. Closing it and restarting it would add 10+ seconds to a batch running 200+ files in the array.

Share this post


Link to post
Share on other sites
Melba23

4Bravo,

Then is there something you can check after the Send("^x") to confirm that particular file has closed? :huh:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
4Bravo

The only way I can confirm is by looking at the application and seeing if the window is closed. After running 5+ scripts since this post I am convinced that Flash is garbage after running a batch process for more than an hour. Is there a Autoit function to call a command like send ("^!X") to close the application after an 1 hour?? and then continue the script and call that send command every hour? Even every 30 mins would be a lot easier than shutting down the application on every loop, or trying to pick up the pieces after it crashes

Edited by 4Bravo

Share this post


Link to post
Share on other sites
water

I would simply add a counter to your script. After n loops restart Flash and reset the counter.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
4Bravo

Thanks for replying Water, can you show me an example of this? I don't think I know how to continue the array without starting from the beginning

Share this post


Link to post
Share on other sites
water

Is the code you showed in post #1 the latest code?

Does 'Send("^X")' only close the opened .fla file but not the application?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
4Bravo

yes, ("^!X") closes the application

Share this post


Link to post
Share on other sites
water

But now you seem to send "^X" only, which - according to the comment - only closes the .fla file. If you then run flash again in the next loop don't you get hundreds of flash processes?

Could you run this modified version of the script?

#include <Array.au3>
#include <FileOperations.au3>
#include <RecFileListToArray.au3>
Opt("WinWaitDelay", 200)
$sPath = "D:AnimationsCYOAAnimationStock_AnimationsBoyTalking"
$justFILE = _RecFileListToArray($sPath, "*.fla", 1, 1, 0, 0)
$flaDIR = _RecFileListToArray($sPath, "*.fla", 1, 1, 0, 2)
For $i = 1 To $justFILE[0]
$justFILE[$i] = StringTrimRight($justFILE[$i], 4)
;MsgBox (1, '', $justFILE[$i])
next

; _ArrayDisplay($FileList)
For $i = 1 To $flaDIR[0]
    ;MsgBox (1, '', $flaDIR[$i])
    Run("C:Program Files (x86)AdobeAdobe Flash CS5.5flash.exe " & $flaDIR[$i])
    WinWaitActive($justFILE[$i])
    Sleep(2000)
    ; send export command
    Send("^!C")
    WinWaitActive("Adobe Flash CS5.5")
    ; close .fla file
    Send("^X")
    If $i = 5 then
        $a = ProcessList()
        _ArrayDisplay($a)
    EndIf
Next
How many Flash processes do you see?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
4Bravo

After 5 files were processed I get the array and see 1 Flash.exe

Share this post


Link to post
Share on other sites
water

Then replace

If $i = 5 then
$a = ProcessList()
_ArrayDisplay($a)
EndIf
with
If Mod($i, 50) = 0 then
  Send("^!X") ; End Flash
  ProcessWaitClose("flash.exe") ; wait until the process has finished
EndIf
Closes flash after processing 50 files.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
4Bravo

Thanks!! It ran all night and didn't crash once

Share this post


Link to post
Share on other sites
water

Glad your problem could be solved :D


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

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  

×