Get all .pdf file in a folder and do shell script

Hi, I need to convert many pdf to ps using pdf2ps, and I'm try to do this with applescript:
tell application "Finder"
set pdf_folder to (choose folder)
set pdf_path to POSIX path of (item of folder pdf_folder whose name...)
end tell
repeat with k in pdf_path
set kl to ... -- same of k but with extension .ps
do shell script ("pdf2ps "&k&" "&kl)
end repeat
but I don't know how implement that.
Can anyone help me?
Thanks!

01. The 'tell application "Finder" ... end tell' code block is not required to call 'choose folder'. View the 'Standard Additions' dirctionary.
02. 'choose folder' returns a single alias - if only a single folder is to be selected, or a list of 'alias'es - if 'multiple selection allowed' is set to true.
03. 'pdf2ps' is not part of Apples' UNIX commands installation; and you did not provide a valid URL for others to download the UNIX command.
Code to process only a single selected folder.
-- Code starts here --
try
do shell script ("pdf2ps " & (quoted form of (POSIX path of ((choose folder) as string))))
end try
-- Code ends here --
Code to process multiple selected folders.
-- Code starts here --
set pFolder to choose folder with multiple selections allowed
if ((count pFolder) > 1) then
set {oAStid, AppleScript's text item delimiters} to {AppleScript's text item delimiters, ""}
set pFolder to text items of pFolder
repeat with i from 1 to (count pFolder)
set (item i of pFolder) to quoted form of (POSIX path of (item i of pFolder))
end repeat
set AppleScript's text item delimiters to " "
set pFolder to pFolder as string
set AppleScript's text item delimiters to oAStid
else
set pFolder to pFolder as string
end if
try
do shell script ("pdf2ps " & pFolder)
end
-- Code ends here --

Similar Messages

  • Is possible search all the files in one folder and get list all with the same extension.??

    Hi,
    I would like to get, if it is possible, do searching in one determinate folder and get all the files with the same extension, For example, Give the *.pou and get all the files on one list of the files in this folder and sub-folders...
    If it is possible i would like to see any example.
    Thanks a lot, Fonsi.

    Hi Dennis,
    I got your advise, I download the openG (i had problems, and downloading directly and install one to one).
    Ok, i got but i have one problem, which i can't solve. I entry the promt  to search and put the directory to save, later i push 'Do it' and it search the files, show the paths and number, then save in the folder and finally show the window , all ok!.
    The problem is with the target path, when i want use the browse, it doesnt run properly. I want select one carpet, and it demands one file, i dont understand why??, i changed the options browse but it didnt work. Also i would like when i put one path if folder doesnt exist, directly create it and save the files, if exist copy it.
    Thanks for all!. I attached the file in lv 7.1
    Attachments:
    buscar3.vi ‏50 KB
    capture.GIF ‏48 KB

  • Printing all PDF files in a folder.

    is there a way to print all my individual PDF files in one folder without opening each and then printing it before opening the next one. I have 52 PDF files in one folder that I need to print.

    Use Automator to create a Service that looks like this:
    !http://i.imgur.com/0nTuy.png!
    Save it, give it a name like "Print All Files".
    Now you can control-click the folder in the Finder and select you new service under Services.
    Just a transcript of the screenshot:
    Service receives selected folders in Finder
    1st action is *Get Folder Contents*
    2nd action is *Print Finder Items*; Print to *Default Printer*; under Options select *Show this action when the workflow runs* so you can select your printer.
    Message was edited by Sam_P to add screenshot transcript.

  • Reader 9.3 produces Runtime error for all .pdf files on hard drive and email

    Does anyone have a resource that can show me how to eliminate a runtime error with Reader 9.3.1, Windows XP w/ SP3 and IE7. I have recently had all .pdf files located on my hard drive and in emails refuse to open because of this message:
    "Runtime Error!
    Program C:\Program Files\Adobe\Reader 9.0\Reader\AcroRd32.exe
    This application has requested the Runtime to terminate it in an unusual way.  Please contact the application's support team for more information."
    So far, I have uninstalled and reinstalled Reader 9.3 from the website; added update 9.3.1 and tried to reopen files with no success.
    My organization sends a ton of .pdf files and it is not good when you can't open them for review and action.

    Hi All,
    Although I don't normally post in forums, I thought it prudent to lay this matther to rest.  I have tested the following solution:
    It appears that Adobe Reader likes to check access to each parent folder as well as the actual application data folder.  Apparantly there are other programs that also do similar things. As a result if you have your appdata redirected to \\server1\profiles\%username%\appdata adobe reader would first try directly access \\server1\profiles.  If the user does not have to Traverse folder permission, this fails. Typically you will need to change your permissions on you profile share from:
    -                   Users - Read Attributes (Apply to: This folder, subfolders and files)
    -                   Users - Read Extended Attributes (Apply to: This folder, subfolders and files)
    -                  Users - Create Folders/Append Data (Apply to: This folder, subfolders and files)
    -                   Users - Read Permissions (Apply to: This folder, subfolders and files)
    To the share permissions suggested by Microsoft in KB 274443:
    -                   Everyone - Create Folder/Append Data (Apply onto: This Folder Only)
    -                   Everyone - List Folder/Read Data (Apply onto: This Folder Only)
    -                   Everyone - Read Attributes (Apply onto: This Folder Only)
    -                   Everyone - Traverse Folder/Execute File (Apply onto: This Folder Only)
    Hopefully this helps everyone.

  • Getting all webI reports in a folder and its sub-folders using java sdk.

    hi,
    I need a java code to get the Id of all webi  reports in a folder and recursive sub folders .
    Is there any sample code or tutorial  available for It?
    regards,
    nitin

    I didn't test this but it should work. Import required packages.
    <%
    String username = "administrator";
    String password = "<password>";
    String cmsname = "<cmsname>";
    String authtype = "secEnterprise";
    IEnterpriseSession oEnterpriseSession = CrystalEnterprise.getSessionMgr().logon(username, password, cmsname, authtype);
    IInfoStore oInfoStore = (IInfoStore)oEnterpriseSession.getService("","InfoStore");
    getWebi(oInfoStore,0,out);
    oEnterpriseSession.logoff();
    %>
    <%!
    public void getWebi(IInfoStore oInfoStore, int sourceFolderID, javax.servlet.jsp.JspWriter out)
    try
         String query = "select * from ci_infoobjects where si_kind='webi' and si_instance =0 and si_parentid =" + sourceFolderID ;
         IInfoObjects oInfoObjects = oInfoStore.query(query);
         for(int i=0;i< oInfoObjects.size(); i++)
              IInfoObject oInfoObject = (IInfoObject) oInfoObjects.get(i);
              out.println(oInfoObject.getID() + "  " + oInfoObject.getTitle() +"<br>");
         String query = "select * from ci_infoobjects where si_kind='folder' and si_parentid = " + sourceFolderID ;
         oInfoObjects = oInfoStore.query(query);
         for(int i=0;i< oInfoObjects.size(); i++)
              IInfoObject oInfoObject = (IInfoObject) oInfoObjects.get(i);
              getWebi(oInfoStore, oInfoObject.getID(), out);               
    catch(SDKException e)
         out.println(e.toString());
    %>

  • Extracting the first page from all pdf's in a folder and save them to a new file

    Hi,
    As Bridge apparantly is unable to create a decent-looking PDF from a bunch of other PDF's, we're looking for alternative solutions. The problem is, that I haven't done much scripting in Acrobat.
    Pseudocode:
    Select Folder where PDF files are stored
    Create list of PDF files
    Get first page from each and add it to temporary new PDF
    Save temporary new PDF in high quality
    Would that be possible in Acrobat? And where would I start? I can't even find a Scripting Guide for Acrobat (like the ones for Illustrator and InDesign).. and there seems to be no sample scripts included either :-(
    Thanks,
    Thomas

    This can be done using a combination of an Action and a script. The script in the Action will collect the paths of the files you want to process and the folder-level script will extract the first page from each file and generate a new PDF from it. You don't need a plugin for this task, so you don't really need the SDK.
    The Acrobat JavaScript Reference can be found here: http://www.adobe.com/devnet/acrobat/javascript.html

  • Printing all PDF files in a folder in file name order

    When I do a select all and then Print the PDF files selected are printing in a random order.  Is there any way to have them print in the order that they appear in the folder (Listed by name)?  Thanks

    Adobe Reader 9.0.  I can go into Windows and open a folder with say 10 PDF files in it and click on Edit and Select All and then right click and click print and they will all print, but, they print out in a different order every time.  It would be great if they printed out in name order or the order the are listed in the folder.  Thanks

  • How to get all image files from a folder to wwv_flow_files?

    Hi there!
    Is it possible in apex to show, in a report look-a-like, all image filenames from a folder in another machine (i enter in that machine by ip) and insert all files into wwv_flow_files?
    I want to see all files, then pick one and open a image...
    But it can't be by browse item... it has to show all filenames as a list...
    If it is possible, how can i do it?
    Thanks!
    Best regards,
    Luis Pires

    Hi,
    you can connect to the server using UTL_HTTP.
    Then for each files you copy the response into a BLOB to be able to show it or to store it in a table.
    A piece of code :
    begin
       -- initialize the BLOB.
       dbms_lob.createtemporary(l_blob, false);
       -- path to the file
       l_url := 'http://your_server/your_file.jpg';
       -- begin retrieving the target.
       l_req := utl_http.begin_request(l_url);
       -- identify ourselves (some sites serve special pages for particular browsers)
       utl_http.set_header(l_req, 'User-Agent', 'Mozilla/4.0');
       -- start receiving the response.
       l_resp := utl_http.get_response(l_req);
       -- copy the response into the BLOB.
       begin
          loop
             utl_http.read_raw(l_resp, l_raw, 32767);
             dbms_lob.writeappend (l_blob, utl_raw.length(l_raw), l_raw);
          end loop;
          -- stop when exception end_of_body is raised
       exception
          when utl_http.end_of_body then
             utl_http.end_response(l_resp);
       end;
    end;It's a minimal example, you may need authentication, check l_resp.status_code, etc...

  • How we can get all the files in FTP folder

    Hi all,
    My requirement is need to retrive text files from FTP folder to application server.
    For this i am using FTP_SCRAMBLE
                                FTP_CONNECT
                                FTP_COMMAND function modules.But i dont know how we can access particular folders and all files in Particular folders.For this i dont know the process and is there any commands to see all files in a folder.
    Very Urgent...
    Thanks and Regards,
    Siva.

    Hi,
    Check the link below:
    Re: How can we upload a file from ftp server
    hope this helps.
    regards,
    Sharath

  • Add bookmarks to all pdf files at once using javascript or apple script

    Hello
    I have a folder containing pdf files of a survey.
    There is also a 'surveyname.pdf' file which consists of a number of pages.
    These pages have to be bookmarked for easy reference.There is a 'dummy.pdf' file which has all the bookmarks of the survey pages. I am using Adobe Acrobat 7.0 to open this file.
    There are also some map pdf's in the same folder.
    How can I add the bookmarks that are in the 'dummy.pdf' file to all the other pdf files in the same folder at once instead of doing one at a time which consumes a lot of time for 100-120 files?
    I use extendscript toolkit for writing the javscript or applescript code.
    I would be grateful if anyone could help me in solving this.
    Thankyou
    Krishna

    Here are some examples of doing the insert and the save in a separate operation. You can put them together on your own.
    ~T
    //From the JS Reference:
    this.insertPages ({
    nPage: -1,
    cPath: "/c/temp/myCoverPage.pdf",
    nStart: 0
    //Example of a trustedFunction SaveAs
    mySaveAs = app.trustedFunction(function (cPath)
    app.beginPriv();
    this.saveAs(cPath);
    app.endPriv();
    app.addMenuItem({ cName: "mySaveAs", cParent: "Insert Page",
    cExec: "mySaveAs('/c/myFolder/myNewPDF.pdf')",
    cEnable: "event.rc = (event.target != null);",
    nPos: 0

  • Read all the files in a folder over and over again

    I want to develop an application that reads all the files in a folder, and once its done reading those files it reads all the files again.
    The purpose for this application is to read all the files in a folder that are continuously being stored in that folder, so that when a new file is created, that file is also read by the application. I then need to compare the date and time in which the file was created to the actual date and time of the system, so that way I can get the most recent file, and then  I will do other operations with this file.
    The thing is that I know how to read all the files in a directory, but I don't know how to cycle through those files again, in order to look for the most recent one, and I don't know how to make the comparison of the time stamps, because I need a precision of one second in the system time and the time the file was created.
    Can someone please help me?
    Thanks in advance!
    Solved!
    Go to Solution.

    I think that I just went the wrong direction.
    What I wanted to do in the first place, was to rename and overwrite every new file in a directory with the same name and file extension, so that every new file overwrites the old file. The thing is that the list folder only lists the files the first time and then keeps on telling me there are no files to be read even though there are new files.
    What I need now is a way to overwrite the old files with the same name, and keep searching for every new file that is going to be stored in the directory.
    I will leave the code that I have right now, so that you can tell me what do I need to modify in order to read every new file that's going to be created in that directory.
    Thanks in advance for your help!
    Attachments:
    Overwrite Files.vi ‏12 KB

  • Got a new external hard drive. Transferred all files from old hard drive to new hard drive. Connected hard drive to macbook. How do I get all my files to be recognized by iTunes and my already made playlists??

    Got a new external hard drive. Transferred all files from old hard drive to new hard drive. Connected hard drive to macbook. How do I get all my files to be recognized by iTunes and my already made playlists??

    Trying to download photos from IPHONE, IPAD to IPHOTO in IMAC after installing new hard drive.
    How did you import the photos to iPad and iPhone?
    If the photos have been synced to the iPhone and iPad using iTunes, you cannot sync them back.
    See this document:  http://support.apple.com/kb/HT4236
    You can't reimport pictures synced from your computer to your device back to your computer. You can only import pictures in the Camera Roll or Saved Photos from your device to your computer. If you need to retrieve synced photos from your device:
    If your photos are not in the Camera Roll on your devices, save them to the Camera Roll, share them to the Photo Stream, mail the photos, or, if you have iPhoto on the devices, use iTunes Photo Sharing.
    http://help.apple.com/iphoto/iphone/2.0/?handbuch#blnkee26bc1
    Save photos to your computer using iTunes
    Connect your iOS device to your computer.
    Tap a photo, album, event, web journal, or slideshow and tap Share> iTunes.
    Tap Selected, or change the photos you want to save (if you are saving a slideshow skip to step 4):
    Select different photos: Tap Choose Photos, tap one or more photos, and tap Next.
    Select a range of photos: Tap Choose Photos, tap Range, tap the first and last photos in the range, and tap Next.
    Select all the photos in an album or event: Tap All.
    In iTunes, click the button for your device and click Apps at the top of the window.
    Below File Sharing, select iPhoto (in Apps).
    Select the Shared Photos folder under iPhoto Documents.
    Click Save To and select the location on your computer where you want to save the items.
    To view your photos, go to the Finder and look in the location you selected above.

  • Using Acrobat 9 and suddenly there is no selected page range in the print box.   Only selected PDF files or all PDF files.  Am I doing something wrong?  I need to print only three pages from the document

    There is no selected print page range in the print box.  Only selected PDF file and all PDF files.  Any suggestions?

    Well, I looked for where to delete this but didn't see it.
    NEVERMIND; I forced iPhoto to quit and restarted and everything seems fine.
    BTW, I did get one thing wrong. When I looked at both iPhoto libraries with FINDER, the active one and the archived one both showed content as far as file size goes.
    It was because I was viewing the files through Adobe Bridge that it was showing 0 GB's; for whatever reason.

  • I need applescript to change all files in a folder and its subfolders ending in .xlsx changed to .xlsb

    I need applescript to change all files in a folder and its subfolders ending in .xlsx changed to .xlsb

    try something like this:
    with timeout of 3600 seconds
      -- long timeout to because the Finder is horribly slow
              tell application "Finder"
      -- collects the files from a folder called "whatever" in your user home folder
                        set xlsbFiles to every file of entire contents of folder "Whatever" of home whose name extension is "xlsb"
                        repeat with thisFile in xlsbFiles
                                  set name extension of thisFile to "xlsx"
                        end repeat
              end tell
    end timeout
    you could make a more efficient script using System Events.app, but this will get the job done with a minimum of thought.

  • Is there a way to get ALL MY FILES folder back?

    i accidently deleted ALL MY FILES folder while using disk map  app... is there a way to get that folder back... it contains all the files in your mac and is helpful at times... please advise how to get ir back if i can....
    thanks

    It should be back by opening a Finder window, going to Finder menu (on the menu bar) > Preferences > Sidebar, and ticking "All My Files". It will show up in the Finder sidebar

Maybe you are looking for

  • Windows Server 2008 R2: "The update is not applicable to your computer"

    ALCON, I'm trying to install a "Windows Update Standalone Installer" file (Windows6.1-KB3032323-x64.msu) along with other .msu files and I keep getting the same message: "The update is not applicable to your computer".  The server is a virtual machin

  • Find Profit centers based on profit center group

    1)       If I know profit center group how to pick profit centers which belongs to that profit center group.the tcode is (KCH3) 2)       In the tree there may be many levels I mean for the profit center also contain other profit centers, just to disp

  • Finish to Finish isn't Being Enforced - Why?

    Hi All, I'm struggling...I have a task that needs to have a Finish to Finish (FF) relationship to a prior task because the task cannot finish before the first one finishes.  It was working fine until Actual Hours were entered. now the FF isn't being

  • Measurement point and counter SAP PM

    Hi SAP Guru I've one scenario in which we've to input counter reading smaller than the previous reading and some times bigger reading than previous reading for a single counter. It is because single counter is for Energy Meter which sometimes shows b

  • Using A Flash Drive To Boost RAM

    Hey all, I have several questions here. I do sound recordings with my Mac G4 Quicksilver, and need to do some upgrades to run different software. I currently have 10.3.9 but need to go as advanced as I can??? Please forgive my lack of knowlegde when