Quicktime save using applescript

i have a lots of movies of various sizes and formats that I want to standardise.
I want 720x400 size in the same format as recorded (i.e. no transcoding). I can do this manually using quicktime by re-sizing the movie then saving as a self contained movie.
I know this does'nt actually resize the movie it just puts it into a .mov container that tells quicktime what size to "play" it at next time............
anyhow I`m happy with this solution. And looking at the quicktime library in applescript I see there is a " save self contained" command..... cool!
however I have coded this code:
set infile to choose file with prompt "select file:"
set outfile to choose file name with prompt "Save altered file here:"
try
tell application "QuickTime Player"
activate
close every window
open infile
set dimensions of document 1 to {720, 400}
tell document 1
save self contained file outfile
end tell
-- save document 1 given «class dfil»:file outfile, «class
savk»:self contained
close document 1 saving no
end tell
end try
The save line that is commented in currently does nothing, I don't really understand why.
The save line commented out, gets further by bringing up the save as window in Quicktime but i have no way of selecting save (automatically), I have tried to command a button click via the system events call (which works for other apps), but the script seems to be stalling at the save line, i.e. the button click is never executed.
anyone got any ideas?
cheers
Steve

sorry code came out wrong
set infile to choose file with prompt "select file:"
set outfile to choose file name with prompt "Save altered file here:"
try
tell application "QuickTime Player"
activate
close every window
open infile
set dimensions of document 1 to {720, 400}
tell document 1
save self contained file outfile
end tell
-- save document 1 given «class dfil»:file outfile, «class
savk»:self contained
close document 1 saving no
end tell
end try
Message was edited by: Steven Prigg

Similar Messages

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

  • Quicktime export using applescript/folder actions

    I have about 500Gig of encoded H264 footage.
    I want to be able to "bulk" change video properties on all of the video so that when I view it in front row it isn't letter boxed.
    I can do this manually, save as a .MOV and all is fine.
    anyone tried something like this as an applescript?
    I have scripted eyetv quite a bit so I`m quite familiar with applescript, just being lazy I suppose!
    any help greatly received !
    * looking in the quicktime applescript library *
    Steve

    The nature of your question implies that you're unfamiliar with Folder Actions...
    I'd like to skip them or write the AppleScript in a way that handles this.
    By their very nature, Folder Actions are passed a list of newly-added files. Your Folder Action script should look something like:
    on adding folder items to my_folder after receiving the_files
      -- your code goes here
    end adding folder items to
    where, in this case, the_files is a list of the newly-added files. It won't include pre-existing files, so all you need to do is iterate through the_files and you're set. Something like:
    on adding folder items to my_folder after receiving the_files
              tell application "iPhoto"
                        repeat with each_photo in the_files
                                  try
                                            import each_photo to album "Europe 2012"
                                  end try
                        end repeat
              end tell
    end adding folder items to
    The only caveat here that I can think of is the fact it's a DropBox folder, so there might be some odd latency in the files appearing in the directory, but I don't use Dropbox to know.
    Note that in the above I import each photo independently, via a repeat loop. This might not be necessary, and you might be able to pass the entire the_files variable to the import command to have all the images imported in one go - I haven't tried that, though.

  • Having trouble using applescript to save pdf as excel spreadsheet

    I have been trying to use applescript to create an automator action to convert some downloaded PDF's to .xlsx format.  After reviewing a good bit of the SDK documentation, I came up with the following scripting:
    tell application "Adobe Acrobat Pro"
                                  open theFile
                                  save front document to file theNewFile using conversion "com.adobe.acrobat.xlsx"
      close front document
    end tell
    This script works fine when I use the "com.adobe.acrobat.plain-text" conversion or the png or jpeg conversion. However, I cannot get it to work with "com.adobe.acrobat.xlsx" or "com.adobe.acrobat.spreadsheet".  Note that although I didn't copy the code here that sets theNewFile variable, I have been changing it to the appropriate file extension when changing conversion strings.
    When I execute the script using one of the problem conversion strings, Acrobat opens the file successfully, but it just sits there, as if it does not understand the save command at all.
    I guess I should mention that the whole goal here is to actually convert the PDF's to CSV eventually.  The next step was going to be to open the file in Excel and save as CSV.  If anyone knows a *free* way to go straight from PDF to CSV using Applescript/Automator without having to go through all these other programs, I would be very appreciative for the suggestion.  This conversion is just a small part of a very lengthy workflow but it is causing me the most trouble.

    Hello Jonathan,
    Ok i have only one final question.
    Do you know how to work in photoshop, don't you? Ok i think yes.
    Well i have 2 ways to do that, i did one action from photoshop that will get the image inside folder and will convert this image in pdf. Abouve the line of script
    that you have to attach to folder action and the action for Photoshop.
    About the action for Photoshop give me your email address and I send you, or do it your self. You have to do this: open one image in JPG, go to action, go new set, put your name of set, put the name of action if you like you can change the name, go print with preview, print and set save as PDF close your file and stop the action.
    Now that you have to do is put all your files inside your folder and leave the Photoshop do it for you, ok?
    Good Luck
    Hack
    property speak_alert : false -- if true, the script will speak the alert. If false, the script will display an alert dialog
    property dialog_timeout : 30 -- set the amount of time before dialogs auto-answer.
    property copychecksindicator : false
    property itemcheck_delaytime : 2
    property foldercheck_delaytime : 3
    property speciallabelindex : 7
    on adding folder items to this_folder after receiving added_items
    if copychecksindicator is true then
    set the added_items to my checkaddeditems(the added_items)
    if the added_items is {} then return "no vaild items"
    end if
    tell application "Finder"
    activate
    set this_folder to choose folder with prompt "pdf"
    set these_files to every file of folder this_folder
    end tell
    tell application "Finder"
    repeat with i from 1 to number of items in these_files
    set this_path to (item i of these_files) as string
    tell application "Adobe Photoshop CS2"
    launch
    open file (this_path as string)
    set this_files to current document
    do action "Jpg" from "Jpg para Pdf"
    end tell
    end repeat
    end tell
    end adding folder items to

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

  • QuickTime - Save Export Settings -  script help needed

    Currently I am using Panther 10.3.9 - with QT PRO 7.02 - ( I do not want to
    upgrade to Tiger at this time unfortunately)...
    * MY GOAL: to be able to save export preferences in QuickTime pro.
    Since QuickTime does not seem to be able to save export presets... I
    downloaded the the script collection from
    From: Scriptable Applications: Quicktime Player
    Location: http://www.apple.com/applescript/quicktime/
    and created export settings and tried ....
    Save Export Settings.scpt
    ... but the file that got saved will not open in QT PRO - OSX and wants to
    open something from old os9....
    what do I do?

    = = = (see scripts below)
    * here is my basic workflow ...
    - load a QuickTime movie
    - adjust the QuickTime movie export settings
    - save a test copy ( validating the settings)
    - run the "save export settings.scpt" with name "set1test"
    Then
    - open and run the "Export QuickTime movie.scpt" with the name " test movie"
    - run the new test movie - and when I check info - it does NOT reflect the desired settings...
    = = =
    One issue is - this line...
    export movie 1 to new_file as QuickTime movie using settings "set1test"
    ... It doesn't seem to care what the settings file name is - and if I change that name to a nonexistent name - it still exports the movie without an error.... Therefore it leads me to believe that it's not using it to begin with....
    - another issue is that the settings file "set1test" says it is the kind = "QuickTime settings document" - however it has a blank icon in the Finder - and there does not seem to be any way to open the file with QuickTime 7.02 - and it can to open something classic mode when I double click on it.
    = = = the Save settings script...
    tell application "QuickTime Player"
    activate
    try
    if not (exists movie 1) then error "No movies are open."
    stop every movie
    set the target_file to choose file name with prompt "name & location for the QT settings file:"
    save export settings movie 1 for QuickTime movie to target_file with replacing
    end try
    end tell
    === the Export QuickTime movie.scpt
    tell application "QuickTime Player"
    activate
    try
    if not (exists movie 1) then error "No movies are open."
    stop every movie
    set the movie_name to "mytest.mov"
    if (can export movie 1 as QuickTime movie) is true then
    set the new_file to ¬
    choose file name with prompt "Enter a name:" default name movie_name
    export movie 1 to new_file as QuickTime movie using settings "set1test"
    end if
    end try
    end tell

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

  • How to append paragraph in text file of TextEdit application using applescript

    how to append paragraph in text file of TextEdit application using applescript and how do i save as different location.

    christian erlinger wrote:
    When you want to print out an escape character in java (java is doing the work in client_text_io ), you'd need to escape it.
    client_text_io.put_line(out_file, replace('your_path', '\','\\'));cheersI tried replacing \ with double slash but it just printed double slash in the bat file. again the path was broken into two lines.
    file output
    chdir C:\\DOCUME~1\
    195969\\LOCALS~1\\Temp\
    Edited by: rivas on Mar 21, 2011 6:03 AM

  • Green frames when using AppleScript to export from QT

    Not sure if this is a QuickTime issue, h.264 issue, or an AppleScript issue, but i thought I'd start here since I know the least about AppleScript and have some clues to the problem.
    I'm creating an Automator workflow that requires a run AppleScript action. My plan is to use applescript to have QuickTime Pro 7.6.6 export an image sequence from a QuickTime movie in h.264, using a QuickTime settings file I've already exported. The script points to the settings file and and exports the sequence to the output folder I've specified. Im looking to export one frame per second. Running the script works well and I'm almost getting the result I want, except that each frame that is exported is entirely green.
    Interestingly, when I run the exact same process manually, using the exact same settings, the export works fine, and the frames are correct. Additionally, exporting via AppleScript brings up a different status bar than when exporting manually, which leads me to believe that AppleScript is the culprit. Perhaps it's running some sort of outdated process? The AppleScript status bar comes down from the top middle of the video frame, while exporting manually, brings up a floating status bar. They look decidedly different.
    Has anyone run into this problem? Can possibly shed light on it? Possible AppleScript work around?  This only seems to effect h.264 videos. If I run the same AppleScript on a prores file, the images export correctly.

    Including the applescript in question could be helpful!
    tell application "QuickTime Player 7"
              export front document as image sequence using settings "Macintosh HD:Users:grato:Documents:SYNC:Sync Assets:settings:Sync_QTexport_setting.qtes" to "Macintosh HD:Users:grato:Documents:SYNC:Sync Assets:Assets:temp:Sync-"
    end tell

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

  • Using AppleScript to remotely shutdown a mail server?

    Hello all AppleScript gurus,
    Here is the situation. My friend's company (it is a small company) uses a Linksys NAS 200 as a mail server. They recently purchased an APC BackUps 1000 Pro as the universal power supply (yes I am aware that it is not suitable for business purposes, but the boss is a cheapskate).
    I would like to be able to shutdown the server remotely when the UPS tells the mac laptop (running 10.7.5) that power is being supplied by the battery. However, APC's software for OS X is nonexistant, and the options in energy saver in system prefs are limited.
    Would it be possible to use AppleScript to send a message to the server to shutdown upon receiving a warning from the UPS? If so, how would this be accomplished?
    Many thanks in advance in case I forget to say thank you again after. If further information is required, I'll do my best to supply the info.
    Thanks again.
    Ian

    I'd figure out how to do the shutdown from the command line.  You then should be able to do this from an applescript.
    There is some way of initiating an apple script on a remote machine but I do not know how.
    What OS is the remote server using?
    Robert

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

  • 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

Maybe you are looking for

  • Resolution of extended type

    I have a VI where I'm performing various arithmetic calculations to an extended variable of 24 characters. Somehow, however, when I attempt to add a number like 256 to 100,000,000,000,000,000,000,000, it loses it. I've done a little messing around, a

  • Help! Laptop died/new laptop.  How do I import my itunes?

    My old laptop died. I did backup all my tunes to a memory stick and have most of my tunes on my ipod. How can I get my whole library onto the new laptop! Thanks

  • Hypertrend Cursor displaying incorrect data

    Upgrading to Lookout V6.6 build 49152 from 5.1. The hypertrends work but the cursor information is always the same and doesnt change when moving the cursor.

  • System automatically restored manufacture settings

    Hello, this morning when I turn on my computer it had automatically restored manufacture settings. As in, it was the same as when I connected it from the box. All my documents are gone!!!

  • Project files don't open after Trial Version

    After trying the trial version of Final Cut Pro X on my home computer I took the external hard drives to my editor, who has a purchase version of FCPX, but now none of the project files will open. Does apple put some kind of lock on project files onc