Can I use applescript to export PDF search results from "preview"?

My question is about "Preview". I have a very large PDF document that I am using preview to view. After doing a search for a specific word, preview has returned 1200 results. The results panel shows the page number the result is found on and the line of text on which the searched-for-word is found.
My question is this: Is there a way to export this information from preview to something like an excel file? The end result would look like a table with two columns. One with the page numbers and one with the line of text in which the word appears.
Is this something that can be done with applescript? I don't know if the system even stores that kind of information... /sigh. Any help is appreciated.

Using Preview.app, I have done a search for the word “AppleScript” in the PDF version of the AppleScript Language Guide. Then, I have used the following script to retrieve the information displayed in the results panel.
tell application "Preview" to activate
tell application "System Events" to tell process "Preview"
return value of text field 1 of rows of outline 1 of scroll area 2 of splitter group 1 of window 1
end tell
--> {missing value, "AppleScript Language Guide (Page 1)", "AppleScript Language Guide (Page 1)", "Contents (Page 4)", "Contents (Page 4)", "Contents (Page 9)", "Figures, Tables, and Listings (Page 11)", "Figures, Tables, and Listings (Page 11)", "Introduction (Page 14)", "Introduction (Page 14)", "Introduction (Page 15)", "Introduction (Page 16)", "AppleScript Lexical Conventions", "Identifiers", "Keywords", "Literals and Constants", "Record", "Variables", "Statements", "Raw Codes", "AppleScript Fundamentals", "Script Editor Application", "What Is in a Script Object", "Properties", "What Is in an Object Specifier", "Absolute and Relative Object Specifiers", "Object Specifiers in Reference Objects", "Coercion (Object Conversion) (Page 32)", "Coercion (Object Conversion) (Page 32)", "Scripting Additions", "Types of Commands", "Parameters That Specify Locations", "AppleScript Constant", "text item delimiters", "version", "true, false Constants", "The it and me Keywords", "Specifying Paths", "Working With Files", "eppc-Style Specifiers", "Debugging AppleScript Scripts", "Third Party Debuggers", "Defining Properties", "Local Variables", "Using the copy and set Commands", "Scope of Variables and Properties", "Scope of Properties and Variables Declared in a Script Object (Page 54)", "Scope of Properties and Variables Declared in a Script Object (Page 54)", "Scope of Properties and Variables Declared in a Script Object (Page 55)", "Scope of Variables Declared in a Handler", "Script Objects", "Defining Script Objects", "Initializing Script Objects", "Inheritance in Script Objects", "Defining Inheritance Through the parent Property", "Using the continue Statement in Script Objects (Page 63)", "Using the continue Statement in Script Objects (Page 63)", "Defining a Simple Handler", "Handlers with Labeled Parameters", "Handlers with Patterned Positional Parameters", "Recursive Handlers", "Calling Handlers in a tell Statement", "Saving and Loading Libraries of Handlers", "idle Handlers", "Calling a Script Application From a Script", "alias", "application (Page 80)", "application (Page 80)", "boolean (Page 83)", "boolean (Page 83)", "class", "constant", "date (Page 87)", "date (Page 88)", "integer", "list (Page 91)", "list (Page 91)", "real", "record (Page 95)", "record (Page 95)", "script", "text (Page 98)", "text (Page 99)", "text (Page 100)", "text (Page 101)", "text (Page 102)", "unit types", "Commands Reference (Page 107)", "Commands Reference (Page 107)", "activate", "ASCII number", "copy", "count", "display dialog (Page 127)", "display dialog (Page 127)", "do shell script", "get", "get eof", "launch", "open for access", "path to (application)", "run", "run script", "say", "set (Page 155)", "set (Page 155)", "summarize", "system info", "write", "Arbitrary", "Filter (Page 169)", "Filter (Page 169)", "ID", "Index", "Middle", "Operators Reference (Page 179)", "Operators Reference (Page 181)", "Operators Reference (Page 181)", "Operators Reference (Page 182)", "Operators Reference (Page 183)", "Operators Reference (Page 184)", "Operators Reference (Page 185)", "Operators Reference (Page 186)", "text (Page 102)", "Examples", "date (Page 87)", "considering / ignoring (text comparison) (Page 194)", "considering / ignoring (text comparison) (Page 194)", "considering / ignoring (application responses)", "error Statements", "error", "if (compound)", "exit", "repeat (forever)", "repeat until", "repeat while", "repeat with loopVariable (from startValue to stopValue)", "repeat with loopVariable (in list)", "tell Statements", "tell (compound)", "try (Page 208)", "try (Page 208)", "using terms from Statements", "with timeout", "with transaction", "continue", "return", "Handler Syntax (Labeled Parameters)", "Calling a Handler with Labeled Parameters (Page 217)", "Calling a Handler with Labeled Parameters (Page 217)", "Handler Syntax (Positional Parameters)", "Folder Actions Reference", "adding folder items to", "closing folder window for", "opening folder", "removing folder items from", "Appendix A: AppleScript Keywords (Page 227)", "Appendix A: AppleScript Keywords (Page 228)", "Appendix A: AppleScript Keywords (Page 229)", "Appendix A: AppleScript Keywords (Page 231)", "Appendix A: AppleScript Keywords (Page 231)", "Appendix A: AppleScript Keywords (Page 232)", "AppleScript Errors", "Operating System Errors", "Catching Errors in a Handler (Page 238)", "Catching Errors in a Handler (Page 238)", "Simplified Error Checking", "When a Dictionary Is Not Available", "Entering Script Information in Raw Format", "List of Unsupported Terms", "Glossary (Page 245)", "Glossary (Page 246)", "Glossary (Page 247)", "Glossary (Page 249)", "Glossary (Page 249)", "Glossary (Page 250)", "Revision History", "Symbols", "B (Page 254)", "B (Page 254)", "G", "I", "M", "R", "S"}
Many items don't have any page number. Is that what you are asking for?

Similar Messages

  • Searching paragraphs using automator and deleting the search results from the original body of text

    How do I search paragraphs of a text document using automator and then have the search results deleted from the text document after those search results are exported to a textedit document?

    How do I search paragraphs of a text document using automator and then have the search results deleted from the text document after those search results are exported to a textedit document?

  • Can I use applescript to export a PDF file from keynote?

    I use keynote to create documentation. Once complete I export the keynote to a PDF and then package the pdf into an adobe acrobat reader portfolio. I desperately need to script this process. Is it possible to export a PDF from keynote via applescript? The second 1/2 is can I tell acrobat reader to import files into a portfolio. Thanks much for any help.

    I believe this is one of the few things Applescript can accomplish with Keynote '09. You can send keyboard short-cuts to Menu Commands in an Applescript – so you can just send a Cmd-P to KN'09. As for setting the Print/PDF options not sure but the dialogue remembers previous settings so you'd only have to set once at most per batch of slideshows. Post on Applescript thread to get specific scripting advice or Applescript developers email list.
    Applescript Discussion
    Applescript List

  • Use of Adobe Export PDF on more than one computer

    Can I use my Adobe Export PDF on both my home & work computers without haveing to purchase an additional Adobe Export PDF?

    Thanks.  Figured it out today and used it at work.
    pranavj <[email protected]> wrote:
    pranavj http://forums.adobe.com/people/pranavj created the discussion
    "Re: Use of Adobe Export PDF on more than one computer"
    To view the discussion, visit: http://forums.adobe.com/message/4706958#4706958

  • Can I use Bridge to export image data into a .txt file?

    I have a folder of images and I would like to export the File Name, Resolution, Dimensions and Color Mode for each file into one text file. Can I use Bridge to export image data into a .txt file?

    Hello
    You may try the following AppleScript script. It will ask you to choose a root folder where to start searching for *.map files and then create a CSV file named "out.csv" on desktop which you may import to Excel.
    set f to (choose folder with prompt "Choose the root folder to start searching")'s POSIX path
    if f ends with "/" then set f to f's text 1 thru -2
    do shell script "/usr/bin/perl -CSDA -w <<'EOF' - " & f's quoted form & " > ~/Desktop/out.csv
    use strict;
    use open IN => ':crlf';
    chdir $ARGV[0] or die qq($!);
    local $/ = qq(\\0);
    my @ff = map {chomp; $_} qx(find . -type f -iname '*.map' -print0);
    local $/ = qq(\\n);
    #     CSV spec
    #     - record separator is CRLF
    #     - field separator is comma
    #     - every field is quoted
    #     - text encoding is UTF-8
    local $\\ = qq(\\015\\012);    # CRLF
    local $, = qq(,);            # COMMA
    # print column header row
    my @dd = ('column 1', 'column 2', 'column 3', 'column 4', 'column 5', 'column 6');
    print map { s/\"/\"\"/og; qq(\").$_.qq(\"); } @dd;
    # print data row per each file
    while (@ff) {
        my $f = shift @ff;    # file path
        if ( ! open(IN, '<', $f) ) {
            warn qq(Failed to open $f: $!);
            next;
        $f =~ s%^.*/%%og;    # file name
        @dd = ('', $f, '', '', '', '');
        while (<IN>) {
            chomp;
            $dd[0] = \"$2/$1/$3\" if m%Link Time\\s+=\\s+([0-9]{2})/([0-9]{2})/([0-9]{4})%o;
            ($dd[2] = $1) =~ s/ //g if m/([0-9 ]+)\\s+bytes of CODE\\s/o;
            ($dd[3] = $1) =~ s/ //g if m/([0-9 ]+)\\s+bytes of DATA\\s/o;
            ($dd[4] = $1) =~ s/ //g if m/([0-9 ]+)\\s+bytes of XDATA\\s/o;
            ($dd[5] = $1) =~ s/ //g if m/([0-9 ]+)\\s+bytes of FARCODE\\s/o;
            last unless grep { /^$/ } @dd;
        close IN;
        print map { s/\"/\"\"/og; qq(\").$_.qq(\"); } @dd;
    EOF
    Hope this may help,
    H

  • On a Mac ios10.10, using online service Export PDF, error message appears,"An error occurred while trying to access service."

    Can you advise steps I might take now?  On a Mac ios10.10, using online service Export PDF, error message appears,"An error occurred while trying to access service."

    Hi Ringdoc,
    Please see this document: "Error occurred when trying to access this service" when logging on to Acrobat.com
    Let us know how it goes!
    Best,
    Sara

  • Can we use IF statement in PDF templates

    Hi,
    I developed a PDF template. I need to underline ang bold the records based on a specific condition. Can we use IF conditon in PDF templates. Please suggest.
    Thanks...

    Billy  Verreynne  wrote:
    The case syntax is a bit funny though as there's not a single condition evaluation (like a DECODE or case structs from some other languages).
    This is what I would expect a typical case struct to look like - evaluating a single condition:
    case <condition>
    when <value-1> then return <result-1>
    when <value-n> then return <result-n>
    else
    return <return-z>
    end
    ?:| You mean like this...?
    SQL> ed
    Wrote file afiedt.buf
      1  select empno, ename, deptno
      2        ,case deptno
      3           when 10 then 'This is Department 10'
      4           when 20 then 'And department 20'
      5           when 30 then 'And of course department 30'
      6         else
      7           'Blimey it is something else!'
      8         end as dept_desc
      9* from emp
    SQL> /
         EMPNO ENAME          DEPTNO DEPT_DESC
          7369 SMITH              20 And department 20
          7499 ALLEN              30 And of course department 30
          7521 WARD               30 And of course department 30
          7566 JONES              20 And department 20
          7654 MARTIN             30 And of course department 30
          7698 BLAKE              30 And of course department 30
          7782 CLARK              10 This is Department 10
          7788 SCOTT              20 And department 20
          7839 KING               10 This is Department 10
          7844 TURNER             30 And of course department 30
          7876 ADAMS              20 And department 20
          7900 JAMES              30 And of course department 30
          7902 FORD               20 And department 20
          7934 MILLER             10 This is Department 10
    14 rows selected.

  • Can I Use OLE2 to export Excel without having excel?

    Dear all,
    Can i use CLIENT_OLE2 to export from a form to an excel sheet without having the Microsoft excel installed on the AS (Application server)?
    Thanks
    $hOoO$h

    Dear SHo0o0sh;
    yes u can run it on client side but the client must have Microsoft office
    like this :
    PROCEDURE init_excel (application in out client_ole2.obj_type ,
    workbooks in out client_ole2.obj_type ,
    workbook in out client_ole2.obj_type ,
    worksheets in out client_ole2.obj_type ,
    worksheet in out client_ole2.obj_type )IS
    args client_ole2.list_type;
    begin
    application:=client_ole2.create_obj('EXCEL.APPLICATION');
    workbooks:=client_ole2.get_obj_property(application,'workbooks');
    args:=client_ole2.create_arglist;
    client_ole2.add_arg(args,1);
    workbook:=client_ole2.get_obj_property(workbooks,'add',args);
    client_ole2.destroy_arglist(args);
    worksheets:=client_ole2.get_obj_property(workbook,'worksheets');
    worksheet:=client_ole2.get_obj_property(worksheets,'add');
    write_cell(worksheet , cell , 1 ,1 ,'your data');
    write_cell(worksheet , cell , 1 ,2 ,'your data');
    release_excel (application,
    workbooks,
    workbook ,
    worksheets ,
    worksheet);
    end;
    PROCEDURE write_cell (worksheet client_ole2.obj_type,
    cell in out client_ole2.obj_type,
    x number , y number , text varchar2) IS
    args client_ole2.list_type;
    BEGIN
    args:=client_ole2.create_arglist;
    client_ole2.add_arg(args,x);
    client_ole2.add_arg(args,y);
    cell:=client_ole2.get_obj_property(worksheet,'cells',args);
    client_ole2.destroy_arglist(args);
    client_ole2.set_property(cell,'value',text);
    client_ole2.release_obj(cell);
    END;
    Hope it works.
    Regards
    Reda El Mitwally

  • How can I use Applescript to copy a file's icon to the clipboard?

    Hello,
    How can I use Applescript to copy a file's icon to the clipboard?
    Thanks.
    Lennox

    there is no way to do that that I know of. but you can extract an icon of a file to another file using command line tool [osxutils|http://sourceforge.net/projects/osxutils]. you can then call the relevant command from apple script using "do shell script".

  • How can I use AppleScript Studio to display an image

    How can I use AppleScript Studio to display an image in a dialog?

    Add an image well to your window in Interface Builder.
    You can also add an image file to the Resources group of your Xcode project and then set the image to be displayed inside the image well directly in Interface Builder. No AppleScript code is needed if the image is contained within your app bundle and can be set ahead of time like this.
    If the image is contained in your app's bundle but you need to set or change the image at run time then you can use a line of AppleScript to load it into the image well using just it's filename:
    set image of image view "yourImageView" of window "yourWindow" to load image "YourImageFile.jpg"
    If you need to load an image from an arbitrary location outside your app's bundle then use a path to the image file...
    set image of image view "yourImageView" of window "yourWindow" to load image "/path/to/YourImageFile.jpg"
    Steve

  • When I use Preview my computer locks up. Can't use it to view PDFs. Any ideas?

    When I use Preview my computer locks up. Can't use it to view PDFs. Any ideas?
    I try to save files as a PDF on external hard drives. When I select SAVE AS PDF I get spinning colorwheel and the program I am using locks (Quicken, Quickbooks, Gmail etc.)

    There were several /Library/preferences. The only one that had the file was the one under my user name. I deleted it. I was using Quickbooks when the problem started. It is locked. I have to reboot the computer to use it again. I tried SAFARI using the PRINT button then SAVE AS PDF. It didn't work. It locks Safari up. I will reboot and hopefully continue.
    P.S. I've done this procedure before and I was able to Save, but then the problem came back.

  • Anyone using PDDocExportUserProperties for exporting PDF to XML

    Hi,
    Anyone using PDDocExportUserProperties for exporting PDF to XML. I am using Adobe PDFL 9.0 to do the same. However, do not find any sample programs or tutorials.
    Please anyone have any samples, do provide.
    -Abhi

    > PDDocExportUserProperties
    Where did you find this method? It's not listed in the PDFL API Reference for 8.1 or 9.

  • I try to open a PDF file but it will not. What can i use to read a PDF file.

    What can i use to read a PDF.

    1. Install free Adobe Reader App.
    2. Hold down attachment and "Open In" Adobe Reader
    http://i1224.photobucket.com/albums/ee374/Diavonex/fb20a68a.jpg

  • Export PCUI search result to Excel over Context Menu / right mousebutton

    Hello
    I am using CRM 5.0 and PCUI
    I want to export the search result into Excel, on Servicetickets (BUS2000116). When i press the right mousebutton on the searchresult, I get the option Export to Microsoft Excel.
    When i choose this option, Excel opens and i get the error message "Unable to open ......./mainDH.do. The Internet site reports that a connection was established but the data is not available."
    and the cell A1 says ExternalData_1.
    In Thread Export PCUI search result to Excel, Manuel Rodriguez told "Standard Export to excel is avaible in PCUI 5.0 and dont works in PCUI 4.0.". But I still can't make it work.
    Anybody an Idea how I can do it work ???
    Best regards
    Thomas

    Hi Thomas,
    you should not use the right click and Export to Excel. I think this is a functionality of Internet Explorer for HTML Tabes. Using that functionality you will only get the actual table exported. Do you see the Button "Download" in the Toolbar? That's the export to Excel functionality introduced in CRM 5.0.
    Regards
    Gregor

  • TS1741 Can u use home sharing whilst u are away from home

    Can u use home sharing whilst u are away from home

    Oh, so is THAT where the name "HOME SHARING" comes from? 

Maybe you are looking for

  • My downloaded tv shows will not show up on iTunes

    I bought a season of heros last night and this morning I only see 20 out of 23 episods that are listed under my iTunes. Then I look on support and it asked me to go to Stores menu and then click on "Check Purchases" which I did, and it tells me that

  • Skype BSOD/AMD Driver crashing.

    Hi, I have an isse with skype causing problems. When I start skype, the AMD display driver crashes. The screen goes black for a few seconds. Now, after that there are no issues until someone tries to call me or I try to call someone else. Upon making

  • Change Language in Layout/panels

    I have subscripted to Adobe Cloud and downloaded Photoshop/Illustrator/InDesign. The default language at this time is Danish. How can I change the language to English in layout/panels? Thank you =) Mette

  • Best approach to upgrade MaxDB AND move to new OS release

    What would be the best approach to upgrade Contentserver MaxDB 7.5 on W2K server (32-Bit) to MaxDB 7.7 on Windows 2008 Server x64 (R2?)? 1.  a) Upgrade MaxDB on the existing installation      b) Create a complete backup      c) Install latest release

  • No sound on net!

    I can get iTunes to play, all of my system sounds play, yet I can't get sound from either Safari OR Mozilla Firefox. I've checked all the settings I can find, but for some reason I still can't get sound from anything internet related (youtube, music