Using AppleScript for launch a raw-query Spotlight search?

As per usual with my limited scripting skills, I am finding the apparently simple stuff rather difficult to achieve.
My problem with Spotlight is that I want to use the same type of raw query repeatedly, but I want to avoid the tedium of having to:
1) open my saved search
2) choose "Show Criteria" to make the saved raw query visible
3) edit the text field containing the raw query, where the visible stuff is not what I want to edit, so I have to scroll to the right within that tiny field
So my idea would be to design a simple UI with AppleScript that
1) pops up a dialog asking for a phrase to search
2) launches a Spotlight search using the raw query:
kMDItemTextContent=="xxx*"
where "xxx" is the phrase that I am searching for, and opens a Finder window with the results of that search.
My reason for wanting to do this is that, by default, a search for an exact phrase with Spotlight fails to return matches that contain the plural form when the searched phrase is a singular.
See:
http://www.betalogue.com/2010/05/07/spotlight-plural/
http://www.betalogue.com/2010/05/11/spotlight-phrase/
for more information about the background for this.
Would this be relatively easy to do with AppleScript?
Thanks in advance.
Pierre

Hi
Pierre Igot wrote:
Am I correct in assuming that this means that what I wanted could not just be achieved with AppleScript and required a Perl script?
Message was edited by: Pierre Igot
A smart folder is an XML file (PLIST), you can edit it in many ways.
It's possible with other shell commands (sed or awk).
But perl works seamlessly with extended characters (ASCII > 127)
Also it's possible with AppleScript commands (open for access, read, write, close access), or with *property list file* in System events
But it requires more lines of code.
Here's the script :
global a_text
set smartFolder to "/Users/jack/Library/Saved Searches/Recherche dans “Bureau”.savedSearch"
set a_text to text returned of (display dialog "Enter a phrase to search" default answer "")
if a_text contains """ then
set a_text to findAndReplace(""", "\"", a_text)
end if
tell application "System Events"
set TheXML to property list file smartFolder
repeat with i in (get property list items of contents of TheXML)
set t_name to name of i
if t_name is "RawQuery" then
tell i to set value to my replace_text(get value)
else if t_name is "SearchCriteria" then
tell property list item 2 of property list item "displayValues" of property list item 1 of property list item "FXCriteriaSlices" of i to set value to my replace_text(get value)
else if t_name is "RawQueryDict" then
tell property list item "RawQuery" of i to set value to my replace_text(get value)
end if
end repeat
end tell
set smartFolder to ((POSIX file smartFolder) as alias)
tell application "Finder"
activate
open smartFolder
end tell
on replace_text(t)
set x to the offset of "kMDItemTextContent==" in t
set L to length of t
repeat with i from L to 1 by -1
if character i of t = """ then
set y to i
exit repeat
end if
end repeat
return (text 1 thru (x + 20) of t) & a_text & (text y thru -1 of t)
end replace_text
on findAndReplace(tofind, toreplace, t)
set ditd to text item delimiters
set text item delimiters to tofind
set t to text items of t
set text item delimiters to toreplace
set t to t as string
set text item delimiters to ditd
return t
end findAndReplace

Similar Messages

  • Using AppleScript to launch an application on a different machine

    Hi there,
    I'm trying to use AppleScript to enable a couple of my Macs to talk to each other.
    On one machine, I want to use this script:
    tell application "Finder" of machine "eppc://user:[email protected]"
    launch application "Rivet" of machine "eppc://user:[email protected]"
    end tell
    to have the other machine launch Rivet, a video server that I can access from the PS3/iPhone/iPad
    everything seems to work without issue (i.e. no errors), except it doesn't do anything.
    I see a line written to the console on "helium":
    9/23/10 18:48:30 com.apple.AEServer[3535] launchproxy[3535]: /System/Library/Frameworks/CoreServices.framework/Frameworks/AE.framework/Versi ons/A/Support/AEServer: Connection from: xxx:xxx:xxx:xxx:xxx:xxx%en0 on port: 60571
    every time I run the script on the other machine, but, like I said, nothing else happens.

    After much searching and trial and error I finally discoverd Hiroto's suggestion from way back in 2001. It is the only solution I have found that actually works to launch/activate any application on a remote Mac using an applescript on a local Mac.
    I have one Mac Mini running household control applications Indigo and iRed. I wanted to use embedded AppleScripts in those applications to launch and control PandoraBoy on another MacMini that I use as a media center. I discovered that you cannot activate an application on a remote Mac unless it's already running. (Only God and Apple know why!) And, of course, if you want to launch and application--it's usually NOT running!
    But the following works:
    set remoteMachine to "eppc://RemoteMachineName:[email protected]"
    tell application "Finder" of machine remoteMachine
    open ("/Applications/PandoraBoy.app" as POSIX file as alias)
    end tell
    THANK YOU HIROTO!!!
    Once the remote app is actually launched/activated you can then send AppleScript commands to it as follows:
    set remoteMachine to "eppc://RemoteMachineName:[email protected]"
    using terms from application "PandoraBoy"
    tell application "pandoraboy" of machine remoteMachine
    playpause
    end tell
    end using terms from
    I have also learned that the application to be controlled on the remote machine must also be present on the local machine and "using terms from" must also be used in the control script for this to work.

  • Using Applescript for uploading pictures on the Internet

    Hello!
    I was wondering if there was a way to use Applescript with Firefox (or another browser)...?
    We have many many villas on our website, each one with lots of pictures. We are constantly adding new villas to our site and amending old ones.
    To add pictures we go to a page in our cms for each villa, located there is a drop down menu - image 1, image 2, 3 etc etc etc
    For each one we have to manually browse for and attach the photo. As you can guess this is a time consuming process, we have asked the web designer before for this but he is so busy and we have other more important stuff for him to be working on.
    As Applescript is so nifty I was wondering if anybody had an idea on how to use it for this process - i.e. have a folder full of pictures on the desktop and Applescript can add them?
    I have no idea if this is possible, any ideas?
    Many thanks and regards.
    Simon

    Yeah I completely understand, I just wanted to see if anybody knew if it could be done.
    Obviously for security reasons I can't let anybody into our CMS, so looks like it's a bit of an impossible task.
    Although it would be awesome to simply change the script slightly for each villa and let it do it all, this would be stupidly complicated as there are many menus to navigate to get to the uploading picture area.
    It would be great if I could do all that manually then once on that page (or given the page url to Applescript) set Applescript running to upload all the images for me.
    This is what that page looks like, if this helps?!:
    http://img535.imageshack.us/img535/241/screenshot20100415at141.png
    The drop down menu contains:
    Villa Plan
    Small Location Map
    Image Gallery 1
    Image Gallery 2
    etc
    etc
    I could arrange a folder with the pictures in order (i.e. Villa Plan first, then Small location Map, then the picture for 1 etc) so no worries about the Villa Plan and location map.
    I've got a feeling I'm just going to have to do it manually (I shall forever be uploading pictures), but I thought I would give it to some of you geniuses to mull over!
    For whoever creates a script I'll give you a discounted stay in Paradise... there's an incentive!!
    Many thanks and regards,
    Simon

  • How to find and replace using AppleScript for TextWrangler?

    I ran into a problem after exporting my book into EPUB from Indesign CS4. In this book the Latin diphthong æ is used. Unfortuately it didn't translate very well into the EPUB or corresponding XHTML files. Is there a way to do a batch change using AppleScript to change these symbols √¶ into æ which is the code for the diphthong? If so, how?
    I also have an issue with the symbol †, in some of the documents it appears as this ‚Ć. Can I do a batch change for that as well? If so, how?
    I'm new to using AppleScript so I appreciate all of the help. Thank you so much!!

    Hello
    Here's some observations -
    æ = U+00E6
    = <c3 a6> (UTF-8)
    = <c3 a6> (MacRoman) = æ
    † = U+2020
    = <e2 80 a0> (UTF-8)
    = <e2 80 a0> (MacRoman) = †
    which likely mean that your source data is text in UTF-8 but destination (or viewer or intermediate converter) is interpreting the data as text in MacRoman.
    Make sure you properly declare the encoding of XHTML or EPUB document as UTF-8.
    Good luck,
    H

  • Using AppleScript to Launch Excel VBA Macro

    Using MS Office 2004 and AppleScript 1.9.3. I want to use AppleScript in MS Entourage to kick off a VBA macro in Excel. But no luck.
    To test things, I created an Excel file ("test.xls") with a one-line VBA macro named "test." It just puts up a dialog box with the message "success." I'm calling it from A.S as follows (per the AppleScript Dictionary for Excel 2004):
    tell application "Microsoft Excel"
    run VB macro "hard disk:users:xxx:desktop:test.xls!test"
    end tell
    I get two successive error messages:
    1. 'test.xls' cannot be accessed. The file may be read-only or you may be trying to access a read-only location."
    2. "Microsoft Excel got an error: "hard disk:users:xxx:desktop:test.xls!test" doesn't understand the run VB macro message."
    "test" file permissions are -rw-r--r-- and it is sitting right on the desktop.
    FWIW, I did not remove the old Office vX yet, but renamed old Excel "Microsoft ExcelOld". I read on some other site that this may cause problems.
    This has been endlessly frustrating. HELP!!??
    Steve

    Hi Steve,
    Have you tried dealing with the return value from your macro? If you are invoking the MsgBox function in your test macro, you may need to allow the return value from MsgBox to pass thru back to AS. Something like :
    set MyRetCode to run VB macro "Macintosh HD:Users:xxx:Desktop:test.xls!test"
    (Note unless you've changed the hard drive name to "hard drive", the default boot drive name will probably be "Macintosh HD". Case does matter here)
    I also suspect you'll need to have Entourage up as well in the full case of running a macro in Entourage from Excel (or the other way around). Hence, the command ActivateMicrosoftApp in the Excel dictionary may also be useful.
    Second, you can have a macro, in a startup template, in Entourage call a macro in a startup template in Excel to accomplish what you want without going into AppleScript at all. This latter, VB-only, method will require a "Reference", as it's called in VBA, to be added to the TemplateProject in Entourage that points to the Excel macro you want to fire off. The added benefit of this latter method is that you will have access to the full range of VBA commands/options, rather than the smaller dictionary available in AS.
    Ed
    PB G4   Mac OS X (10.2.x)  

  • Do not use Lightroom for Canon 7D RAW files!

    I know that Adobe says support is preliminary, but it is just horribly bad, especially on high ISO images.  I just processed the same ISO 1600 picture in both Lightroom and Canon Digital Photo Professional and the difference is unbelievable.  The Lightroom photo looks like it came from a point and shoot.
    Abobe - PLEASE make something to match the quality of Canon's converter soon!   Lightroom is one of my all time favorite programs, but this just makes it unusable.

    My remarks re DPP were in comparison to the 7D Beta profile. I use LR 2.5 for 95% of my work, and trying the Beta LR3,  and while I have Bibble Pro 4 & 5 Beta (not fond of either), Silkypix Dev Pro (Ok, but LR much better) and Capture One 5 Pro (very good, but uses a lot of disk space in the image directory) and doesn't have the "extras" and plug-in capability of LR.  LR is my preferred processor, but the 7D profile has room to improve.
    I just shot a Halloween show with the 5DMkII and 7D, most of the shots were iso 2500 & iso 3200.  I used LR for processing all, and did a batch neat image NR after.  Final images were fine and LR is still my primary processor.

  • 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.

  • 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)

  • JPA Problem using alias for columns in a query

    Hello, I am having some problems with a query that I am trying to use in my JEE project. This query doesnt return an entity but a group of values. I created a class representing the result and a query with the jpa constructor expression but it is not working.
    The problem is that in the query I added some alias to the results, and when I try to run the project it says that it cannot parse the query.
    My Query:
    Query query = em.createQuery("SELECT NEW vo.VOOperacionesAgrupadas (o.nemotecnico as nemotecnico, o.esCompra as esCompra, i.equivUltimo as equivUltimo, sum(o.saldo) as saldo, sum(o.utilidad) as utilidad, sum(o.tasaCompraVenta)/count(o.nemotecnico) as promedioTasaCompra, (i.equivUltimo-sum(o.tasaCompraVenta)/count(o.nemotecnico))*100 as puntosBasicos) FROM Operaciones o, Instrumentos i WHERE o.idUsuario = :idUsuario AND o.nemotecnico = i.nemotecnico AND o.estaCerrada = 'false' Group by o.nemotecnico, o.esCompra, i.equivUltimo"); When I use that the server returns :
    Exception Description: Syntax error parsing the query [SELECT NEW vo.VOOperacionesAgrupadas (o.nemotecnico as nemotecnico, o.esCompra as esCompra, i.equivUltimo as equivUltimo, sum(o.saldo) as saldo, sum(o.utilidad) as utilidad, sum(o.tasaCompraVenta)/count(o.nemotecnico) as promedioTasaCompra, (i.equivUltimo-sum(o.tasaCompraVenta)/count(o.nemotecnico))*100 as puntosBasicos) FROM Operaciones o, Instrumentos i WHERE o.idUsuario = :idUsuario AND o.nemotecnico = i.nemotecnico AND o.estaCerrada = 'false' Group by o.nemotecnico, o.esCompra, i.equivUltimo], line 1, column 53: syntax error at [as].
    Internal Exception: MismatchedTokenException(8!=82)
    GRAVE: java.lang.IllegalArgumentException: An exception occurred while creating a query in EntityManager:
    Exception Description: Syntax error parsing the query [SELECT NEW vo.VOOperacionesAgrupadas (o.nemotecnico as nemotecnico, o.esCompra as esCompra, i.equivUltimo as equivUltimo, sum(o.saldo) as saldo, sum(o.utilidad) as utilidad, sum(o.tasaCompraVenta)/count(o.nemotecnico) as promedioTasaCompra, (i.equivUltimo-sum(o.tasaCompraVenta)/count(o.nemotecnico))*100 as puntosBasicos) FROM Operaciones o, Instrumentos i WHERE o.idUsuario = :idUsuario AND o.nemotecnico = i.nemotecnico AND o.estaCerrada = 'false' Group by o.nemotecnico, o.esCompra, i.equivUltimo], line 1, column 53: syntax error at [as].
    Internal Exception: MismatchedTokenException(8!=82)
    at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
    at com.sun.grizzly.ContextTask.run(ContextTask.java:69)
    at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330)
    at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309)
    at java.lang.Thread.run(Thread.java:619)
    Caused by: Exception [EclipseLink-8024] (Eclipse Persistence Services - 2.0.1.v20100213-r6600): org.eclipse.persistence.exceptions.JPQLException
    Exception Description: Syntax error parsing the query [SELECT NEW vo.VOOperacionesAgrupadas (o.nemotecnico as nemotecnico, o.esCompra as esCompra, i.equivUltimo as equivUltimo, sum(o.saldo) as saldo, sum(o.utilidad) as utilidad, sum(o.tasaCompraVenta)/count(o.nemotecnico) as promedioTasaCompra, (i.equivUltimo-sum(o.tasaCompraVenta)/count(o.nemotecnico))*100 as puntosBasicos) FROM Operaciones o, Instrumentos i WHERE o.idUsuario = :idUsuario AND o.nemotecnico = i.nemotecnico AND o.estaCerrada = 'false' Group by o.nemotecnico, o.esCompra, i.equivUltimo], line 1, column 53: syntax error at [as].
    Internal Exception: MismatchedTokenException(8!=82)
    at org.eclipse.persistence.exceptions.JPQLException.syntaxErrorAt(JPQLException.java:362)
    at org.eclipse.persistence.internal.jpa.parsing.jpql.JPQLParser.handleRecognitionException(JPQLParser.java:304)
    at org.eclipse.persistence.internal.jpa.parsing.jpql.JPQLParser.addError(JPQLParser.java:245)
    at org.eclipse.persistence.internal.jpa.parsing.jpql.JPQLParser.reportError(JPQLParser.java:362)
    at org.eclipse.persistence.internal.libraries.antlr.runtime.BaseRecognizer.recoverFromMismatchedElement(Unknown Source)
    at org.eclipse.persistence.internal.libraries.antlr.runtime.BaseRecognizer.recoverFromMismatchedToken(Unknown Source)
    at org.eclipse.persistence.internal.libraries.antlr.runtime.BaseRecognizer.mismatch(Unknown Source)
    at org.eclipse.persistence.internal.libraries.antlr.runtime.BaseRecognizer.match(Unknown Source)
    at org.eclipse.persistence.internal.jpa.parsing.jpql.antlr.JPQLParser.constructorExpression(JPQLParser.java:2635)
    at org.eclipse.persistence.internal.jpa.parsing.jpql.antlr.JPQLParser.selectExpression(JPQLParser.java:2045)
    at org.eclipse.persistence.internal.jpa.parsing.jpql.antlr.JPQLParser.selectItem(JPQLParser.java:1351)
    at org.eclipse.persistence.internal.jpa.parsing.jpql.antlr.JPQLParser.selectClause(JPQLParser.java:1266)
    at org.eclipse.persistence.internal.jpa.parsing.jpql.antlr.JPQLParser.selectStatement(JPQLParser.java:352)
    at org.eclipse.persistence.internal.jpa.parsing.jpql.antlr.JPQLParser.document(JPQLParser.java:276)
    at org.eclipse.persist
    GRAVE: ence.internal.jpa.parsing.jpql.JPQLParser.parse(JPQLParser.java:133)
    at org.eclipse.persistence.internal.jpa.parsing.jpql.JPQLParser.buildParseTree(JPQLParser.java:94)
    at org.eclipse.persistence.internal.jpa.EJBQueryImpl.buildEJBQLDatabaseQuery(EJBQueryImpl.java:198)
    at org.eclipse.persistence.internal.jpa.EJBQueryImpl.buildEJBQLDatabaseQuery(EJBQueryImpl.java:173)
    at org.eclipse.persistence.internal.jpa.EJBQueryImpl.<init>(EJBQueryImpl.java:125)
    at org.eclipse.persistence.internal.jpa.EJBQueryImpl.<init>(EJBQueryImpl.java:109)
    at org.eclipse.persistence.internal.jpa.EntityManagerImpl.createQuery(EntityManagerImpl.java:1326)
    ... 59 more
    Caused by: MismatchedTokenException(8!=82)
    ... 74 more
    What can I do?? I have been stuck in this problem for 2 weeks :s I have tried almost everything..
    Thanks in advance for your help!

    SELECT tmp.contract_no, tmp.Actual, tmp.Actual - tmp.NbHours
    FROM ( SELECT t.contract_no, sum(l.hrs) AS Actual, (c.labour_hours * c.labour_progress_per) / 100 AS NbHours
    FROM TASK_DELEGATION t
    INNER JOIN COST_CODE c
    ON t.cost_code = c.cost_code AND t.contract_no = c.contract_no AND t.is_inactive=0
    INNER JOIN Labour.dbo.LABOURALLOT l
    ON l.contractNo = c.contract_no AND l.costcode = c.cost_code AND l.pm = 'N'
    GROUP BY t.contract_no, c.labour_hours, c.labour_progress_per
    ) tmp

  • Using applescript for Find and Replace All in Pages 2.0

    i saw that Pages 2.0 is scriptable
    i try to create a script for merge use to find and replace all occurence of a certain string using a script but Pages doesn't seems to respond to "Find" even using "System Events"
    how can i do to use this function with a script
    Thanx for any help
    S.B.
    ibook G3   Mac OS X (10.4.6)  

    OK, here's another example. This one gets the text as a string and uses the offset property to find "[", presuming it to be a merge delimiter. (Pages' text doesn't support "offset of").
    One failing of this scheme is that the offsets are incorrect if you have inline objects (pictures, shapes, tables, etc.). While it is probably possible to compensate for them, that's a trickier proposition.
    <PRE>-- Example merge replacements:
    property mergeText : {"[name]", "John Smith", "[address]", "1234 Anystreet"}
    on lookup(mergeWord)
    set theCount to count of mergeText
    repeat with x from 1 to theCount by 2
    if item x of mergeText = mergeWord then
    return item (x + 1) of mergeText
    end if
    end repeat
    -- If merge field is not found, delete it (replace it with the empty string)
    return ""
    end lookup
    tell application "Pages"
    repeat
    tell body text of document 1
    -- Get text as a string so that "offset of" can be used.
    set allText to it as string
    set startOffset to offset of "[" in allText
    if (startOffset = 0) then
    exit repeat
    end if
    set endOffset to offset of "]" in allText
    select (text from character startOffset to character endOffset)
    end tell
    set mergeWord to contents of selection
    tell me to lookup(mergeWord)
    set replacement to result
    set selection to replacement
    if (replacement is "") then
    -- Get rid of extra whitespace (space or return)
    -- Do it in a "try" block to handle edge cases at start or end of text.
    try
    set theSel to (get selection)
    set ch1 to character before theSel
    set ch2 to character after theSel
    if ((ch1 is " " or ch1 is return) and (ch2 is " " or ch2 is return)) then
    select character after theSel
    delete selection
    end if
    end try
    end if
    end repeat
    end tell</PRE>
    Titanium PowerBook   Mac OS X (10.4.6)  

  • 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

  • Well I am in my first year in college and am finally looking to get a macbook that I have always wanted. But I dont know what one to get. Ill be using it for school work, music and pictures, searching the web and traveling abroad.

    I have a lot of pictures and i know I am going to be getting an external hardrive. But i am stuck between the 13 in new macbook air and the 15 in retina macbook. battery life is important but i want it to be really fast and just like a powerhorse. I could use all the input I could get. I will be studying abraod to and i want something that will be good to use over there and still be fast. Thanks guys all imput needed!

    Goodness me, a month? That's crazy! I'd say wait it
    out and get your free adapter or battery (though I'm
    bitter I just barely missed the free nano promotion
    too).
    I am expressing interest in getting that free battery, but I really don't need an extra adapter because I still have the original one from my first MacBook.
    Had you mailed your MacBook in for just the random
    shutdown issue? It seems bizarre that it has taken so
    long, because I sent mine in for the same issue and
    it took two weeks total turn around. Also, did they
    give you any reason as to why it will take so long to
    ship out your replacement?
    My MacBook was initially sent in just for the random shutdown issue, but then I called them while it was getting repaired to request the new plastic, since that was becoming a public issue. I think the logic board was replaced by two weeks into the repair, but then it had to wait longer for plastic. When all of that was replaced, it failed the final testing and was going to take longer, but they offered a replacement.
    I think my replacement is taking so long because it is a custom build (so that took about 3 business days) and then estimated shipping is always one week, so since yesterday it has been waiting to be shipped.
    ARGH.

  • TS4513 For me it is no more possible to use AppleScript in MainStage since 3.0.2 !!! Suggestions ?

    Hello,
    In the 3.0.1 version of MainStage, i used AppleScript to launch some actions.
    In 3.0.2 if i launch any AppleScript from MainStage, the program bug.
    Any suggestions ?
    Thank's !

    Yes, on MainStage 3.0.2, when I associate any applescript to a button (Actions->AppleScript->...) and I turn it, i have this bug : the mixer freezes and when I pass a patch to another, the strips are no longer updated. I have to restart MainStage to restore normal behavior ...

  • Use Applescript to have Quicktime record audio

    I need to record and store an audio file of approximately 20 minutes in length in Filemaker Pro 13. I thought I could use Applescript to Launch Quicktime to do the recording, then tell Quicktime what folder to store it in as an MP3 file. I can't seem to understand the Quicktime dictionary to figure out how to do this.

    Thank You. I figured out what I needed to do. I did however also start playing around with applescript and seeing how one can read messages using applescript. Every example that I saw used the "get selection" term after the "tell application 'mail' " command. I guess that is supposed to get every message in the mailbox. When I tried it, all I got was an empty array. It didn't matter if I had a mailbox selected or a message selected. It also didn't matter if it was a new message or one that was already read. Is there supposed to be another command before the get selection? Seeing how this command seems to be in several examples that I have seen on the internet, I have to assume that it should work but it isn't working for me.

  • EventHandler Error while using AppleScript

    hi,
    I use AppleScript to launch Acrobat and run a preflight. Running this a script creates an "Not specfied EvnetHandler Error".
    I guess it come from resolving the filename and path. May somebody nows the "way" to define the preflight profile directly in the script.
    on run this_file
    try
    process_item(this_file)
    end try
    end run
    -- this sub-routine processes files
    on process_item(this_item)
    try
    tell application "Finder"
    set myPath to path to me
    end tell
    with timeout of 1 second
    tell application "Adobe Acrobat Pro"
    activate
    delay 1
    «event PRFLPRFL» this_item given «class PATH»:myPath
    end tell
    end timeout
    end try
    end process_item

    user10310678 wrote:
    I am using beta version. Oracle VM Manager 2.2.0If you have a beta version of 2.2, then you should be an Oracle employee. Please ask this question on an internal mailing list. If you are not an Oracle employee, please ask the employee that gave you this beta. As this is a beta, some functionality may not be operational yet, so I can't answer why this particular feature seems not to work.

Maybe you are looking for

  • LMS 4.2 - DFM devices stuck in "Learning" state

    Hi, Does anybody know why this same kind of bug/error/software fault exist in LMS 4.2 as it was in LMS 3.2 ? Why after a while after discovery of devices (state is "Known") DFM drops the state of devices to "Learning" and it stucks forever. Restartin

  • Deleting the Source System

    Hi All, Can Anyone the consequences on deleting the source system in BI and steps to re-build once again, as i need to take up the activity. Generally what can be issues that crop up when deletion takes place.. <removed by moderator> Regards, Madhav

  • Security architechture ACL in java

    Hello Friends i m chandrashekar. I am working on a java application. i have a problem that i need to provide the security architecture for that application using ACL in java.to restrict each user can u send me one small code or example which contains

  • ICal subscriptions entries not on iOS

    Hi, I had several subscription calendars on Mac which was entered in iCloud and so synced to my iPhone. No the subscription link changed. I deleted the calenders, added new ones (and changed the name of the calenders). Problem: I see the calender sub

  • Wism vs controller

    I am getting ready to submit requests for equipment replacement and I am considering replacing our 4402s. I was not able to see any perf comparisons between the wism and the 4404 units. I assume that the wism would be better given that it would be on