Some more guideance on whether to use Applescript/JS?

This is, in rough outline, what I want to do:
1. From within InDesign, extract the effective ppi of an image in the 'x' and 'y' directions.
2. In Photoshop, apply those numbers in a certain way to the image so that the effective ppi becomes 300 in Indesign. It's a simple formula that you apply to the Image Resolution.
3. Then I want to apply an Unsharp Mask with an edge mask to sharpen the image. This involves quite a number of simple steps.
I have written out the whole procedure in Pidgin Applescript (a combination of Applescript, BASIC and English) and it works perfectly. I have to do Step 1 manually, but for steps 2 & 3 I have generated an Action, with a modal control for step 2, which pauses and asks for input.
I want to know the best way to approach this task. Someone has told me (outside of these forums):
Your best bet will be to post in the scripting forum. It would need to be Applescript because I don't think Javascript can do multiple applications at once.
However, I'm not positive, but I don't think Open as Smart Object is available in the Photoshop CS3 Applescript dictionary. Maybe that's changed with CS4? Also, when I worked on the script dealing with layered Photoshop files, it created many seemingly insurmountable problems...
Michael Hale responded to a previous thread of mine (http://forums.adobe.com/thread/457438) suggesting JS instead of Applescript:
I would recommend that you use javascript for several reasons. First it is cross platform, second there seems to be more people on the forums using JS than AS, and last but not least in this case you can not work with the Action Manager API using AS. You would have to create and call JS functions from AS.
So, I am left with: Applescript because it can handle multiple applications at once, but JS because it can handle Actions. What is the best way to approach this task? AS or JS?
1. Extract some variables from a selected image in an open InDesign document.
2. Open that same image in Photoshop and change the Image Resolution (a calculation is involved)
3. Call up my Action to do the rest.
4. Ask if more sharpening is required, and the amount. Loop at this step until the answer is "No".
5. Save and close the image in Photoshop, and return to the selected image in InDesign to see the effect.
Any suggestions most appreciated.

Guy Burns wrote:
2. Call upon JS (from within AS) with something like: app.doAction ("SHARPEN", "MY ACTIONS")
OPTIONAL:
* Upon return from JS, ask: More sharpening? If "Yes" apply new amount to Unsharp Mask.
* Loop until "No"
Guy there is NO need to call upon AppleScript to do JavaScript to have your action played out. You have direct access to this via AppleScript.
I've had a quick stab at what I think you want and here is a bare bones script that may get you out of the blocks (only did a quick test)
It expects you to have an image selected NOT its containing rectangle. Hope this helps…
tell application "Adobe InDesign CS2"
activate
tell active document
set This_Image to get selection
set EPPI to effective ppi of item 1 of This_Image
set {Hoz_PPI, Vert_PPI} to {item 1 of EPPI, item 2 of EPPI}
if Hoz_PPI ≤ Vert_PPI then
set Resample to Hoz_PPI
else
set Resample to Vert_PPI
end if
set Image_Path to file path of item link of (item 1 of This_Image) as alias
end tell
end tell
tell application "Adobe Photoshop CS2"
set display dialogs to never
set User_Rulers to ruler units of settings
set ruler units of settings to pixel units
activate
open Image_Path
set ID_Image to the current document
tell ID_Image
set Image_Res to resolution
set Image_Height to height
-- set Image_Width to width
if Resample < 270 then
resize image height (Image_Height * (300 / Resample)) ¬
resolution (Image_Res * (300 / Resample)) resample method bicubic smoother
end if
if Resample > 330 then
resize image height (Image_Height * (300 / Resample)) ¬
resolution (Image_Res * (300 / Resample)) resample method bicubic sharper
end if
-- do action "Action Name String" from "Action Set Name String"
close with saving
end tell
set ruler units of settings to User_Rulers
end tell
tell application "Adobe InDesign CS2"
activate
tell active document
update item link of (item 1 of This_Image)
end tell
end tell

Similar Messages

  • I want to buy macbook air 13, can i use designing software like AUTOCAD, solidworks, and some heavy games, like Maxpayne 3 and Some more in AIR 13??

    i want to buy macbook air 13, can i use designing software like AUTOCAD, solidworks, and some heavy games, like Maxpayne 3 and Some more in AIR 13??

    Welcome to Apple Discussions.
    Read the system requirements for the programs you listed. Match them against the specifications of the machine you propose to buy. The more RAM the better, your hard drive size requirements and video card specicications may require the upgraded, not base, model or may eliminate the MBA as a platform.

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

  • More questions on using AppleScript with MSoft Word

    Thank you HD for your detailed reply in the other thread on closing docs in Word using AppleScript.
    Here is another qn for all:
    How does the "execute find" command work?
    The dictionary for Word lists the following:
    execute find find
    [find text text] : The text to be searched for. Use an empty string to search for formatting only.
    [match case boolean] : Set to true to specify that the find text be case sensitive.
    [match whole word boolean] : Set to true to have the find operation locate only entire words, not text that's part of a larger word.
    [match wildcards boolean] : Set to true if the text to find contains wildcards.
    [match sounds like boolean] : Set to true to have the find operation locate words that sound similar to the find text.
    [match all word forms boolean] : Set to true to have the find operation locate all forms of the find text for example, sit locates sitting and sat.
    [match forward boolean] : Set to true to search forward toward the end of the document.
    [wrap find find stop/find continue/find ask] : Controls what happens if the search begins at a point other than the beginning of the document and the end of the document is reached or vice versa if forward is set to false.
    [find format boolean] : Set to true to have the find operation locate formatting in addition to or instead of the find text.
    [replace with text] : The replacement text. To delete the text specified by the Find argument, use an empty string. You specify special characters and advanced search criteria just as you do for the find text argument.
    [replace replace none/replace one/replace all] : Specifies how many replacements are to be made: one, all, or none.
    → text range/insertion point
    According to my AppleScript manual, those in brackets are optional parameters. I assume the second find after "execute find" refers to the "find" object, and that this is a compulsory parameter.
    I face the following problems:
    (1)
    If I try to set the text I want to find in the "find" object, I get an error. So this doesn't work:
    tell application "Microsoft Word"
              set content of find to "book"
    end tell
    I get the following error:
    error "Can’t set «class 1650» of «class w124» to \"book\"." number -10006 from «class 1650» of «class w124» to «class book»
    (2)
    If I ignore the "find" object, and use the first optional parameter of "execute find" which is "find text" to set my text to find, I also have an error:
    tell application "Microsoft Word"
              tell document 1
      execute find find text "book"
      display dialog result
              end tell
    end tell
    Error message:
    error "Microsoft Word got an error: document 1 doesn’t understand the execute find message." number -1708 from document 1
    (3)
    So the document is the wrong target for the "execute find" command, fine. But directing the command to the application won't work:
    tell application "Microsoft Word"
      execute find find text "book"
      display dialog result 
    end tell
    Error message:
    error "Microsoft Word got an error: Can’t continue execute find." number -1708
    Regards,
    junxiang99

    I know very little about AppleScripting MS Word beyond the fact that it is powerful but unforgiving. I did a Google on Microsoft Word Applescript Execute Find and found quite a few references to the correct syntax.
    This is one of them.
    Hope it helps.

  • 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

  • Transferring the values from a known range of cells (containing formulas) in Excel using Applescript

    I have my AppleScript iterating thru email messages and pasting data (which arrives via email from a web form) into following cells: range "A1:A50"
    My Excel parsing of data occurs in cell formulas on Row 52, cells in range "A52:AZ52"
    I want to copy the cells in row 52 and paste the Values (not the formulas) in successive rows underneath the formula cells, starting with row 54: range "A54:AZ54"
    In pseudo code the code snip is:
    tell worksheet "sheet1" of workbook "Example" application "Microsoft Excel"
         repeat i from 1 thru to (count emails)
              paste some of the contents of (email item i) into sheet range "A1:A50"  
                                            # the above forms about twenty lines of code to get it
                                                  into Excel's cell object list or lists
              copy or get row 52   # or range "A52:AZ52" if that's easier/faster/better
              paste or set the values of row 52 into row (53+i)
         end repeat
    end tell
    Not sure whether to use the clipboard with "paste speical…[range] with []" or copy and set value statements. I only know how to reference existing ranges, not the cell contents of the range. I really need to know how to get contents of cells into a AppleScript object (list) that I can transfer. The 2004 Excel AS documentation is not helping me, please throw me a life line someone. :-)

    One other question if I may hijack my thread, if I wanted to set the column of the range programatically how would I do that?
    I know how to programatically set the row eg.
         set x to 54
         set r to range "A" & x & ":AZ" & x
         set tVlaue to value of r
    But I need something like Column (x) to make one of {"A","B","C",…}
    but column(2) gives me $B:B$
    and: "column(2) as text" (so I can halve it) beachballs Script Debugger and Excel and I have to stop the script and restart Excel!

  • 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

  • How to add some more field in dispaly?

    Dear friend,
    I have a abap query ib co module,now i created a abap report by convert the query.As it's conatin logic based on field group and sysmbols.it's difficult to find out where i have top add or not? i have to add some more coloums in display report and also add some more tables from where i can get more details which i have to used further dispaly and update the same in z table.
    please help me............

    Hi,
          Whether u r creating a new report or modifying a report..
    Becoz if u r using ALV means we can add in the field catalog..If u r using the classical interactive reports means we need to find where the values r inserted and where it is displayed and then only we want to proceed..
    Let me know the answer to give a good answer

  • Using AppleScript To Pull Data From Number & Create Calendar Events

    Today I tried running an AppleScript that I created a few years back that works with Number ’09 [version 2.3 (554)].  The script collects information from the active numbers table and creats an event in my calendar for each row of data in the table.  For some reason its not working with the current version of number.
    Here is the script:
    on run
      set cr to ASCII character 13
      set newline to return
      local dName, sName, tName, rowCount, workingCalendar, maintenanceType
      -- get general document information like document name, active sheet name, active table name & the number of rows in the active sheet
      set {dName, sName, tName, rowCount} to my get_document_information()
      -- get information needed to update a calendar in the calendar application like the calendar that needs to be updated and the type of maintenance that will be completed
      set {workingCalendar, maintenanceType} to my get_calendar_update_information()
      -- update calendar maintenance type so the computer can say it
      if maintenanceType = "add" then
      set maintenanceTypeChanged to maintenanceType & "ed"
      set lastpartofsentence to "to calendar"
      else if maintenanceType = "update" then
      set maintenanceTypeChanged to maintenanceType & "d"
      set lastpartofsentence to "in calendar"
      else if maintenanceType = "delete" then
      set maintenanceTypeChanged to maintenanceType & "d"
      set lastpartofsentence to "from calendar"
      end if
      say "Events will be" & maintenanceTypeChanged & lastpartofsentence & workingCalendar
      --determine if calendar already exists.  If it does not create it
      tell application "Calendar"
      set allCalendarTitles to the title of every calendar
      if allCalendarTitles contains workingCalendar then
      --do nothing
      else
      create calendar with name workingCalendar
      end if
      end tell
      set timedifferance to 4
      -- get event information for each row in active table
      say "table name is " & tName
      repeat with rownumber from 1 to rowCount
    tell application "Numbers" to tell row rownumber of tName to set {cell04, cell05, cell06, cell07, cell08, cell09, cell10} to {value of cell 4, value of cell 5, value of cell 6, value of cell 7, value of cell 8, value of cell 9, value of cell 10}
      set cell07 to SearchReplace(cell07, "|", newline)
      tell application "Calendar"
      activate
      if maintenanceType = "Delete" then
      tell calendar workingCalendar to delete (first event whose summary contains cell04 and start date is equal to (cell05 + (timedifferance * hours)))
      end if
      if maintenanceType = "Update" then
      tell calendar workingCalendar to delete (first event whose summary contains cell04 and start date is equal to (cell05 + (timedifferance * hours)))
      tell calendar workingCalendar to set test to make new event at the beginning of events with properties {start date:cell05 + (timedifferance * hours), end date:cell06 + (timedifferance * hours), description:cell07, summary:cell04, location:cell10}
      end if
      if maintenanceType = "Add" then
      tell calendar workingCalendar to set test to make new event at the beginning of events with properties {start date:cell05 + (timedifferance * hours), end date:cell06 + (timedifferance * hours), description:cell07, summary:cell04, location:cell10}
      end if
      end tell
      end repeat
      say "Events have been " & maintenanceTypeChanged
    end run
    on get_document_information()
      -- Get general document information for later use
      local d_name, s_name, selectedTable, t_name, row_count
      tell application "Numbers" to tell document 1
      -- get document name
      set d_name to name
      -- get sheet name
      set s_name to name of active sheet
      -- get table name
      tell active sheet
      set the selectedTable to (the first table whose class of selection range is range)
      end tell
      tell selectedTable
      set t_name to name
      set row_count to row count
      end tell
      return {d_name, s_name, t_name, row_count}
      end tell
    end get_document_information
    on get_calendar_update_information()
      local strCalendarToWorkWith, strMaintenanceType
      tell application "Numbers"
      activate
      tell document 1 to tell sheet "General Information" to tell table "Table 1"
      copy value of cell "C9" to strCalenderToWorkWith
      copy value of cell "C12" to strMaintenanceType
      end tell
      return {strCalenderToWorkWith, strMaintenanceType}
      end tell
    end get_calendar_update_information
    on SearchReplace(sourceStr, searchString, replaceString)
      -- replace <searchString> with <replaceString> in <sourceStr>
      -- return SearchReplace(theString, ".", "<PERIOD>")
      set searchStr to (searchString as text)
      set replaceStr to (replaceString as text)
      set sourceStr to (sourceStr as text)
      set saveDelims to AppleScript's text item delimiters
      set AppleScript's text item delimiters to (searchString)
      set theList to (every text item of sourceStr)
      set AppleScript's text item delimiters to (replaceString)
      set theString to theList as string
      set AppleScript's text item delimiters to saveDelims
      return theString
    end SearchReplace
    When running the script in the current version of Numbers [version 3.2 (1861)] I receive the following error message:
    Here is what the table looks like:
    Can anyone help me correct this error/issue?
    Thank you,
    Brian

    The error ocurs right after it speaks the table name?  The error is highlighting the suspect line in the first screenshot.
    I think the "T" in the error is coming from the Table name, so try  replacing the line in question with this mess
              tell application "Numbers"
                        tell document 1
                                  tell active sheet
                                            tell table tName
                             set {cell04, cell05, cell06, cell07, cell08, cell09, cell10} to {value of cell 4, value of cell 5, value of cell 6, value of cell 7, value of cell 8, value of cell 9, value of cell 10}
                                            end tell
                                  end tell
                        end tell
              end tell
    NB original was
    tell application "Numbers" to tell row rownumber of tName to set {cell04, cell05,cell06, cell07, cell08, cell09, cell10} to {value of cell 4, value of cell5, value of cell 6, value of cell 7, value of cell 8, value of cell 9,value of cell 10}
    I don't know Numbers & Applescripting so you'll probably need to work on it some more, I gleaned the 'tell document & tell active sheet, tell table' from the script near the bottom.
    http://www.macosxautomation.com/applescript/iwork/numbers/table-populate.html
    It's a little unclear to me where the 'get document' info comes from, since you are not telling Numbers within that part.

  • How to read specific value in XML using AppleScript?

    I have a XML file which I get from Mediainfo, and I want to get the value of Format of the Audio Track from it (In this case, ALAC) using AppleScript. Could anybody help me with this? Thanks.
    <?xml version="1.0" encoding="UTF-8"?>
    <Mediainfo version="0.7.69">
    <File>
    <track type="General">
    <Complete_name>/Volumes/Macintosh HDD/Movies/Strike the Blood 12.mov</Complete_name>
    <Format>MPEG-4</Format>
    <Format_profile>QuickTime</Format_profile>
    <Codec_ID>qt  </Codec_ID>
    <File_size>1.64 GiB</File_size>
    <Duration>23mn 41s</Duration>
    <Overall_bit_rate_mode>Variable</Overall_bit_rate_mode>
    <Overall_bit_rate>9 887 Kbps</Overall_bit_rate>
    <Movie_name>[ReinForce] Strike the Blood - 12 (BDRip 1920x1080 x264 FLAC)</Movie_name>
    <Encoded_date>UTC 1904-01-01 00:00:00</Encoded_date>
    <Tagged_date>UTC 1904-01-01 00:00:00</Tagged_date>
    <Writing_application>Lavf55.33.100</Writing_application>
    </track>
    <track type="Video">
    <ID>1</ID>
    <Format>AVC</Format>
    <Format_Info>Advanced Video Codec</Format_Info>
    <Format_profile>[email protected]</Format_profile>
    <Format_settings__CABAC>Yes</Format_settings__CABAC>
    <Format_settings__ReFrames>4 frames</Format_settings__ReFrames>
    <Codec_ID>avc1</Codec_ID>
    <Codec_ID_Info>Advanced Video Coding</Codec_ID_Info>
    <Duration>23mn 41s</Duration>
    <Bit_rate>9 084 Kbps</Bit_rate>
    <Width>1 920 pixels</Width>
    <Height>1 080 pixels</Height>
    <Display_aspect_ratio>16:9</Display_aspect_ratio>
    <Frame_rate_mode>Variable</Frame_rate_mode>
    <Frame_rate>23.976 fps</Frame_rate>
    <Color_space>YUV</Color_space>
    <Chroma_subsampling>4:2:0</Chroma_subsampling>
    <Bit_depth>8 bits</Bit_depth>
    <Scan_type>Progressive</Scan_type>
    <Bits__Pixel_Frame_>0.183</Bits__Pixel_Frame_>
    <Stream_size>1.50 GiB (92%)</Stream_size>
    <Writing_library>x264 core 142</Writing_library>
    <Encoding_settings>cabac=1 / ref=4 / deblock=1:-2:-2 / analyse=0x3:0x113 / me=umh / subme=9 / psy=1 / psy_rd=0.70:0.00 / mixed_ref=0 / me_range=32 / chroma_me=1 / trellis=2 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=32 / lookahead_threads=5 / sliced_threads=0 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=9 / b_pyramid=2 / b_adapt=2 / b_bias=0 / direct=3 / weightb=1 / open_gop=0 / weightp=2 / keyint=250 / keyint_min=23 / scenecut=40 / intra_refresh=0 / rc_lookahead=40 / rc=crf / mbtree=1 / crf=16.0 / qcomp=0.70 / qpmin=10 / qpmax=20 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00</Encoding_settings>
    <Language>English</Language>
    <Encoded_date>UTC 1904-01-01 00:00:00</Encoded_date>
    <Tagged_date>UTC 1904-01-01 00:00:00</Tagged_date>
    </track>
    <track type="Audio">
    <ID>2</ID>
    <Format>ALAC</Format>
    <Codec_ID>alac</Codec_ID>
    <Codec_ID_Info>Apple Lossless Audio Codec</Codec_ID_Info>
    <Duration>23mn 41s</Duration>
    <Duration_LastFrame>-51ms</Duration_LastFrame>
    <Bit_rate_mode>Variable</Bit_rate_mode>
    <Bit_rate>799 Kbps</Bit_rate>
    <Channel_s_>2 channels</Channel_s_>
    <Channel_positions>Front: L R</Channel_positions>
    <Sampling_rate>48.0 KHz</Sampling_rate>
    <Bit_depth>16 bits</Bit_depth>
    <Stream_size>135 MiB (8%)</Stream_size>
    <Language>11</Language>
    <Encoded_date>UTC 1904-01-01 00:00:00</Encoded_date>
    <Tagged_date>UTC 1904-01-01 00:00:00</Tagged_date>
    </track>
    </File>
    </Mediainfo>

    Hello
    You may try something like the following script. It is indeed a Perl script wrapped in AppleScript, though.
    set f to (choose file with prompt "Choose the XML file")'s POSIX path
    get_audio_format(f)
    on get_audio_format(f)
            string f : POSIX path of source XML file
        do shell script "/usr/bin/perl -CSDA -w <<'EOF' - " & f's quoted form & "
    use strict;
    use XML::LibXML;
    my $parser = XML::LibXML->new();
    my $doc = $parser->parse_file($ARGV[0]);
    print $doc->find('/Mediainfo/File/track[@type=\"Audio\"]/Format');
    EOF"
    end get_audio_format
    And a littel more general-purpose script is -
    set f to (choose file with prompt "Choose the XML file")'s POSIX path
    get_value_at_xpath(f, "/Mediainfo/File/track[@type=\"Audio\"]/Format")
    on get_value_at_xpath(f, xpath)
            string f : POSIX path of source XML file
            string xpath : XPath of target node
        do shell script "/usr/bin/perl -CSDA -w <<'EOF' - " & f's quoted form & " " & xpath's quoted form & "
    # $ARGV[0] : xml file
    # $ARGV[1] : xpath
    use strict;
    use XML::LibXML;
    my $parser = XML::LibXML->new();
    my $doc = $parser->parse_file($ARGV[0]);
    print $doc->find($ARGV[1]);
    EOF"
    end get_value_at_xpath
    Hope this may help,
    H
    PS. If copied code has extra spaces in front of every line, which appears to be the case with some browsers including Firefox, please remove them before running the script.

  • Info on whether to use ext. Netegrity tool or the default provided by SAP

    Hi,
       Can anyone give me some info. as to which would be better or which would SAP recommend as Best Practice - whether to use external <b>Netegrity tool for Authentication & Security</b> or the default provided by SAP Web AS.
    Thanks & Regards,
    Jeetu

    Firstly, I completely agree with Nicks comments and in any case the original question was Best Practice and desgin phase not technical "how to" implemenation.
    @Jeetendra,
    Actually, overall the decisions are normally made for you as a basic project requirement eg. Constraint: Users need to access Portal from a web link in intranet site secured by Netegrity without reauthentication. So as mentioned above its usually a pure SSO constraint.  Thereafter it is more of 'How best' and what are the technical limitations. Otherwise there is no real need to make life more difficult. Could you describe why you are having to make this feasability study?
    Since Netegrity is an external component, Performance will never be a reason to include Netegrity as it only adds complexity.  The performance impact will depend on agent configuration and policies and size of Netegrity infrastructure etc.  This needs to be evaluated with the Netegrity team based on the estimated number of concurrent users/requests etc. Concrete info will not be possible unless you do a load test with / without Netegrity and compare results.
    Security aspects have to be looked at across the whole spectrum based on the local environment and requirements.  Netegrity is complementary to WAS security but can actually reduce security eg. If basic header authentication is configured without additional checks. It also may or may not be required to cover requests to back end systems.
    Take a look at the SAP security guide.
    If you are still unsure of how best to proceed you may need to get specialist assistance as I doubt someone will be able/willing to provide the detail you require without some kind of intervention.

  • How to find the frames-per-second of a Quicktime movie using Applescript?

    Is there a way to find out the real-time "frames per second" of a Quicktime movie?
    The only Applescript movie properties in Quicktime which I have found to be useful are "duration" and "time scale". The real-time duration of the movie in seconds is found by dividing "duration" by "time scale".
    But "time scale" only sometimes relates to any real time property. In some cases it does (2500 = PAL 25 fps, 2997 = NTSC 29.97 fps) but for many other movie types I've opened (DivX, flv, mp4 etc) the "time scale" is often reported as "600" even though the Quicktime movie inspector window will report a frame rate of 25, 29.97, 15 or some other number.
    Where does the Quicktime movie inspector window extract the FPS from, and is it possible to extract that same number, or calculate the real-time FPS of a Quicktime movie using Applescript only?
    Thanks.

    Thanks for this but unfortunately it only works for some movie types. For .dv .flv and .divx movies, this script correctly calculates the FPS. But for .mpg .mp4 and .m4v it does not.
    For .mpg movies I tested, the count of frames was always 1, so clearly the FPS calculation is always wrong.
    For the .mp4 and .m4v movies I tried, the FPS was always reported as 43, regardless of whether the actual FPS was 25 or 29.97. In all cases the count of frames was incorrect.
    A bug in Quicktime?

  • Can I chart in Numbers using AppleScript

    I have just started learning AppleScript so that I can automate some business processes and save myself some time. Because of better design and ease of use I use the latest version of iWork and don't even have Office installed on my Mac, nor do I want to install it. However, one area I cannot work out is how to automate the creation of a chart in Numbers using AppleScript.
    Is this possible? If so, how, and if not, why not?

    Answering questions like : how may we do this or that, is what we are supposed to try to achieve in this forum.
    Answering questions like yours : why this or that, can't be seriously done here.
    Here you ask to end users like you. We don't belong to the teams designing the apps.
    We just may try to guess.
    To build tables and charts Pages and Numbers share the same pieces of code so there is no technical reasons able to explain the omission.
    So I guess that, as Pages is in its 4th version, designers had more time available to embed features in the AppleScript support than those working upon Numbers.
    What's funny is that there is a minimal support for charts in Pages (as well as a microscopic support for tables) but there is a correct support for tables (which may be enhanced) in Numbers but nothing for charts.
    Honestly, I really don't think that the difference is huge.
    I posted my script too fast.
    I forgot to insert the handler allowing us to bring a sheet at front which is required to apply GUIScripting.
    It's probably the main drawback of the need to use GUIScripting here.
    I don't waste time trying to apply some edit tasks to the charts.
    I just wanted to fill the gap between Pages and Numbers about scripting charts.
    Here is an enhanced version.
    --{code}
    --[SCRIPT add_charts]
    Yvan KOENIG (VALLAURIS, France)
    2011/08/27
    on run
              my activateGUIscripting()
              tell application "Numbers" to tell document 1
                        set dName to its name
                        set sName1 to name of sheet 1
                        set sName2 to name of sheet 2
    Select sheet 1 of document 1
    The doc name may be passed by a number but the sheet must be identified by its name .
    As it's just a sample, in the first call I reference the doc by its index *)
                        my selectSheet(1, sName1)
                        tell sheet sName1 to tell table 1
    Always define the selection before creating a chart *)
                                  set selection range to range (name of cell 4 of column 2 & " : " & name of cell 8 of column 3)
                                  my selectSubMenu("Numbers", 5, 4, 9) -- Scatter chart
    Always define the selection before creating a chart *)
                                  set selection range to range (name of cell 4 of column 2 & " : " & name of cell 8 of column 3)
                                  my selectSubMenu("Numbers", 5, 4, 3) -- Bars
    Always define the selection before creating a chart *)
                                  set selection range to range (name of cell 4 of column 2 & " : " & name of cell 8 of column 3)
                                  my selectSubMenu("Numbers", 5, 4, 4) -- Stacked Bars
    Always define the selection before creating a chart *)
                                  set selection range to range (name of cell 4 of column 3 & " : " & name of cell 8 of column 3)
                                  my selectSubMenu("Numbers", 5, 4, 20) -- 3D Pie
                        end tell
    Select sheet 2 of document 1
    This time, I reference the document by its name *)
                        my selectSheet(dName, sName2)
                        tell sheet sName2 to tell table 1
    Always define the selection before creating a chart *)
                                  set selection range to range (name of cell 4 of column 2 & " : " & name of cell 8 of column 3)
                                  my selectSubMenu("Numbers", 5, 4, 9) -- Scatter chart
    Always define the selection before creating a chart *)
                                  set selection range to range (name of cell 4 of column 2 & " : " & name of cell 8 of column 3)
                                  my selectSubMenu("Numbers", 5, 4, 3) -- Bars
    Always define the selection before creating a chart *)
                                  set selection range to range (name of cell 4 of column 2 & " : " & name of cell 8 of column 3)
                                  my selectSubMenu("Numbers", 5, 4, 4) -- Stacked Bars
    Always define the selection before creating a chart *)
                                  set selection range to range (name of cell 4 of column 3 & " : " & name of cell 8 of column 3)
                                  my selectSubMenu("Numbers", 5, 4, 20) -- 3D Pie
                        end tell --sheet 2…
              end tell -- Numbers…
    end run
    --=====
    on parleAnglais()
              local z
              try
                        tell application "Numbers" to set z to localized string "Cancel"
              on error
                        set z to "Cancel"
              end try
              return (z is not "Annuler")
    end parleAnglais
    --=====
    on activateGUIscripting()
      (* to be sure than GUI scripting will be active *)
              tell application "System Events"
                        if not (UI elements enabled) then set (UI elements enabled) to true
              end tell
    end activateGUIscripting
    --=====
    ==== Uses GUIscripting ====
    on selectSheet(theDoc, theSheet)
              script myScript
                        property listeObjets : {}
                        local maybe, targetSheetRow
                        tell application "Numbers"
      activate
                                  set theDoc to name of document theDoc (* useful if the passed value is a number *)
                                  tell document theDoc to set my listeObjets to name of sheets
                        end tell -- "Numbers"…
                        set maybe to theSheet is in my listeObjets
                        set my listeObjets to {} -- So it will not be saved in the script *)
                        if not maybe then
                                  if my parleAnglais() then
                                            error "The sheet “" & theSheet & "” is unavailable in the spreadsheet “" & theDoc & "” !"
                                  else
                                            error "La feuille « " & theSheet & " » n’existe pas dans le tableur « " & theDoc & " » ! "
                                  end if -- my parleAnglais
                        end if -- not maybe
                        set maybe to 5 > (system attribute "sys2")
                        tell application "System Events" to tell application process "Numbers"
                                  tell outline 1 of scroll area 1 of splitter group 1 of splitter group 1 of window theDoc
                                            if maybe then (* macOS X 10.4.x
    '(value of attributes contains 0)': '(value of attribute "AXDisclosureLevel" is 0)' sometimes works in Tiger, sometimes not.
    The only possible instances of 0 amongst the attributes are the disclosure level of a sheet row and the index of the first row, which represents a sheet anyway.
    Another possibility is '(value of attribute -1 is 0)', which makes me uneasy. *)
                                                      set targetSheetRow to first row where ((value of attributes contains 0) and (value of first static text is theSheet))
                                            else (* macOS X 10.5.x or higher *)
                                                      set targetSheetRow to first row where ((value of attribute "AXDisclosureLevel" is 0) and ((groups is {}) and (value of first static text is theSheet)) or (value of first group's first static text is theSheet))
                                            end if -- maybe…
    Handler modified to accomodate sheets requiring a lot of time to get the focus
                                            tell targetSheetRow to set value of attribute "AXSelected" to true
                                            set cnt to 0
                                            repeat (*
    Must way that Numbers becomes ready to receive the value *)
                                                      try
                                                                tell targetSheetRow to set value of attribute "AXDisclosing" to true
                                                                exit repeat
                                                      on error
                                                                set cnt to cnt + 1
      delay 0.5 -- half a second
                                                      end try
                                            end repeat
                                  end tell -- outline…
                        end tell -- "System Events"…
                        tell application "Numbers" to tell document theDoc to tell sheet theSheet to tell table 1
                                  with timeout of 20 * 60 seconds (*
    WITH this setting, the script will be able to wait 20 minutes for the asked value.
    I hope that the document will not be so huge that this delay prove to be too short. *)
                                            value of cell "A1"
                                  end timeout
                        end tell -- "Numbers"…
                        tell application "System Events" to tell application process "Numbers" (*
    Do the trick one more time to be sure that the sheet is open *)
                                  tell targetSheetRow to set value of attribute "AXDisclosing" to true
                        end tell -- "System Events"…
    End of the modified piece of code
              end script
      run myScript
    end selectSheet
    --=====
    my selectSubMenu("Pages",6, 4, 26)
    ==== Uses GUIscripting ====
    on selectSubMenu(theApp, mt, mi, ms)
              tell application theApp
      activate
                        tell application "System Events" to tell process theApp to tell menu bar 1 to ¬
                                  tell menu bar item mt to tell menu 1 to tell menu item mi to tell menu 1 to click menu item ms
              end tell -- application theApp
    end selectSubMenu
    --=====
    useful to get the indexs of the triggered item
    my select_SubMenu("Numbers", 6, 4, 3) (* Table > Chart> Bars *)
    on select_SubMenu(theApp, mt, mi, ms)
              tell application theApp
      activate
                        tell application "System Events" to tell process theApp to tell menu bar 1
                                  get name of menu bar items
    01 - "Apple",
    02 - "Numbers",
    03 - "Fichier",
    04 - "Édition",
    05 - "Insertion",
    06 - "Tableau",
    07 - "Format",
    08 - "Disposition",
    09 - "Présentation",
    10 - "Fenêtre",
    11 - "Partage",
    12 - "Aide"}
                                  get name of menu bar item mt
      -- {"Tableau"}
                                  tell menu bar item mt to tell menu 1
                                            get name of menu items
    01 - "Feuille",
    02 -  missing value,
    03 - "Tableau",
    04 - "Graphique",
    05 - "Figure",
    06 - "Zone de texte",
    07 - "Fonction",
    08 - "Ligne de connexion",
    09 - missing value,
    10 - "Remplissage",
    11 - missing value,
    12 - "Rangs copiés",
    13 - "Colonnes copiées",
    14 - missing value,
    15 - "Date et heure",
    16 - "Nom du fichier",
    17 - "Numéro de page",
    18 - "Nombre de pages",
    19 - missing value,
    20 - "Commentaire",
    21 - "Lien",
    22 - "Saut de colonne",
    23 - "Équation MathType",
    24 - missing value,
    25 - "Choisir…"}
                                            get name of menu item mi
      --> "Graphique"
                                            tell menu item mi to tell menu 1
                                                      get name of menu items
    01 - "Colonnes",
    02 - "Colonnes empilées",
    03 - "Barres",
    04 - "Barres empilées",
    05 - "Ligne",
    06 - "Couches",
    07 - "Couches empilées",
    08 - "Diagramme circulaire",
    09 - "Nuage de points",
    10 - "Mixte",
    11 - "2 axes",
    12 - missing value,
    13 - "Colonnes 3D",
    14 - "Colonnes 3D empilées",
    15 - "Barres 3D",
    16 - "Barres 3D empilées",
    17  - "Linéaire 3D",
    18 - "Couches 3D",
    19 - "Couches 3D empilées",
    20 - "Circulaire 3D"}
                                                      get name of menu item ms
      --> "Barres"
      click menu item ms
                                            end tell
                                  end tell
                        end tell
              end tell -- application theApp
    end select_SubMenu
    --=====
    --[/SCRIPT]
    --{code}
    Yvan KOENIG (VALLAURIS, France) samedi 27 août 2011 15:19:15
    iMac 21”5, i7, 2.8 GHz, 4 Gbytes, 1 Tbytes, mac OS X 10.6.8 and 10.7.0
    My iDisk is : <http://public.me.com/koenigyvan>
    Please : Search for questions similar to your own before submitting them to the community
    To be the AW6 successor, iWork MUST integrate a TRUE DB, not a list organizer !

  • I want to make a slideshow to view on my television with image's duration ranging from seconds to an hour or more and I want to use my iPhone or iPad mini to control the television through my Apple tv.  I've been unable to locate an app that will do this.

    I want to make a slideshow to view on my television with image's duration ranging from seconds to an hour or more and I want to use my iPhone or iPad mini to control the television through my Apple tv.
    I've been unable to locate an app that will do this.  The Photos app that comes with the phone or iPad has extremely limited duration controls.  PhotoStream seems to load everything from my phone or iPad not allowing me to just load up a set group of images.
    iPhoto for iPad is getting some terrible recent reviews.  I tried a couple other free apps but they don't use Airplay.
    I can do something like this with iPhoto and my MB Air, but it's kind of ugly to have the computer open in order to connect by Airplay to my Apple TV.  I've thought the iPad or iPhone would be a lower profile controller.
    Am I out of luck?

    Thanks for your help.  Since I'm uninterested in loading all my photos (the only option) into photostream, I won't be able to use the settings in ATV.  I guess I'm just stuck with using iPhoto on my MB Air.  Thanks again.
    paul

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

Maybe you are looking for

  • Query Rewrite with regular database Views

    Hi all, I'm trying to make my programmer's life easier by creating a database view for them to query the data, so they don't have to worry about joining tables. However, query rewrite doesn't work no matter how I define the MV and View. Here's an exa

  • How to update order quantity using the fn BAPI_SALESORDER_CHANGE

    Hi experts, I have a requirement that, when the quantity in the delivery is edited manually , the order quantity  in the sales order should be updated automatically. can we achieve that using the Function module BAPI_SALESORDER_CHANGE? if so, kindly

  • How can i use control panel in win vista

    Can i get an old version of icloud ( may be V.2 ) to install an use control panel in win Vista. The newest version (v. 3.1) only works in win 7 or win 8

  • Third Party Imaging and Preseving Partitions

    We're currently using WIM / Imagex for our image - is there anyway to restore an image, and preserve a partition that's already on the disk? As far as I can see, diskpart cleans the disk before restoring. We'd like to partition off a section of the h

  • Delete bookmark in batch file

    Hello, I am trying to create a batch file which will delete a certain bookmark name "References". How do I automate this? I have few other items that the batch is already doing that have already been configured. I'm thinking I need some JavaScript to


HashFlare