Ravel Posted September 4, 2007 Author Posted September 4, 2007 (edited) weaponx said: Okay here we go: I am also attaching the required includes from AutoIT since you said you can't install it: Alright I added a simple gui to this so you could see some status. Everything tested okay. Ok, cool it worked like a charm until it hit a snag where there were no files found. I was looking in the help file to see if there was a way to have it continue on even if it doesn't find any files. I like the gui that is pretty cool and since I don't have any experience with it I am learning there also. Is there a place in the help file that will allow this script to skip files if they already exist at the destination? This wasn't a problem before, but now the script is going to be using more CPU time to run, and since this will be a recurring process (in the background) I am interested in having it skip the files (.pdf's) that already exist at the destination and only place and convert the files that don't exist. I think that will save on the amount of time the script actively uses the CPU given that it will only be running when Edited September 4, 2007 by Ravel
weaponx Posted September 4, 2007 Posted September 4, 2007 You can have it skip when there are no matches. After line 124: $DocArray = _FileListToArray ( $DocPath, $filter,1) Put in: If NOT isArray($DocArray) OR $DocArray[0] = 0 Then Return
Ravel Posted September 4, 2007 Author Posted September 4, 2007 weaponx said: You can have it skip when there are no matches. After line 124: $DocArray = _FileListToArray ( $DocPath, $filter,1) Put in: If NOT isArray($DocArray) OR $DocArray[0] = 0 Then Return k. let me do that. I'll let you know.
Ravel Posted September 4, 2007 Author Posted September 4, 2007 Ok that works. Will this allow me it to skip files that already exist at the destination location?
weaponx Posted September 4, 2007 Posted September 4, 2007 (edited) Umm this will just skip when there is no match. If you want to skip files that exist do this after line ~145 ($outFile = $PdfPath & "\" & StringTrimRight ($DocArray[$X], 3 ) & "pdf"): If FileExists($outFile) Then ContinueLoop Edited September 4, 2007 by weaponx
Ravel Posted September 4, 2007 Author Posted September 4, 2007 weaponx said: Umm this will just skip when there is no match. If you want to skip files that exist do this after line ~145 ($outFile = $PdfPath & "\" & StringTrimRight ($DocArray[$X], 3 ) & "pdf"): If FileExists($outFile) Then ContinueLoop K. trying that now.
Ravel Posted September 4, 2007 Author Posted September 4, 2007 (edited) Thats freakin outstanding!!!! lol. That works real well I tried deleting a file that had been in there just to see if it would place it back and it did so while skipping the files that were already there!!!! Now one other thing that I think could shore this up and make everything work just right. Can i loop this whole script say every 4 hours or so or will i have to include this in another script like the scripts that are included in this one? Also is it possible to have that same GUI show up and show the files like it does now, but go away a few seconds after it has transferred the last file? If it isnt possible to do that with the gui, then thats cool just the looping will do. Edited September 4, 2007 by Ravel
weaponx Posted September 4, 2007 Posted September 4, 2007 (edited) If you want the GUI window to close when everything is done just put an Exit after the last call to convertmultiplefolders, just before the line that says: ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop Wend I wouldn't recommend running this script in the background though, it would eat up processor time idling around. Maybe add it to your scheduled tasks through Start > Programs > Accessories > Task Scheduler Edited September 4, 2007 by weaponx
Ravel Posted September 4, 2007 Author Posted September 4, 2007 weaponx said: If you want the GUI window to close when everything is done just put an Exit after the last call to convertmultiplefolders, just before the line that says: ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop Wend I wouldn't recommend running this script in the background though, it would eat up processor time idling around. Maybe at it to your scheduled tasks through Start > Programs > Accessories > Task Scheduler Hmm... I hadn't thought of the task scheduler I will do that instead. ["october 07","21 - Daily Document Registers\21-A - D04\10 October"], _ ["november 07", "21 - Daily Document Registers\21-A - D04\11 November"], _ ["december 07","21 - Daily Document Registers\21-A - D04\12 December"]] convertmultiplefolders($PathArray, "11-01. D04, Daily Report*.doc") Exit;<======= here write? ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop Wend That is what you were referring to right?
Ravel Posted September 4, 2007 Author Posted September 4, 2007 weaponx said: If you want the GUI window to close when everything is done just put an Exit after the last call to convertmultiplefolders, just before the line that says:; Run the GUI until the dialog is closedWhile 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoopWendI wouldn't recommend running this script in the background though, it would eat up processor time idling around. Maybe add it to your scheduled tasks through Start > Programs > Accessories > Task SchedulerI checked the task scheduler and unfortunately they have that block from our use. I tried to start a task but it is blocked. That sucks. I think it will be fine to run in the background. I had the old one running in the background, but it would be on a 4 hour sleep pause... and I wouldn't even notice that it was there. So there shouldn't be a problem with that, not to mention that is the only way I can run it automatically anyway.
weaponx Posted September 4, 2007 Posted September 4, 2007 Alright this version contains all of the changes we have discussed previously. After it runs the first time it will run every 4 hours from the end of the previous run, checking every 1 minute if it has been 4 or more hours. This should keep processor time to a minimum.WeaponXconvertfolders.au3
Ravel Posted September 4, 2007 Author Posted September 4, 2007 (edited) weaponx said: Alright this version contains all of the changes we have discussed previously. After it runs the first time it will run every 4 hours from the end of the previous run, checking every 1 minute if it has been 4 or more hours. This should keep processor time to a minimum.WeaponXconvertfolders.au3 I have learned some things that I didn't know before. I will use this in other projects too. I can't thank you enough for your help with this. I would have never been able to get it up and working by myself. I appreciate all the help!!! Edited September 4, 2007 by Ravel
Ravel Posted October 22, 2007 Author Posted October 22, 2007 (edited) weaponx said: No problem.Got a new problem, I am not sure if this pertains to vista and word 07, but I am getting an error when it tries to convert files now that we have upgraded to vista enterprise edition. this is the error:Line 86 of doc2pdf.au3$wdoc.SaveAs ($sPDFFile, $wdFormatPDF)$wdoc.SaveAs ($sPDFFile, $wdFormatPDF)^ERRORError: The requested action with this object has failedAny ideas? Edited October 22, 2007 by Ravel
Ravel Posted October 22, 2007 Author Posted October 22, 2007 weaponx said: Vista = out of my territorylol Cool no biggie, I thought I would ask. Ill keep playing with it, maybe i can figure it out. I'll post here if I do. If anyone else has any hints let me know.
Ravel Posted October 22, 2007 Author Posted October 22, 2007 weaponx said: Vista = out of my territoryI think I figured out the problem. It has something to do with the files being on the network, and me not being able to install a printer. There is some issue with our printers, and vista enterprise at the moment. From what I noticed it works find if the files are saved to my local pc, but if they are being accessed from a network drive then word freaks out and cant opening them with out calling a printer function or something. My print spooler service wont run, so that is what I think is causing the hiccup. I'll post if they get that problem clarified.
Blue_Drache Posted October 22, 2007 Posted October 22, 2007 Copy file to local pc, convert, copy file to remote location? Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache
Ravel Posted October 24, 2007 Author Posted October 24, 2007 Blue_Drache said: Copy file to local pc, convert, copy file to remote location?That sounds like an easy workaround. I might give that a try and see if it will work out. Ill post the results here.
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