nan0 Posted December 31, 2010 Posted December 31, 2010 Hello, I have a script to automate some things with Powerpoint and Camtasia. The script itself works fine, but I have an issue with the loop that actives the script for multiple files in a folder. The script (shortened): expandcollapse popup; Variables for paths and extensions Global $presInputPath = "E:\inpres\" Global $pptpath = "D:\Microsoft Office Ultimate 2007\Office12\POWERPNT.EXE /O " Global $extension = "*.pptx" ; Find files in a directory Global $search = FileFindFirstFile ($presInputPath&$extension) ; Check if the search was successful If $search = -1 Then MsgBox(0, "Error", "No files/directories matched the search pattern") Exit EndIf ; Begin loop While 1 ; Get a file $file = FileFindNextFile($search) If @error Then MsgBox(0, "Finished", "No more presentations to produce") ExitLoop EndIf ; Do some things with the filename, e.g. append it to the path to start PPT ;Run Powerpoint Run($fullpath) ;Do a lot of stuff.... ;Activate PPT and end it WinActivate("Microsoft PowerPoint") WinWaitActive("Microsoft PowerPoint") Send("!d") sleep(50) Send("!b") WEnd FileClose($search) The problem is that the script runs for the first file without any issues. But after PPT is closed, nothing happens. The script still sits in the background but doesn't start PPT again as it should. I'm not sure whether the Global keyword is correct in this case, but I suspected that somehow the variables can't be read after one run through the loop. I have no idea who could be the culprit, my best guess is the FileFindNexFile method but I can't figure out what is wrong. Any suggestions?
Developers Jos Posted December 31, 2010 Developers Posted December 31, 2010 Your posted script is not complete enough to test with, but one option to figure out where the script is hanging is to add this to the top: Opt("TrayIconDebug", 1) SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
nan0 Posted December 31, 2010 Author Posted December 31, 2010 It seemed to be some kind of weird timing issue. If I use sleep(200) before starting PPT everything works ok. Thanks anyway.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now