Reboot Using AppleScript

I am building an image for a computer lab at a University. We are migrating from Snow Leopard to Mountain Lion this fall, but since Mountain Lion does not have Rosetta, some professors needed a solution to be able to run PPC programs that they use in class. Because of this I am using a dual boot environment (actually triple boot if you include Win7) with Mountain Lion on one partition and Snow Leopard on another partition. I need an easy way for students to seamlessly reboot into Snow Leopard without using the rEFIt bootloader (as there are two identical Apple icons and it may be confusing for the not-so-technically-savvy students).
I decided to use an AppleScript that chooses the startup partition and reboots automatically, as follows:
do shell script "usr/sbin/bless --mount /Volumes/SnowLeopard --setBoot --nextonly" password "<adminpass>" with administrative privileges
do shell script "shutdown -r now" password "<adminpass>" with administrative privileges
I embedded the password into the script because I do not want the OS to prompt the user for admin account credentials when they execute it. However, the OS keeps prompting for admin credentials anyway. Can anyone help please? Is there a way for this to work without the prompt?

I think this qualifies as a "D'oh!" moment.  if you're going to use an administrator password, you need to give applescript the name of the administrator account.
do shell script "usr/sbin/bless --mount /Volumes/SnowLeopard --setBoot --nextonly" user name "<adminname>" password "<adminpass>" with administrator privileges
do shell script "shutdown -r now" user name "<adminname>" password "<adminpass>" with administrator privileges
Be aware that anyone who has access to the file will be able to read the user name and password without difficulty.

Similar Messages

  • Use Applescript to list duplicates in Mac Office Excel 2011

    Hello Apple scripters!
    I was thinking if it's possible to use Applescript in Excel to find duplicates using conditional formating then export it on a new list.
    Compare 2 columns>highlight duplicates>add result in a new csv file together with either the whole row or column line.
    Thanks!
    Ernesto

    You might try looking/posting here.
    Microsoft Support – Office for Mac
    Microsoft Support – Office for Mac (2)
    https://discussions.apple.com/thread/4847068?tstart=0
    Try a restart.
    Put a copy of the file in the hard drive level Users/Shared folder.
    Do a backup, using either Time Machine or a cloning program, to ensure files/data can be recovered. Two backups are better than one.
    Try setting up another admin user account to see if the same problem continues. If Back-to-My Mac is selected in System Preferences, the Guest account will not work. The intent is to see if it is specific to one account or a system wide problem. This account can be deleted later.
    Isolating an issue by using another user account
    If the problem is still there, try booting into the Safe Mode using your normal account.  Disconnect all peripherals except those needed for the test. Shut down the computer and then power it back up after waiting 10 seconds. Immediately after hearing the startup chime, hold down the shift key and continue to hold it until the gray Apple icon and a progress bar appear. The boot up is significantly slower than normal. This will reset some caches, forces a directory check, and disables all startup and login items, among other things. When you reboot normally, the initial reboot may be slower than normal. If the system operates normally, there may be 3rd party applications which are causing a problem. Try deleting/disabling the third party applications after a restart by using the application un-installer. For each disable/delete, you will need to restart if you don't do them all at once.
    Safe Mode
    Safe Mode - About

  • 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

  • New to applescript. need to create a plist file using applescript

    Needed some help I need on creatinga plist file below using applescript and I can't make it happen needed some hand on this.
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
    <key>Username</key>
    <string>${localAdminUser}</string>
    <key>Password</key>
    <string>${localAdminPassword}</string>
    <key>AdditionalUsers</key>
    <array>
    <dict>
    <key>Username</key>
    <string>${userName}</string>
    <key>Password</key>
    <string>${userPassword}</string>
    </dict>
    </array>
    </dict>
    </plist>
    I have tis code but it doesn't seems to work.
    tell application "System Events"
      -- create an empty property list dictionary item
              set the parent_dictionary to make new property list item with properties {kind:record}
      -- create new property list file using the empty dictionary list item as contents
              set the plistfile_path to "~/Desktop/example.plist"
              set this_plistfile to ¬
      make new property list file with properties {contents:parent_dictionary, name:plistfile_path}
      -- add new property list items of each of the supported types
      make new property list item at end of property list items of contents of this_plistfile ¬
                        with properties {kind:string, name:"Username", value:"${localAdminUser}"}
      make new property list item at end of property list items of contents of this_plistfile ¬
                        with properties {kind:string, name:"Password", value:"${localAdminPassword}"}
      make new property list item at end of property list items of contents of this_plistfile ¬
                        with properties {kind:list, name:"AdditionalUsers"}
      make new property list item at end of property list items of contents of this_plistfile ¬
                        with properties {kind:string, name:"Username", value:"${localAdminUser}"}
      make new property list item at end of property list items of contents of this_plistfile ¬
                        with properties {kind:string, name:"Password", value:"${localAdminPassword}"}
    end tell
    The result of the above code will generate a plist file below
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
              <key>AdditionalUsers</key>
              <array/>
              <key>Password</key>
              <string>${localAdminPassword}</string>
              <key>Username</key>
              <string>${localAdminUser}</string>
    </dict>
    </plist>

    Hello
    You need to create elements at correct container. Like this.
    set plist_file to (path to desktop)'s POSIX path & "example.plist"
    --set plist_file to "~/desktop/example.plist"
    tell application "System Events"
        tell (make new property list file with properties {name:plist_file})
            make new property list item at end with properties {kind:string, name:"Username", value:"${localAdminUser}"}
            make new property list item at end with properties {kind:string, name:"Password", value:"${localAdminPassword}"}
            tell (make new property list item at end with properties {kind:list, name:"AdditionalUsers"})
                tell (make new property list item at end with properties {kind:record})
                    make new property list item at end with properties {kind:string, name:"Username", value:"${localAdminUser}"}
                    make new property list item at end with properties {kind:string, name:"Password", value:"${localAdminPassword}"}
                end tell
            end tell
        end tell
    end tell
    Or you may create a record in AppleScript and set the value of plist file at once. Like this.
    set plist_file to (path to desktop)'s POSIX path & "example.plist"
    --set plist_file to "~/desktop/example.plist"
    set dict to ¬
        {|Username|:"${localAdminUser}", |Password|:"${localAdminPassword}"} & ¬
        {|AdditionalUsers|:{¬
            {|Username|:"${localAdminUser}", |Password|:"${localAdminPassword}"} ¬
    --set dict to {|Username|:"${localAdminUser}", |Password|:"${localAdminPassword}", |AdditionalUsers|:{{|Username|:"${localAdminUser}", |Password|:"${localAdminPassword}"}}}
    tell application "System Events"
        tell (make new property list file with properties {name:plist_file})
            set value to dict
        end tell
    end tell
    Regards,
    H
    Message was edited by: Hiroto (PS. Fixed second script so that it uses the original case (uppercase)  in key string)

  • How can I change the font size of an outgoing instant message using Applescript?

    Text copied into Messages.app from a web page is often too small to read. Is there a quick way to boost the font size using Applescript?

    HI,
    I have spent some time looking at the Mix Message Case.scpt in Hard Drive/Library/Scripts/Messages and also Crazy Message Text.scpt in the same Scripts Folder but then the Mail one.
    Both are Apple versions.
    The Mix Case one is set in Messages > Preferences > Alerts
    Set the top drop down to Sent Message
    Enable the Applescript items and chose the Mix Case item.
    It will look something like this in the current Font and size you have set.
    ThEn aGaIn
    Obviously you don't want all the bit to make the font change between upper an lower case but it does have the option to use it with the Sent Message and it also uses the entry in the text field as a String.
    The Mail Crazy Message one  opens a dialogue box when run.
    it has a default phase and some Upper and lower limits to the size that will be used.
    the Dialogue allows you to change the phrase and also "Set Prefs" to altert the font sizes.
    The result is a text palce in a new Mail items and the font and size changes to look like this:-
    Picture
    It will look different everytime and the Font for each character  and the size of each is randomised.
    Although I have tried sticking in a line to change the size to anything other then my set font in the Mixed Case one I can't get it to work.
    In some cases I get an Script error in Messages  (It seems to think I am setting a Font called "10")
    At other times it just says it can't set it buit still does the Mixed Case bit.
    My hope was to change the size and then reduce the requirement for the "intercaps" routine.
    I have other emails about new posts so I will anwser them and then spend some more time on this.
    9:01 PM      Thursday; June 13, 2013
      iMac 2.5Ghz 5i 2011 (Mountain Lion 10.8.4)
     G4/1GhzDual MDD (Leopard 10.5.8)
     MacBookPro 2Gb (Snow Leopard 10.6.8)
     Mac OS X (10.6.8),
     Couple of iPhones and an iPad
    "Limit the Logs to the Bits above Binary Images."  No, Seriously

  • Adding all day events using applescript to ical

    Hey all. I am new to using applescript. Thanks to some top users i have been able to get excel events file transfered into ical.
    I need help with the applescript for changing these events from time duration to all day.
    tried
    set the start time to 00:00 and end time to 24:00 and
    set all-day to true
    any help would be greatly appreciated!!
    thanks.

    I have the exact same problem. I have entered birthdays for people I know starting with the year of their birth and never ending, an all-day event. They now don't show in 2007, but there is a detached event on January 1, 2000. When I delete that event and all subsequent versions of it, the initial event now ends in 2006 or 2007, and I have to set the repeat to end Never again. I fixed all the ones from February that showed up. Now I notice that a huge amount of the other birthdays (all day events) that I have entered are doing it now, and we are talking well over 40 of them. I don't understand why it keeps creating these detached events. I also publish my calendars, if that makes any difference.

  • ICal and subscribed calendars with MobileMe using AppleScript

    I am having the same problem as many of you; I have a MobileMe account which does not sync the calendars I have in iCal that are subscriptions. I found this great script online which I'll post below. I don't know anything about AppleScript so I'm just copy-pasting. I want it to work, but I'm getting the error "The variable theOldEvent is not defined." right around the line "if similar_found is true then set theOldSummary to the summary of theOldEvent" kinda near the middle. Like I said, I don't know anything about AppleScript. So my question is; how can I fix this error and/or is there some better way of using AppleScript/Automator to do this same thing? Thanks!
    Script to duplicate Calendar orgCalendar into target dupCalendar
    E.H. 12.9.2008
    property myCopies : 0
    property myUpdates : 0
    property myObsoletes : 0
    property orgCalendar : "Sekretariat"
    property dupCalendar : "Sekretariat copy"
    property dupEvents : {}
    property myDeletes : {}
    set myCopies to 0
    set myUpdates to 0
    set myObsoletes to 0
    set dupEvents to {}
    tell application "iCal"
    -- set theCalendars to every calendar
    set theCalendarNames to title of every calendar
    set theOrgCalendar to a reference to calendar orgCalendar
    if theCalendarNames contains dupCalendar then
    set theCalendar to a reference to calendar dupCalendar
    else
    set theCalendar to make new calendar with properties {title:dupCalendar}
    --set theCalendar to make new calendar with properties {title:dupCalendar, color:"{65535, 0, 0}"}
    end if
    set the eventList to uid of every event of theOrgCalendar as list
    set the eventCount to the count of the eventList
    repeat with theUId in eventList
    tell theOrgCalendar
    set theEvent to (the first event whose uid is theUId)
    -- set theProperties to the properties of theEvent as record
    set theDate to the start date of theEvent
    set theSummary to the summary of theEvent
    set theStampDate to the stamp date of theEvent
    end tell
    tell theCalendar
    try
    set theOldEvent to (the first event of theCalendar whose (start date) is theDate as date)
    set similar_found to true
    on error
    set similar_found to false
    set theEndDate to the end date of theEvent
    set theAllDay to the allday event of theEvent
    set theLocation to the location of theEvent
    -- Funny construction to work araund the fact that location may be missing a value
    try
    if theLocation is equal to "" then
    end if
    on error
    set theLocation to ""
    end try
    set theDescription to the description of theEvent
    try
    if theDescription is equal to "" then
    end if
    on error
    set theDescription to ""
    end try
    if theAllDay is true then -- work around a funny bug with all day events
    set theDate to (theDate as date) + 2 * hours
    set theEndDate to (theEndDate as date) + 2 * hours
    end if
    set newEvent to make new event at end with properties {summary:theSummary, location:theLocation, start date:theDate, end date:theEndDate, allday event:theAllDay, description:theDescription}
    -- make new event at end with properties theProperties
    set the end of dupEvents to (the uid of newEvent)
    set myCopies to (myCopies + 1)
    end try
    end tell
    set second_necessary to false
    if similar_found is true then
    set theOldSummary to the summary of theOldEvent
    if theSummary is not equal to theOldSummary then
    --is there a different one?
    try
    set theOldEvent1 to (the second event of theCalendar whose (start date) is theDate as date)
    set theOldSummary to the summary of theOldEvent1
    if theSummary is equal to theOldSummary then
    set theOldEvent to theOldEvent1
    set the end of dupEvents to (the uid of theOldEvent)
    else
    -- cycle repeat ?
    end if
    on error
    -- beep
    try
    set theEvent1 to (the second event of theOrgCalendar whose (start date) is theDate as date)
    set second_necessary to true
    on error
    set the end of dupEvents to (the uid of theOldEvent)
    end try
    end try
    else
    set the end of dupEvents to (the uid of theOldEvent)
    end if
    if second_necessary is true then
    set theEndDate to the end date of theEvent
    tell theCalendar
    set theOldEvent to make new event at end with properties {summary:theSummary, start date:theDate, end date:theEndDate}
    end tell
    set the end of dupEvents to (the uid of theOldEvent)
    end if
    set theOldStampDate to the stamp date of theOldEvent
    if theStampDate is greater than theOldStampDate then
    -- update the event
    set summary of theOldEvent to theSummary -- capitalization may have changed
    set theAllDay to the allday event of theEvent
    set allday event of theOldEvent to theAllDay
    set theEndDate to the end date of theEvent
    if theAllDay is true then -- work around a funny bug with all day events
    set theEndDate to (theEndDate as date) + 2 * hours
    end if
    set end date of theOldEvent to theEndDate
    set theDescription to the description of theEvent
    try
    if theDescription is equal to "" then
    end if
    on error
    set theDescription to ""
    end try
    set description of theOldEvent to theDescription
    set myUpdates to myUpdates + 1
    end if
    end if
    end repeat
    end tell
    -- Delete obsolete events
    set myObsoletes to 0
    set myDeletes to {}
    tell application "iCal"
    set myUIDs to uid of events of theCalendar
    end tell
    repeat with myUID in myUIDs
    if dupEvents does not contain myUID then
    set the end of myDeletes to myUID
    set myObsoletes to (myObsoletes + 1)
    end if
    end repeat
    tell application "iCal"
    repeat with myDel in myDeletes
    delete (every event of theCalendar whose uid is myDel)
    end repeat
    end tell
    -- delete duplicates
    set myDeletes to {}
    tell application "iCal"
    set myStarts to start date of events of theCalendar
    set mySummaries to summary of events of theCalendar
    set myUIDs to uid of events of theCalendar
    set myLength to length of myUIDs
    end tell
    repeat with i from 1 to (myLength - 1)
    set thisStart to (item i of myStarts)
    set thisSumm to (item i of mySummaries)
    repeat with j from (i + 1) to myLength
    set thatStart to (item j of myStarts)
    set thatSumm to (item j of mySummaries)
    if thisSumm is equal to thatSumm and thisStart is equal to thatStart then
    set the end of myDeletes to (item j of myUIDs)
    exit repeat
    end if
    end repeat
    end repeat
    set n to count of myDeletes
    tell application "iCal"
    repeat with myDel in myDeletes
    delete (every event of theCalendar whose uid is myDel)
    end repeat
    -- set the visible of calendar theCalendar to false
    end tell
    display dialog (myCopies & " records duplicated, " & myUpdates & " records updated and " & myObsoletes & " obsolete ones deleted") as text

    No longer an issue.

  • I interrupted a software update and my macbook pro will not boot. I have tried to reboot using the startup disc, I have tried to verify the disc, and repair the disc. It tells me I need to erase and reformat the hard drive then reinstall the operating sys

    I interrupted a software update and my macbook pro will not boot. I have tried to reboot using the startup disc, I have tried to verify the disc, and repair the disc. It tells me I need to erase and reformat the hard drive then reinstall the operating system. I do not have a back up of all my applications, my garageband music and other things. I also do not have time capsule set up on this machine, but I do have a 2 TB time capsule.
    Is there anyway to back up this corrupted drive so I can restore my applications later?

    There's an old saying.  If you don't have a backup disc, then there must be nothing important to backup.  That's just lesson #1.  Lesson #2 is to never interrupt a software update.  Not a good thing.
    OK, I'm sure you know this.  It just upsets me to read your story, knowing you have a lot of important stuff on your hard drive, and didn't use time machine.
    You're pretty much in a bad place.  My only hope for you is to boot to your Installation Disc, then using disk utility see if you can save the internal hard drive (by fixing what can be fixed).  You might be able to see your user folder and some of your apps.  I wouldn't even consider copying the library, because who knows what's been corrupted in there.
    Good luck.

  • How to use AppleScript to set "character fill color" in Pages 5.2?

    For Pages 5.2 on OSX 10.9.3, what is the correct applescript for changing the "character fill" of text in pages. 
    If you highlight text, you do this via your mouse in the inspector by clicking "style," "advanced option (the gear wheel to the right of bold, italics, and underline), "character fill color (clicking on the multi-color circle, not the dropdown menu), and then choosing a color that comes up in the "colors" dialogue box.
    I've looked all over and cannot find how to use applescript to set the character fill color in pages. 
    In some examples (not directly related) I see "character fill" used. 
    In others, I see "colorfill." 
    Basically, I want to use applescript, embedded in a keyboard maestro macro, to change the background color of the text (not the text color itself) to particular colors. 
    Given the changes and updates to Pages this year, and to applescript, what's the easy way to do this?
    Thanks!
    Chuck

    Pages v5.2 still does not include selection-object, or character background color entries in its AppleScript dictionary, as does Pages ’09. Indirectly, using System Events, you can get the text selection in Pages v5.2, but then you can do nothing to change the selection. No assurances as to if or when Apple will mature the AppleScript dictionary support for Pages v5 series.

  • 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 &aelig; 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

  • Moving a layer in Photoshop CS5 using Applescript

    I have a layer in a document called "logo" and i want to duplicate it to every open document and then move it to a specific spot in each document
    I got the duplicating thing happening but cant seem to move the bounds of the layer (says it is read only and cannot be changed)
    here is what I have written
    tell application "Adobe Photoshop CS5"
    activate
    set theDocs to count of documents
    repeat with i from 1 to theDocs
    duplicate art layer "logo" of current document to document i
    end repeat
    repeat with i from 1 to theDocs
    set current document to document i
    tell document i
    set bounds of art layer "logo" to {0.456666666667, 6.38, 2.88, 6.77}
    --Adobe Photoshop CS5 got an error: Property is read/only and cannot be changed
    end tell
    end repeat
    end tell
    This doesn't error but also doesn't move the logo at all
    tell application "Adobe Photoshop CS5"
    activate
    set theDocs to count of documents
    repeat with i from 1 to theDocs
    duplicate art layer "logo" of current document to document i
    end repeat
    repeat with i from 1 to theDocs
    set current document to document i
    tell document i
    set properties of art layer "logo" to {bounds:{0.456666666667, 6.38, 2.88, 6.77}}
    end tell
    end repeat
    end tell
    anyone know what the language is to move the layer around?

    In any language the way to move a layer x,y is to use translate… You will need to do the math from current x,y to required x,y given a distance… A read only property is just that regardless of language… Here is a quick example of how I did this kind of thing using Applescript… I still do the same method now but use the ESTK instead…
    tell application "Adobe Photoshop CS2"
    activate
    -- Store the app settings
    set User_Rulers to ruler units of settings
    set User_Dialogs to display dialogs
    set ruler units of settings to pixel units
    set display dialogs to never
    set Doc_Ref to the current document
    tell Doc_Ref
    -- Store the image res so we can put it back
    set Original_Res to resolution
    -- Change to work at 72 dpi
    resize image resolution 72 resample method none
    -- Move horizontal 1 inch
    translate layer 1 delta x 72 as pixels
    -- Move vertical 1 inch
    translate layer 1 delta y 72 as pixels
    -- Read the bounds propety
    set Layer_Bounds to bounds of layer 1
    log Layer_Bounds
    -- Move the layer using bounds to top/left
    translate layer 1 delta x -(item 1 of Layer_Bounds) as pixels
    translate layer 1 delta y -(item 2 of Layer_Bounds) as pixels
    -- Put back the image res
    resize image resolution Original_Res resample method none
    end tell
    -- Put back the app settings
    set ruler units of settings to User_Rulers
    set display dialogs to User_Dialogs
    end tell
    You should get the general idea of how this works from this. It should move the first layer across 1 inch, down i inch then put it top/left. It assumes you have a layer that is not a background layer nor is it locked in any way…

  • How I generate index markers using Applescript and tagged text!

    One of the challenges I've faced in automating the book making process using Applescript with inDesign is that there don't seem to be any AS commands for making new index markers (anyone please correct me I if I'm wrong about this).
    I've tried various js scripts which do an OK job, but they don't make the actual native markers. This means you have to wait until the book (consistiing of multiple ID files) is complete (so that all the page numbers have been established) to generate the index.
    Recently, I read a tweet from someone with a link to a technique which uses tagged text and find and replace with GREP to edit the tags, inserting the tagged text index tags in the text file and then re-placing the text file in the ID page. In itself, this works great. But I'm dealing with literally thousands of separate text frames, none of them connected in a story.
    The books typically consist of around 1200 pages with almost that many people, each of whose names I need to index with "Lastname, Firstname" references. And those particular strings don't (can't) appear anywhere on the pages. There will also be about 50 ID files all combined into one book. So it is imperative that I have ID generate the native index markers. To help keep things straight and efficient, I'm creating separate small text frames to hold the lastname, firstname strings. I created an object style for these frames which sets the attributes to "nonprinting", and I place the frames in the margin.
    Then I realized that I don't actually have to have ID export the tagged text files for each. I exported one prototype and copied its tags to properties in my script, and then I concatenate them with the respective list item values I import from the database.
    At the proper point in the page building script, I tell "textwrangleer" to make a new document, set its contents to the index string for the current record, save it to disk, overwriting the previous one, and then tell ID to "place" it in the index text frame, which generates the ID index mark.
    I actually got an AS error when I first tried this: "file doesn't exist" or some such. Then I realized that the "place" command was happening too soon, so I inserted a .5 sec delay in the script, and it worked.
    This is actually my first major script for actual work, and I'm so excited about it! I promises to cut production time down to about a thenth of what it was.
    I still have to add some logic to branch between handlers with slightly different parameters for five different page formats, but the same page building handler will work on all of them.

    A note on this:
    Daniel Swanson wrote:
    I've tried various js scripts which do an OK job, but they don't make the actual native markers. This means you have to wait until the book (consistiing of multiple ID files) is complete (so that all the page numbers have been established) to generate the index.
    These scripts typically search for words and immediately write out the page numbers they are found on -- one shot indexing.
    The solution is to add both the topic and its page reference to the current document's index:
    if (app.activeDocument.indexes.length == 0)
        app.activeDocument.indexes.add();
    app.activeDocument.indexes[0].topics.add(app.selection[0].contents).pageReferences.add(app.selection[0]);
    The first lines only make sure there is an index to add to (per default, a new document has none).
    The last line adds a selected word to the index (it must be a plain text string, hence the use of its 'contents'), and then adds a reference to the selection in the text itself.
    Adding the same word a second time will for a change (quite untypically for ID's Scripting) not result in an error but simply add another page reference to the existing one.
    When doing this in a loop: remember to work backwards, because the index marker itself gets inserted into the running text, and that will throw off your text indices.

  • Importing XML using AppleScript in CS5.

    Hi, totally new to inDesign but do programming and database work.  I am looking to import an XML file created from our database.  I can do a basic import manually after creating document and importing xml to load tags then creating text box element and tagging it and placeholder text.  Now trying to automate using AppleScript.  Found some samples from inDesign but not sure how to tie all the pieces together.  Does anyone have a simple example that takes a small XML file and loads a few records automatcally into indesign.  Maybe, create new document, create textbox element and create text placeholders and tags then import xml file?
    Thanks,
    Joe

    I don't work in applescript, but:
    Does anyone have a simple example that takes a small XML file and loads a few records automatcally into indesign.  Maybe, create new document, create textbox element and create text placeholders and tags then import xml file?
    Err, when you say "records," you have me slightly concerned.
    Because it is quite difficult to get Data Merge -like functoinality with XML.
    Have you tested (and validated!) this workflow withoutscripting?

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

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

Maybe you are looking for

  • RAW images ... 0KB

    I have just started using iPhoto with RAW images from my Lumix G1... no importing problems so far BUT... I import a RAW image (with no jpeg thumbnail). iPhoto lists it as RAW at about 14MB. I have set Adv Prefs to save edits as TIFF, so I open the pi

  • My hotkey don't work anymore using Windows 8

    I have installed Windows 8 and now my hotkey don't work anymore. I looked online but i am not sure what drivers i need to install for that. I hope you can help me with this. I would love to get everything back to work like before the update.

  • Flash Player 10 tells me its installed but I can't find it?

    Hi, I work on a Mac G4 running OS 10.4.11. I need to look at some swfs so I went to download the free flash player. It downloads, the installer takes me through the installation, selects my Hard Drive (that has 66GB free) and tells me the installatio

  • Battery finished while getting a call and there is no log

    hello, This morning I got a call (not from someone on my contact list) and as soon as I checked the phone, the battery died. I plugged the iPhone and turned it on, and can't see that log. Not in missed call/or other logs. Is this a bug? Is there a wa

  • Replacement visual basic applications that use Microsoft IE as control

    Years ago (~15) I wrote some VB applications that import IE as a component. While visiting some selected web pages, these applications would extract pertinent information and save them in a local (client side) database. Over the years IE has changed,