Pages '09: Can't use AppleScript for selected text inside tables?

When I run get selection on selected text in a Pages document, I get something like this:
<pre>text from character 1 to character 4 of body text of document id 9943974 of application "Pages"</pre>
When I run get selection on selected text inside a table cell in a table in a Pages document, I get something like this:
<pre>text from character 1 to character 4 of some table of document id 3539679 of application "Pages"</pre>
When I run get selection on selected text inside a table cell in ANOTHER table in the same Pages document, I get the exact same thing. It still says "some" table. So there is no way to distinguish between tables if there are more than one table in the same Pages document.
Am I correct in understanding that this means that most AppleScript commands for manipulating text are unusable inside table cells?
For example, it seems impossible to get the properties of the selection when the selection is selected text inside "some" table. So it's impossible do anything about text styles, etc.
Is AppleScript support in Pages ’09 really that limited, or am I missing something?

The first script below should return the character style of any selection made in Pages ’09, whereas the second script should apply the "XXX" character style to any selection:
--BEGINNING OF SCRIPT 1
tell application "Pages"
activate
tell application "System Events" to tell process "Pages"
-- Show the format bar:
if not (pop up button 1 of window 1 exists) then
click menu item "Show Format Bar" of menu 1 of menu bar item "View" of menu bar 1
end if
-- Show the styles drawer and character styles:
if menu item "Show Styles Drawer" of menu 1 of menu bar item "View" of menu bar 1 exists then
keystroke "t" using {shift down, command down}
end if
tell front window
tell checkbox 1 of group 1 of drawer 1 -- “Show or hide character styles.” checkbox
repeat until it exists
delay 0.1 -- wait until the styles drawer is open
end repeat
if description is "show character style" then click
end tell
-- Get the row index (although it is not a property) of the character style:
tell menu button 2 -- “Choose a character style.” menu button
click
set k to 0
repeat
set k to k + 1
if value of attribute "AXMenuItemMarkChar" of menu item k of menu 1 exists then exit repeat
end repeat
keystroke return -- hide the menu
end tell
-- Get the character style name:
if k > 1 then set k to k + 1
value of static text 1 of row k of outline 1 of scroll area 2 of splitter group 1 of group 1 of drawer 1
end tell
end tell
end tell
--END OF SCRIPT 1
--BEGINNING OF SCRIPT 2
set myStyle to "XXX" -- the name of the character style you want to apply
tell application "Pages"
activate
tell application "System Events" to tell process "Pages"
-- Show the format bar:
if not (pop up button 1 of window 1 exists) then
click menu item "Show Format Bar" of menu 1 of menu bar item "View" of menu bar 1
end if
-- Show the styles drawer and character styles:
if menu item "Show Styles Drawer" of menu 1 of menu bar item "View" of menu bar 1 exists then
keystroke "t" using {shift down, command down}
end if
tell front window
tell checkbox 1 of group 1 of drawer 1 -- “Show or hide character styles.” checkbox
repeat until it exists
delay 0.1 -- wait until the styles drawer is open
end repeat
if description is "show character style" then click
end tell
set characterStyles to value of static text 1 of rows of outline 1 of scroll area 2 of splitter group 1 of group 1 of drawer 1
set k to 0
repeat with thisStyle in the characterStyles
set k to k + 1
if thisStyle as text is myStyle then exit repeat
end repeat
-- Apply the character style:
if k > 1 then set k to k - 1
click menu button 2 -- “Choose a character style.” menu button
click menu item k of menu 1 of menu button 2
end tell
end tell
end tell
--END OF SCRIPT 2
I suppose that +paragraph styles+ should work the same.
I'm beginning to know Pages ’09 a little better now.
Message was edited by: Pierre L. (show format bar)

Similar Messages

  • How can I use applescript for OCR of a bunch of files - with Acrobat XI?

    Hi there,
    Iwant to write a script (eg applescript) that can be used as a droplet or has a menu to open a folder of scanned pdf-files to conduct OCR. And - I want to use Acrobat XI (as this is my version), German verison.
    As Acrobat XI is not recordable with the applescript-editor and I do not find a manual of objects and methods I googled a script that worked with Acrobat 9 but not with Acrobat XI. Here you define a "Action Assistant"-Script e.g. called "OCR this" and "click" the item. But as in Acrobat XI this Item is noch in the main-sbubmenu anymore it seems not to work.
    Here is a Screenshot:
    And this is theapplescrpt, tha opens the "Aktionsassistent":
    click the menu item "Aktionsassistent" of menu "Werkzeuge" of menu item "Werkzeuge" of menu "Anzeige" of menu bar item "Anzeige" of menu bar 1
    Butr then I cannot reach "OCR this".
    If any body has a hint - either for clicking "OCR this" or to sript  an OCR on an opened pdf.file with applescript this would be great.
    Thanks,
    Maritn

    AppleScript is documented in the Acrobat SDK. But there is no method for this.

  • Can I use Applescript for Scriptinh in Bridge?

    I use all of the CS2, but am new to scripting. From reading the Photoshop and InDesign Scripting guides I can see that I can use either Applescript or Javascript.
    But I cannot find any reference that indicates that Applescript can be used by Bridge.
    Is this correct?
    If Applescript IS an option, could someone please point me to a relevant reference?
    Thanks
    Mike

    AppleScript is not an option with CS2. I don't know about CS3 (beta of bridge provided with the Photoshop beta).
    Regards
    Bob

  • I was able to use one of my itunes songs for my ringtone but can I use one for my text tone?

    I was able to use one of my itune songs for a ringtone but I'd like to use one of my own songs for a text tone.  Is that possible?

    Welcome to the Apple Community.
    Enter the details of her second account at system preferences> mail, contacts & calendars.

  • Older ipod and can't use screen for selections

    I have tried number time to reboot my older ipod and can't get it to where the screen will react to touch
    rebooting doesn
    t seem to help

    Hi mikecpk,
    I recommend doing the troubleshooting assistant for your specific iPod from this page:
    iPod Troubleshooting Assistants
    http://www.apple.com/support/ipod/five_rs/
    Take care!
    - Ari

  • How can i use AME for the new OAF page.

    Dear all,
    I have developed a new OAF page and registered under Employee Self Service.
    How can i use AME for the approval process.
    Appreciate your ideas?
    zamora

    I will try to answer based on my experience of working with iProcurement and AME. It depends on how you want to make a call to AME , directly from OAF Page or from Workflow and your requirement. You didn't specify what you want to show the users on OAF Page and your business requirement.
    Before calling AME Engine from the OAF page or workflow, I guess you did already setup AME Transaction Type and it's Approval Groups, Conditions, Action Types and Rules. Do some testing from AME Business Analyst Test Workbench. Please note that, AME provides lot of PL/SQL API's that you have to call from your programs (java or workflow pl/sql)
    Let's look at the workflow and putting an OAF Page as notification.
    As Sameer said, you have kick-off workflow process from PR of CO and with in the workflow function, you make a call to AME Engine API's with the AME Transaction ID. This transactionId belongs to the AME Transsaction Type that you setup. Based on the rules setup, AME Engine generates list of approvers/approver and stores them AME Tables for that transactionId. Then, it sends a notification to the approver.
    In the workflow, where that notification is defined, in the message body you have to put an attribute(&XX_WF_FWK_RN) of type document/send. And this attribute will have the constant JSP:/OA_HTML/OA.jsp?OAFunc=XX_FUNC&paramId=-&DOCUMENT_ID-. This function is SSWA Jsp function that makes a web html call to your OAF Region.
    If your requirement is to just show the list of approvers on the OAF Page, you may have to call AME API diectly passing your AME TrasnactionId with other parameters. Then AME generates list of approvers and stores them in AME tables with each approver status. You can pickup those approvers using VO and show them on OAF Page.
    Hope this gives some idea.

  • Can i use iCloud for pages documents iMac?

    can i use iCloud for pages documents iMac?

    Hi lmdavis72,
    It looks like you can.
    From "iCloud: Documents in the Cloud overview"
    You can download a document from icloud.com/iwork to your Mac or Windows computer, edit it, and then drag the revised version to icloud.com/iwork. It’s then automatically updated on all of your iOS devices. You can also drag an iWork ’09 (Keynote, Pages, and Numbers) or Microsoft Office (PowerPoint, Word, and Excel) document created on your computer to icloud.com/iwork.
    So it looks like it can go between iOS devices and your iMac.
    ivan

  • How can I use a pic from iPhoto as a background for a page, How can I use a pic as a background for a page

    How can I use a pic from iPhoto as a background for a page, How can I use a pic as a background for a page

    cd,
    Insert the picture and position it as you desire
    Make sure the picture is set to Floating in the Wrap Inspector
    Arrange > Send Objects to Background
    Regards,

  • Drivers/Utilities CD..XP and VISTA..can I use vista for WIN7 64 bit install?

    Drivers/Utilities CD's, that came with the p-35 Motherboard..XP and VISTA..can I use Vista for WIN7 64 bit install, or download the chip set drivers for Awin7 BEFORE the OS install??
    MSI P-35 Platinum
    Q6600 Core 2 Quad
    Presently XP 32Bit
    NVidia geforce 8600GT
    8GB DDR2 SDRAM PC6400-800MHz
    Windows 7..waiting to be installed.
    Hello,
    I WANT TO DO A CLEAN INSTALL.I have Windows 32 Home XP, I have the Win7 OEM I want to install.
    When i bought my MSI mobo, it came with both the drivers and utilities for XP and Vista.   Can I use the chip set drivers and utilities for Vista, until i can go to MSI and download the latest chip set drivers?  When do i install these drivers....before the OS install, or after?
    Can I format these drives first, go in the BIOS change to boot sequence from Raptor Boot Drive to the DVD/Rom to boot the WIN7 from, or should I format while installing Win7?  
    Someone on another forum suggested that 1) disconnect the two droves, then install the OS on the boot drive, and2) before win7 install, make the proposed boot drive (NOT THE DVD/CD ROM the first choice priority for the boot sequence....is this right?
    Is it absolutely necessary to unplug the other two drives, while formatting and installing the WIN7 O.S.?  People tell me that there is a chance of the OS installing sometimes on the other drives.
    Also, if I want to change the now present boot drive Local disk letter (C) to my storage drive (G) and the other two drive letters, can I do this in manage disks, anytime, or only during windows setup install?
    Thx

      I've never had this much trouble hooking up a HDD.
           I have two IDE DVD/CD ROMS.  (My RAID MODE was IDE in XP OS, and still is with WIN7.)
           I have three SATA HDD's.
    After unplugging the SATA 2TB HDD while I installed the WIN7 OS on the 500 GB HDD (it was on the 74 RAPTOR, but I moved location, and made absolutly sure nothing went on my raptor)
      So today I decided to re-hook up the 2TB Storage HDD, and when I did, I went into bios,and to the cell menu, and LOAD ALL DEFAULT SETTINGS, so it could see my newly installed HDD,which I had all my backup Data from the previous HDD. I also checked and the RAID MODE was IDE, and the boot sequence was the WDC 500GB Boot/OS drive, rebooted,then I got that annoying blanked out screen with that blinking cursor, so I got back into the bios,and changed the 1st boot to the IDE Pioneer DVD/CD ROM, 2nd boot to the 500GB HDD, and rebooted again..still got that blinking cursor.
    I opened up the Mobo, checked and replugged all SATA, and power cables to the three HDDS, tried it again,then still got the blinking cursor.  Seems no matter what I change in the boot sequence,it never wants to boot properly
    ....AND THEN,
     I started with TAB > POST> started WINDOWS, then once it opened up, I went to manage Disks, saw all three HDDs were online and healthy.  Win. Explorer also listed them in that folder, in device manager, it listed all three too.
     The managed window showed this:
    74GB    (system,active,Primary partition)                       Storage
    2TB     (Primary partition)                                           Excessive Storage
    500GB  (Boot, page files,crash-Dump, Primary partition)   Operating system
    Both the PCI IDE BusMaster and ON-Chip SATA Controller were both ENABLED.
    Before I just got online, I tried RESTART, and it opened Windows the usual way,  so I hope I don't have any more problems. It worked fine BEFORE I just plugged in the 2TB HDD back in.
    I pretty much did what everyone suggested,except for leaving in the 74GB Raptor when I installed WIN7, which prompted me to format the drive prior to installing the OS.  Also, when I changed the IDE, RAID,and AHC1, to the AHC1 Mode, just before I installed Window7, like a few suggested, I also had problems, so after the install, I went back and changed it back to IDE.  My Floppy was an IDE, but I removed it from my system, and disabled in BIOS, but even a few times I went into Bios and saw that thje floppy was 1st Boot, even though I changed to either the DVD/CD Rom, or the 500GB boot drive.            
    So what is the preferred boot sequence?   

  • When i plug in my charger to my macbook and have it charged all the way i can only use it for an hour before it dies on me again. what is wrong with my macbook? what can i do to fix it?

    when i plug in my charger to my macbook and have it charged all the way i can only use it for an hour before it dies on me again. what is wrong with my macbook? what can i do to fix it?

    Go to the Apple in the upper left corner and select About This Mac, then click on More Info (and then System Report in 10.7), then select Power from the left hand column of the System Profiler. Copy and paste the Battery Information back here.
    Also it would help to know which one of the 9 different models of MacBook you have. To see which model you have go to the Apple in the upper left corner and select About This Mac, then click on More Info (and then System Report in 10.7).When System Profiler comes up check the Model Identifier.

  • Why I Can't use procedure in select statement

    Why I Can't use procedure in select statement

    We can use function in select statement but we couldn't use procedure with one out parameters in select statement... You can use Function because they are designed for this but procedure are not. Functions can return value (without OUT parameter) which can be used in SELECT whereas procedures do not have such concept. As you can see in the above post you can not call even functions also if it has any out parameter.
    I have just trying to use procedure in select statement ..for this I require technical answer..The technical answer is because conceptually procedure is for doing set of operation, performning DMLs on the tables , whereas functions are for processing and producing a single result. Functions are basically for not using INSERT/UPDATE/DELETE in it. That is the reason they are allowed to be used in SELECT because conceptually they are not supposed to do any data changes.
    Regards,
    Avinash

  • How to use offset for select-option parameter ?

    Hi experts
    could anybody please let me know how to use offset for select-option parameter. i can able to use offset for table fields, variabiles and all , but don't know how to use for parameters.
    following is my code
    SELECT-OPTIONS: s_prctr  FOR vbsegs-prctr OBLIGATORY.
    here "prctr"  length is 10.
    i'm using two tables  1. vbsegd-bupla
                                    2. vbsegs-prctr
    here prctr+6(4) = bupla.
    "Bupla" length is 4
    SELECT belnr gjahr bukrs bupla sgtxt buzei FROM vbsegd INTO CORRESPONDING FIELDS OF TABLE it_vbsegd FOR ALL ENTRIES IN it_vbkpf
                                                                 WHERE belnr = it_vbkpf-belnr
                                                                   AND gjahr = it_vbkpf-gjahr
                                                                   AND bukrs = it_vbkpf-bukrs
                                                                   AND bupla IN s_prctr.  
    the above statement is not working as prctr and bupla lenths are different. here i want to use offset.
    SELECT belnr gjahr bukrs prctr sgtxt buzei FROM vbsegs INTO CORRESPONDING FIELDS OF TABLE it_vbsegs FOR ALL ENTRIES IN it_vbkpf
                                                                WHERE belnr = it_vbkpf-belnr
                                                                  AND gjahr = it_vbkpf-gjahr
                                                                  AND bukrs = it_vbkpf-bukrs
                                                                  AND prctr IN s_prctr.
    this is working as prctr and s_prctr lengths are equal.
    could anybody please help me out in this.
    Thanks in advance.
    regards
    satish

    Below code will work for you.
    SELECT-OPTIONS: s_prctr  FOR vbsegs-prctr OBLIGATORY.
    RANGES: s_bupla FOR vbsegd-bupla.
    s_bupla[] = s_prctr[].
    DELETE ADJACENT DUPLICATES FROM s_bupla.
    SELECT belnr gjahr bukrs bupla sgtxt buzei FROM vbsegd INTO CORRESPONDING FIELDS OF TABLE it_vbsegd FOR ALL ENTRIES IN it_vbkpf
                                                                  WHERE belnr = it_vbkpf-belnr
                                                                    AND gjahr = it_vbkpf-gjahr
                                                                    AND bukrs = it_vbkpf-bukrs
                                                                    AND bupla IN s_bupla.

  • Create new tag for selected text using API?

    Hello,
    I want to add new tag for the selected text just like 'Create Tag from selection' .
    is it possible to create tag for selected text using acrobat api?
         please,help me.

    As per sample of snippetRunner for adding tag for selected text.
    I tried below code
    PDPage pg;
    AVDoc avDoc = AVAppGetActiveDoc();
    PDDoc pd = AVDocGetPDDoc(avDoc);
        pg = PDDocAcquirePage(pd, 0);
    ASAtom theSelectionType = AVDocGetSelectionType(avDoc);
    if (theSelectionType == ASAtomFromString("Text")){
        PDTextSelect ts = static_cast<PDTextSelect>(AVDocGetSelection(avDoc));
        PDSTreeRoot pdsTreeRoot;
        CosObj pageObj = PDPageGetCosObj (pg);
        PDSElement newElem;
        PDSElementCreate(pd, &newElem);
        char buf1[64];
        strcpy (buf1, "A new structure element");
        // set its type as "Document" standard type
        PDSElementSetType(newElem, ASAtomFromString ("Document"));
        // set its title
        PDSElementSetTitle(newElem, reinterpret_cast<const ASUns8*> (buf1), strlen(buf1));
        PDSTreeRootInsertKid (pdsTreeRoot, aElem, kPDSAfterLast);
        PDSElementInsertMCAsKid // here something i have to add
    If i have PDTextSelect how i can add tag for selected text.like user add tag using "CreateTagForSelectedText" option.
    please,help me.
    thanks.

  • Can not use 'AT LINE-SELECTION' with SET PF-STATUS

    Hi experts,
    my code is like below:
    PARAMATERS: .....
    SET PF-STATUS 'st_nam'.
    Perform Load_data . ' For list display
    START-OF-SELECTION.
    AT LINE-SELECTION.
      Perform list_detail.
    AT USER-COMMAND.
      CALL SCREEN '1001'.
    END-OF-SELECTION.
    When I execute the report , the basic was displayed , but when then i double click on the list to call the next screen '1001'. It did not work , but if i omit the SET PF-STATUS m AT LINE-SELECTION worked week , so in this case what has happened i how can i solve this problem,
    Thaks,
    PS: Reward immediately

    Hi,
    Thank you very much for your helpful answers, I have copied the report downto my system and test it , When i used SET PF-STATUS , i can not use AT LINE-SELECTION to capture events ...May be we can not use these 2 statements in parallel,...:D
    Thanks,

  • Can you use wallpapers for the icons on the iphone 3g? If so, How

    Can you use wallpapers for the icons on the iphone 3g? If so, How

    On the Mac to save a picture from a web page <CTRL> click on the picture then choose Save Image As... and save it onto the desktop. Once you have collected all your pictures onto the desktop open iPhoto and Import all the images into an iPhoto Album. Quit iPhoto.
    Open iMovie, then go to the Toolbar along the right side of the iMovie window and click on the camera icon to browse through your iPhoto Library. Find your pictures then drag them into the Project Browser window.

Maybe you are looking for