weaponx Posted August 1, 2007 Posted August 1, 2007 I followed your directions, but Map Network Drive is not an option that comes up when I right click the GROUP folder.Well what is your current procedure for viewing your folder that contains all the PDF's?
ConstantineGeorgantzas Posted August 1, 2007 Author Posted August 1, 2007 Well what is your current procedure for viewing your folder that contains all the PDF's?I go to my computer then I click on a directory called Group on 'Ny_fs1\Corp', then I go into subfolders to see pdfs. Or I can run a search to see them all.
weaponx Posted August 1, 2007 Posted August 1, 2007 I go to my computer then I click on a directory called Group on 'Ny_fs1\Corp', then I go into subfolders to see pdfs. Or I can run a search to see them all.Does it have a drive letter? If it does, you should be using that as your input source folder.
ConstantineGeorgantzas Posted August 1, 2007 Author Posted August 1, 2007 Does it have a drive letter? If it does, you should be using that as your input source folder.The drive letter is S. Are you talking about selecting something else when I'm prompted by the script? Or do I have to change something in the code.
weaponx Posted August 1, 2007 Posted August 1, 2007 The drive letter is S. Are you talking about selecting something else when I'm prompted by the script? Or do I have to change something in the code.If you run my script the first prompt is for input source, when the dialog opens you should choose My Computer and select drive S:Then choose a destination folder on your local machine.
ConstantineGeorgantzas Posted August 1, 2007 Author Posted August 1, 2007 If you run my script the first prompt is for input source, when the dialog opens you should choose My Computer and select drive S:Then choose a destination folder on your local machine.I have been doing that from the first.
ConstantineGeorgantzas Posted August 2, 2007 Author Posted August 2, 2007 (edited) If a file is readonly can it be compressed? The help file says this about a character that FileGetAttrib() returns: "C" = COMPRESSED (NTFS compression, not ZIP compression) So do files compressed by Adobe Acrobat apply? One reason I am asking this is because I once read that Acrobat already compresses files once they are made and then the user has the option to reduce the file size even more by compressing them again. Edited August 2, 2007 by ConstantineGeorgantzas
ConstantineGeorgantzas Posted August 2, 2007 Author Posted August 2, 2007 Your final script will need to go through all the files stored in the array and filter out the stuff you don't want to do anything with (using functions like FileGetSize, FileGetAttrib, FileGetTime, and possibly comparing the filename to a list you could generate of files that you specifically want to exclude (which could be generated by your script as well...maybe files which have already been compressed but are still bigger than your desired threshold). You can use _ArrayDelete to remove filenames from the array of files, so that the array will simply be a list of files for the script to compress. I finished that part of the script and it works: ;prompt the user for the filtration he wants $MinSize = InputBox("Minimum Size", "Please enter a minimum size for compression (in bytes)", "5000") If @error Then $MinSize = 5000 EndIf $year = InputBox("Latest Year", "Please enter the latest year modified for compression (four digits)", "2007") If @error Then $year = 0000 EndIf $month = InputBox("Latest Month", "Please enter the latest month modified for compression (two digits)", "07") If @error Then $month = 01 EndIf $day = InputBox("Latest Day", "Please enter the latest day modified for compression (two digits)", "01") If @error Then $day = 01 EndIf ;shrink the array by eliminating filtered files For $i=1 To $FileArray[0] $modified = FileGetTime($FileArray[$i]);FileGetTime, by default, returns an array with elements pertaining to the time a file was last modified $attrib = FileGetAttrib($FileArray[$i]);FIleGetAttrib returns a string containing letters; if the string has an C, the file is compressed; if the string has an R, the file is read-only If FileGetSize($FileArray[$i]) < $MinSize OR ($modified[0] >= $year AND $modified[1] >= $month AND $modified[2] >= $day) _ OR StringInStr($attrib, "R") OR StringInStr($attrib, "C") Then _ArrayDelete($FileArray,$i) EndIf Next $FileArray[0] = UBound($FileArray)-1 MsgBox(0, "Improved Array", "$FileArray now has " $FileArray[0] & "files") _ArrayDisplay($FileArray) However, I am still having many problems with opening the files one at a time and am struck by the fact that it has been so difficult. All that remains after that is the compression, which I think I can easily do with a bunch of Send(!f {ENTER})'s. After that, nothing remains, right? Because we never transfered the files to a temporary folder and they will never have to be transfered back.
ConstantineGeorgantzas Posted August 2, 2007 Author Posted August 2, 2007 (edited) Testing the program takes to long because an array with 60000 elements is created and then the program goes through those elements one by one to filter them. I need to make this process faster. I'm thinking of creating a separate version of the program just for testing that looks in a smaller directory with fifty or so files. So, I'm gonna go do that now. I have done it before in fact, with the following code, but I am having trouble getting notepad to run and open the file. This code was supposed to use a smaller list of files that I have in Notepad to write the array. #include <Array.au3> Global $FileArray $RunHandle=Run(@ComSpec & ' /c start "" "'&"\\Ny_fs1\Corp\Group"&'\filesfound.txt"', "", @SW_HIDE);opens notepad - run() runs programs, which may do things like open files and reveal them on screen. But files cannot be run. MsgBox(0,"$RunHandle equals:",$RunHandle) $handle = FileOpen("\\Ny_fs1\Corp\Group\filesfound.txt", 0);FileOpen() locks the file for editing: it lets the computer read or write (alter) a file without putting it on the screen. The computer can do this until FileClose(). If @error <> 0 Then MsgBox(16,"Error","Error number "&@error) EndIf While @error <> -1;if the end of the file is reached then stop reading $line = FileReadLine($handle) _ArrayAdd($FileArray, $line) Wend _ArrayDisplay($FileArray) FileClose($handle) Edited August 2, 2007 by ConstantineGeorgantzas
ConstantineGeorgantzas Posted August 3, 2007 Author Posted August 3, 2007 (edited) I have some bad news. I was originally appointed as an intern to my company to complete a task that ended up taking me no more than two days. I soon found out that my employer expected the project to take all summer and that he had no other work to readily give me. As a result, there was about one week where I could not do very much until they found me my next project. That's when file compression came along, which I later did for one week tediously. A break from file compression came along when my boss tried to transfer me to another department so that I could do other work, but our efforts did not bear fruit for I was unskilled labor. Then, after being put back on the file compression project, I found out about Automator, for Macs, and subsequently found out about the more powerful AuotIt language and tools. My boss has just fired me before I could complete the AutoIt program for file compression; he didn't feel like the creation of an efficient computer program or the compression of files themselves was a worthy enough reason to keep me as an intern. So now I will be stopping work on the program prematurely. I have to give a really big special thanks to everyone who has helped me. Keep this in mind: Although we could not finish our work I got to learn all about the AutoIt language and logical reasoning; these are developments that I sincerely appreciate. Moreover, thanks to your influence I will continue pursuing my newfound interest in computer science in college. Thanks again. Edited August 3, 2007 by ConstantineGeorgantzas
leuce Posted August 8, 2007 Posted August 8, 2007 Each document comes from a very specific folder, which is usually hidden away in one of various sub-folders. So getting the computer to find each file - let's say each file above 5MB - and extract it from the folder to put into the temp, and then to finally replace it in its original folder seems complicated.I'm sure there are elegant ways of doing it, but I'm a lazy programmer and I have to do similar things. I recently wrote a script that scans PDFs using ABBYY Finereader and converts them to DOC -- the PDFs are in subfolders in a tree, and the resultant DOC files are saved in the same folders. My ABBZZ script is here: http://leuce.com/tempfile/omtautoit/ABBZZ.zip if you wanna look (it is bad...).Basically, I create a text file with all the paths of all the PDFs, and then I get the script to read from that file one line at a time.To create that text file: Go to the root folder of the subfolders where all the PDFs reside. Right-click the folder, and select "Search". Then search for *.pdf. It'll give you a list of all PDFs. I have PikyBasket installed, which allows me to select all those PDFs in the list, right-click and select "Copy paths to clipboard" (I think the WinXP PowerToys has a similar thing in it). Then paste to a text file. Now you don't have to worry about where the PDFs are, because you can open them by pasting the full path in any File/Open dialog from anywhere... and you can save them in that same path under a slightly different name (say, add "_optimised" to the filename).I'm sure the AutoIt boffs have a better, more elegant way of doing it :-)
weaponx Posted August 8, 2007 Posted August 8, 2007 I'm sure there are elegant ways of doing it, but I'm a lazy programmer and I have to do similar things. I recently wrote a script that scans PDFs using ABBYY Finereader and converts them to DOC -- the PDFs are in subfolders in a tree, and the resultant DOC files are saved in the same folders. My ABBZZ script is here: http://leuce.com/tempfile/omtautoit/ABBZZ.zip if you wanna look (it is bad...).Basically, I create a text file with all the paths of all the PDFs, and then I get the script to read from that file one line at a time.To create that text file: Go to the root folder of the subfolders where all the PDFs reside. Right-click the folder, and select "Search". Then search for *.pdf. It'll give you a list of all PDFs. I have PikyBasket installed, which allows me to select all those PDFs in the list, right-click and select "Copy paths to clipboard" (I think the WinXP PowerToys has a similar thing in it). Then paste to a text file. Now you don't have to worry about where the PDFs are, because you can open them by pasting the full path in any File/Open dialog from anywhere... and you can save them in that same path under a slightly different name (say, add "_optimised" to the filename).I'm sure the AutoIt boffs have a better, more elegant way of doing it :-)Show some respect, the man got fired!
leuce Posted August 8, 2007 Posted August 8, 2007 Show some respect, the man got fired!My reply was to his first post, not to his last. And I'm sorry for him getting fired -- he had a stupid boss.
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