Add a script to Automator's actions, or add an action to Automator's librar

Total Applescript newbie here. My end goal is to write a script or automator that automatically trims 10 seconds off selected podcasts.
I know that Doug's Applescript website has something along those lines, but it's not truly automatic.
What I'd really like to do is attach a folder action so that as soon as they download the end credits are trimmed.
With automator, it's easy enough to get the finder items in the folder, and pass them to the Set iTunes Info library action, but the Start and End times of iTunes tracks aren't in there.
I tried to edit the actual script that that calls, but it's not-editable.
I tried to edit Doug's script, but I can't figure out how to tell it to pick a file from a folder as the selected track to edit.
I was thinking of an automator action that basically goes along these lines:
Get Specified Finder Items (preselecting the download folder the podcasts are dumped to)
Get Folder Contents
Run this script. (but this is where I can't figure out how to run a script and use the results from the last two automator actions)
Any ideas appreciated, or suggestion on how to just go pure Applescript on the task. I know the Applescript would read something along the lines of:
Tell application Finder
get the folder contents?
maybe set the file name or track name as a variable
Tell application iTunes
Set start of selected file/track to 15

Ah, you've made me a happy man this evening. I missed the Run AppleScript action in Automator, but knew there had to be a way to do something like that.
Your particular script doesn't function, it gives an unknown error on completion, but I was able to modify a Doug's AppleScript that lets you trim start or finish on items you manually select and use it as you suggested.
So here's what I ended up doing.
Automator Action which is saved as a plug-in to the Folder Actions for the folder for the Podcasts I want to trim. The Automator action reads as follows:
*Find Sources in iTunes*
-Find Songs Whose Album Contains MyPodcast
*Get Selected iTunes items*
-it's pulling all tracks in that folder, which is fine
*Filter Sources in iTunes items*
(I had to do this because before I added this step my selected podcasts showed up in results, but so did any item I had highlighted (such as the current playing track) in the results, and was passed to the final action)
*Run AppleScript*
<pre style="font-family:Monaco, monospace;border:2px inset #99f;overflow:auto;width:500px;padding:.5em;color:#000;background:#ccf;">
on run {input, parameters}
tell application "iTunes"
set trackers to input
repeat with theTrack in trackers
set start of theTrack to 11
set finish of theTrack to ((get finish of theTrack) - 18)
end repeat
end tell
return input
end run</pre>
There's probably a more elegant way to do this, and faster, as this one takes several seconds to go through the entire iTunes library each time it's ran. That's why I was trying to pass the folder contents directly to the set info action. It's kind of annoying that the built-in Automator action for this is limited on the info items it sets. It would be really cool if Apple didn't make those scripts non-editable. I could have learned exactly what I was after just by picking apart their script.
Anyways, my motivation for this was partly to learn, but inspired from a particular podcast from a local public radio station that I listen to where they bracket the beginning and end of the podcast with the typical "please donate" stuff. Normally I don't mind a short pre-roll or pledge request, but this particular one the woman has such an annoying voice, it's like fingernails on chalkboard to me, otherwise I wouldn't have bothered spending hours trying to learn how to do this to save 30 seconds of listening on a weekly podcast. LOL.
Thanks again for your pointer, I'll probably play with this some more if anyone else wants to chime in on better methods, but I'll mark it as answered as it did point me to a working solution.

Similar Messages

  • I want to write a script or Automator workflow/app that emails a random shortcut of the day to three recipients. The source is from an Excel spreadsheet. One column is the shortcut, and the second column is the definition. Anyone have experience?

    I want to write a script or Automator workflow/app that automatically emails a random shortcut of the day to three recipients. The source is from an Excel spreadsheet. One column is the shortcut, and the second column is the definition. Anyone have similar experience and know that this would work?

    I have had a first stab at the script, below.  It uses a file to store the shortcuts and command [descriptions].  You should be able to see from the script annotations how to add a new one.  (I populated 1-4 with real data, but got lazy after that, so you have a few placeholders to work with first.
    As I have noted, once you are happy that you have all the data in the file, you can comment out part of the script for ongoing use.  (BTW, my reluctance to use Excel is that I don't currently have it installed and I don't want to offer wrong advice.  If you have Numbers, I do have that and could probably modify to work with a spreadsheet from there.  This might be especially useful if you have the data already sitting in Excel.)
    A few things came-up whilist I was writing the script:
    1.     Currently, all recipients will not only get the same tip at the same time, but they will see the names and email addresses of the others who receive them.  It is possible to modify this.
    2.     I have added a property gRandomCheck which keeps track of which shortcut has already been used (since the last time the script was compiled.  This will prevent the same tip being sent more than once.    When all tips have been sent once, the script will alert you and not send anything until reset.  It does not check on a per-addressee basis (which would be a refinement).  (If you add a new addressee at this stage, the whole process will start again, and you may not really want this to be the behaviour.)
    3.     The way that I have built the list, commandList, is deliberately cumbersome - it's for the sake of clarity.  If you prefer, you can construct the whole list as {{shortcut:"X", command:"X"}, {shortcut:"Y", command:"Y"}}
    Have a look - I am sure you will have questions!
    SCRIPT STARTS HERE  Paste the following lines (thru the end) into a new AppleScript Editor document and press RUN
    --The property gRandomCheck persists between runs and is used to stop sending the same hint twice.
    property gRandomCheck : {}
    --I am defining a file on the desktop.  It doesn't have to be in this location
    set theFolder to path to desktop
    set commandFile to (theFolder as text) & "CommandFile.csv"
    --(* Unless you need to change the file contents you do not need to write to it each time.  Remove the "--" on this line and before the asterisk about 18 lines below
    --Follow this format and enter as many records as you like on a new line - each with a unique name
    set record1 to {shortcut:"Z", command:"Undo"}
    set record2 to {shortcut:"R", command:"Record"}
    set record3 to {shortcut:"⇧R", command:"Record Toggle"}
    set record4 to {shortcut:"⌘.", command:"Discard Recording & Return to Last Play Position"}
    set record5 to {shortcut:"X", command:"x"}
    set record6 to {shortcut:"X", command:"x"}
    set record7 to {shortcut:"X", command:"x"}
    set record8 to {shortcut:"X", command:"x"}
    set record9 to {shortcut:"X", command:"x"}
    set record10 to {shortcut:"X", command:"x"}
    set record11 to {shortcut:"X", command:"x"}
    set record12 to {shortcut:"X", command:"x"}
    set record13 to {shortcut:"X", command:"x"}
    --Make sure you add the record name before randomCheck:
    set commandList to {record1, record2, record3, record4, record5, record6, record7, record8, record9, record10, record11, record12, record13}
    --This part writes the above records to the file each time.
    set fileRef to open for access commandFile with write permission
    set eof of fileRef to 0
    write commandList to fileRef starting at eof as list
    close access fileRef
    --remove "--" here to stop writing (see above)*)
    --This reads from the file
    set fileRef to open for access commandFile with write permission
    set commandList to read fileRef as list
    close access fileRef
    --Here's where the random record is chosen
    set selected to 0
    if (count of gRandomCheck) is not (count of commandList) then
              repeat
                        set selected to (random number from 1 to (count of commandList))
                        if selected is not in gRandomCheck then
                                  set gRandomCheck to gRandomCheck & selected
                                  exit repeat
                        end if
              end repeat
    else
              display dialog "You have sent all shortcuts to all recipients once.  Recompile to reset"
              return
    end if
    --This is setting-up the format of the mail contents
    set messageText to ("Shortcut: " & shortcut of record selected of commandList & return & "Command: " & command of record selected of commandList)
    tell application "Mail"
      --When you're ready to use, you probably will not want Mail popping to the front, so add "--" before activate
      activate
      --You can change the subject of the message here.  You can also set visible:true to visible:false when you are happy all is working OK
              set theMessage to (make new outgoing message with properties {visible:true, subject:"Today's Logic Pro Shortcut", content:messageText})
              tell theMessage
      --You can add new recipients here.  Just add a new line.  Modify the names and addresses here to real ones
                        make new to recipient with properties {name:"Fred Smith", address:"[email protected]"}
                        make new to recipient with properties {name:"John Smith", address:"[email protected]"}
      --When you are ready to start sending, remove the dashes before "send" below
      --send
              end tell
    end tell

  • Script or automator to auto-log into wireless network?

    Is it possible to write a script or automator action to automatically log into a wireless network? I'd like to run this at startup to auto connect to a wireless access point.
    Thanks!

    I'm certainly no expert on this topic, but...doesn't your computer already do this automatically? Mine certainly does.
    In your System Preferences, click on the "Network" pane, then click on "Airport" on the left column, then make sure the "Ask to join new networks" click-box is checked. When it is, you will see this text below it:
    "Known networks will be joined automatically. If no known networks are available, you will be asked before joining a new network."
    Final step: Now click the "Advanced" button at the bottom of the Network pane, and make sure "Remember networks this computer has joined" box is checked. That is essential! Then close the System Preferences window. Done!
    Henceforth, each time you encounter a hitherto as-yet unknown network for the first time, you will be asked before joining it. But once you have joined it, even only once, you will never be asked again! The computer will automatically rejoin any previously recognized wireless network you encounter.
    One final detail: if you find yourself in a cloud of two or more overlapping wireless hotspots simultaneously, and the computer is not joining the one you prefer, then go back to that "Advanced" button in the Network pane, and rearrange the list of remembered Networks to have the one you prefer at the top. Then the computer will always join that one first, if it is available.
    This is how I have my computer set up, and each time I restart or log on at home, it instantly and without asking automatically joins my home wireless network -- I'm not even conscious of it happening. By the time I sit down and launch Safari or Mail, I'm already online with no actions having been taken on my part. And if I find myself in my favorite cafe, I open my MacBook and it instantly and automatically joins the cafe's network, without asking, since my home network is now out of reach and the cafe's network is the second-highest on my priority list and thus the highest among available detected remembered Networks.
    Hope this answers your problem. If you instead were seeking a different answer to a slightly different problem, then please re-clarify! Hopefully then someone who's more of an expert in Networks can answer it.

  • Can Apple Script or Automator handle large client email tasks?

    Hi,
    I am a relatively new Mac user but currently work on a MacBook and Imac G5 with 10.4.9. I have a client list of approxamitely 900 people and I want to send an email to all 900 announcing a change in product services. Is there an Apple Script or automator script (or somewhere I could go to purchase one) that will allow me to import my name and email list in .csv or excel format and then send a slightly customized email to all. I just want the subject line and greeting to the email to include their first name so it looks as if I have taken the time to send them a personal email.
    Can anyone steer me in the right direction. Thanks in advance!

    Hi,
    Here's a script to disable a rule" --> tell application "Mail" to set enabled of rule "weekend message" to false
    Change "weekend message" by the exact name of your rule.
    Make an (iCal Events or Launch agent PLIST or cron) to run the script on Monday at a specific time.

  • Using tcm to load test scripts into mtm, but action fails.

    Hi,
    I am trying to load test scripts into mtm but action fails saying : "The work item cannot be saved because at least one field contains a value that is not allowed."
    My guess is that this issue is due to the parameters/attributes we give to a test case([testmethod], [description()], etc.). I am unable to find what all parameters/attributes that can be given to a test case.
    Please help me with this issue.
    Regards,
    Payal Prajapati
    Payal Prajapati.

    Hi,
    I use VS 2012.
    One of my test method code is:
    /// <summary>
            /// Test Scenario to validate auto escalation of chat if within some time analyst does not respond to user.
            /// </summary>
            [TestMethod]
            [Description("Validating scenario, Auto-Escalation of chats to other Analyst.")]
    [Priority(2)]
            [TestCategory("Acceptance")]
    public void ValidatingAutoEscalationOfChatsToOtherAnalyst()
                User alice = new User(User1);
                alice.SubmitChatInfo();
                Analyst admin = new Analyst(Analyst_Admin);
                admin.Login();
                Analyst analysttier1 = new Analyst(Analyst_Tier1);
                admin.SelectQueues(Tier1Queue);
                admin.MakeAvailable();
                alice.USendMessage("I have a problem.");
                admin.AnalystWaitForAutoEscalation(25000);
                string Message1 = alice.GetAnalystName();
                analysttier1.Login();
                analysttier1.SelectQueues(Tier1Queue);
                analysttier1.MakeAvailable();
                alice.USendMessage("I have a problem.");
                string Message2 = alice.GetAnalystName();
                analysttier1.ASendMessage("hello, i'm here to help.");
                SprtTestContext.sprtTestContext.WriteLine("Earlier agent was: '" + Message1 + "' and present agent is: '" + Message2 + "'.");
                Assert.AreNotEqual<string>(Message1, Message2, "=> Issue in auto escalation.");
                analysttier1.WrapChatClose(4, "fixed", "comments");     }
    Payal Prajapati.

  • Repeating a script for an advanced action

    I've created and advanced action for a click button. The properties are if the textbox is empty (v_null) to display a failure messge, if not display a correct message. The advanced action is working perfectly but it won't repeat it's self. So for example, if the user doesn't type something in text box  and clicks the button, the script runs and gives the correct message, but if the user  attempts to write someting after the first message pops in the text box and clicks on the button again, nothing displays. It's like the scipt will only run once.
    Is there a way to have an advanced action repeat it's self?
    Here is the script:

    Captivate's Advanced Actions are event-driven.  So you can only trigger them via some kind of on-screen event.
    All of the events available to you are listed here:
    http://www.infosemantics.com.au/adobe-captivate-advanced-actions/run-time-events
    Once you've triggered the advanced action as a result of clicking a button, then you need another button click or event of some kind to run the action again.  Captivate does not currently allow you to call an advanced action from another action.

  • Can't add "Run Shell Script" in Automator

    When I drag "Run Shell Script" to the right pane in Automator nothing happens. All other applications I've tried can be dragged to the right pane. In the system.log I can find the following message:
    Feb  7 16:56:48 Bananaboat Automator[195]: Error : -[AMWorkflowView _addAction:Kör kommandotolksskript] : * -[NSTextView replaceCharactersInRange:withString:]: nil NSString given.
    "Kör kommandotolksskript" is "Run Shell Script" in Swedish.
    Any ideas how to fix this?

    You might have a corrupted file in the action, in which case you could reload it with something like Pacifist. You can't get the digest of a directory, so for comparison, compressing a copy of /System/Library/Automator/Run Shell Script.action on my desktop gives me the following:
    sha1 digest: c209b69777f6a3301d72ddf0eb0ad4e7d4230741
    md5 digest: 09e4ade9056ada3294ffb93bd16de1a7

  • Is there a script or automator action to change Preferences in Safari?

    When I log on to my ISPs website to clean out my spam filter, the site redirects me to a second area that contains the filtered spam. Each time I access it I must change my "Accept Cookies from "Only sites you navigate to" to "Always". The problem is remembering to change it BACK. Is there an applescript or automator thingy that will allow me to to make these changes? I'm using Safari 3.1.2.
    Thank you.

    Andrew, this script also really helped me, and it has the potential to help thousands of others. Safari 3 cookie management is a work in progress. SafariPlus did a wonderful job of improving this previously, but so far no Leopard version. Even limited cookie acceptance accepts waaay too many. So I decided to delete all my cookies, and turn on just limited acceptance the first time I visit certain websites that really need cookies, to get the primary account cookies in place, and then set cookie acceptance level back to never for general browsing.
    Then I looked for an Applescript to simplify this, and found the one you wrote. I then modified it for my purposes and it works great. I run it with XKeys and it makes life easy, and more secure. I think many others could benefit from this, so I think one of us should publish it perhaps at Versiontracker, etc. Your basic script, so I vote for you. If not, can I? Here's my mod:
    tell application "Safari" to activate
    tell me to activate
    display dialog "Would you like to accept LIMITED cookies?" buttons {"Cancel", "OK"} default button "OK"
    if button returned of result is "OK" then
    tell application "Safari" to activate
    tell application "System Events"
    tell process "Safari"
    click menu item "Preferences…" of menu "Safari" of menu bar 1
    delay 1
    tell window 1 to click button "Security" of tool bar 1
    delay 1
    tell window "Security"
    tell group 1
    tell group 1
    tell radio group 1
    click radio button "Only from sites you navigate to"
    delay 0.5
    keystroke "w" using command down
    end tell
    end tell
    end tell
    end tell
    end tell
    end tell
    end if
    delay 60
    tell me to activate
    display dialog "Click 'Cancel' to continue accepting LIMITED cookies... Click 'Not Yet' for continued reminders... Click 'Revert' to STOP accepting cookies." buttons {"Cancel", "Not Yet", "Revert"} default button "Revert"
    if button returned of result is "Revert" then
    tell application "Safari" to activate
    tell application "System Events"
    tell process "Safari"
    click menu item "Preferences…" of menu "Safari" of menu bar 1
    delay 1
    tell window 1 to click button "Security" of tool bar 1
    delay 1
    tell window "Security"
    tell group 1
    tell group 1
    tell radio group 1
    click radio button "Never"
    delay 0.5
    keystroke "w" using command down
    end tell
    end tell
    end tell
    end tell
    end tell
    end tell
    else
    if button returned of result is "Not Yet" then
    repeat while button returned of result is "Not Yet"
    tell application "Safari" to activate
    delay 30 -- increase if desired to lengthen interval between reminders
    tell me to activate
    display dialog "Click 'Cancel' to continue accepting LIMITED cookies... Click 'Not Yet' for continued reminders... Click 'Revert' to STOP accepting cookies." buttons {"Cancel", "Not Yet", "Revert"} default button "Revert"
    end repeat
    if button returned of result is "Revert" then
    tell application "Safari" to activate
    tell application "System Events"
    tell process "Safari"
    click menu item "Preferences…" of menu "Safari" of menu bar 1
    delay 1
    tell window 1 to click button "Security" of tool bar 1
    delay 1
    tell window "Security"
    tell group 1
    tell group 1
    tell radio group 1
    click radio button "Only from sites you navigate to"
    delay 0.5
    keystroke "w" using command down
    end tell
    end tell
    end tell
    end tell
    end tell
    end tell
    end if
    end if
    end if

  • Adding a perl script to automator

    Hi
    I have a script that do a search and replace in a file in Perl. This script work just fine when executed from the command line, but in automator it result in an empty file.
    Any idea?
    Eventually I want to replace the $file variable with the arguments passed from previous actions, but for now I'm "in debug mode" only.
    Here is the basic of the script:
    my $file="full Unix path to file";
    my $search="that text";
    my $replace="this text";
    my @contents;
    open (F, $file) || die "Can't open - $!\n";
    @File = <F>;
    close (F);
    open (F, ">$file") || die "Can't open - $!\n";
    for (@File) {
    s/$search/$replace/g;
    push(@contents,$_);
    # Go to the beginning of the file
    seek(F,0,0);
    # Update the contents with the data from our array
    print F (@contents);
    close(F);

    Hi,
    It looks like the script action for Perl in Automator is buggy...
    - First, when I select perl in the shell selection, save the workflow, close it then reopen it, the revert back to bash! This cannot work for sure for Perl...
    - Also, from what I can see in the debug tests I made, that is the push command that does not work correctly. Instead of pushing the value of $_ (current file line in this case) it add blank (nothing) to the $contents variable. That's why the file goes empty at the end.
    So that's really a bug in Automator, as I cannot see any other reason, the scrpt works well in standalone mode (from terminal).

  • Integrate Soundtrack Pro script with Automator

    I have a Soundtrack Pro script that I would like to somehow use with Automator. Right now I simply drop audio files onto the icon of this script and it does it's thing. I would like to set up a type of watch folder using folder actions so that when I put files into a folder, the script automatically runs and processes the file(s), then moves them to a "done" folder. I have tried playing around in Automator but got nowhere with it. I have no idea how to do this. Any help would be greatly appreciated on how to make this work. This is the STP script (Applescript generated automatically from STP) that I use.
    property type_list : {"AIFC", "AIFF", "MPG3", "MooV", "NeXT", "Sd2f", "WAVE"}
    property extension_list : {"aif", "aiff", "mp3", "m4a", "sdII", "mov", "au", "wav"}
    on run
    try
    set myFile to choose file with prompt "Please Pick a File" of type type_list default location (path to desktop) without invisibles and multiple selections allowed
    processFile(myFile)
    on error errText number errNum
    if (errNum is equal to -128) then
    end if
    end try
    end run
    on loadFiles(this_file)
    repeat with one_item in this_file
    my processFile(one_item)
    end repeat
    end loadFiles
    on open these_items
    repeat with i from 1 to the count of these_items
    set this_item to (item i of these_items)
    set the item_info to info for this_item
    if folder of the item_info is true then
    processfolder(thisitem)
    else if (alias of the item_info is false and the file type of the item_info is in the type_list) or (the name extension of the item_info is in the extension_list) then
    processFile(this_item)
    end if
    end repeat
    end open
    on processFile(this_file)
    with timeout of 600 seconds
    tell application "Soundtrack Pro"
    activate
    open this_file
    end tell
    process()
    try
    tell application "Soundtrack Pro"
    tell front audio file document
    save
    close saving no
    end tell
    end tell
    on error errMsg number errNum
    display dialog errMsg & "/" & errNum buttons {"OK"} default button 1
    return "error"
    end try
    end timeout
    end processFile
    on process()
    with timeout of 600 seconds
    try
    tell application "Soundtrack Pro"
    activate
    tell front audio file document
    set theEntireDuration to the duration
    make new normalize action at after last action with properties {position:0.0, duration:theEntireDuration, enabled:true, name:"NormalizeOperation", preset state:"<?xml version=\"1.0\" encoding=\"UTF-8\"?><!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\"><plist version=\"1.0\"><dict> <key>data</key> <data> AAAAAAAAAAAAAAACAAAAAEB+qcwAAAABAAAAAA== </data> <key>manufacturer</key> <integer>1952542846</integer> <key>name</key> <string>Untitled</string> <key>subtype</key> <integer>1987013664</integer> <key>type</key> <integer>1635085688</integer> <key>version</key> <integer>0</integer></dict></plist>", normalization level:0.0}
    make new effect action at after last action with properties {position:0.0, duration:theEntireDuration, enabled:true, name:"Apple:Compressor", preset state:"<?xml version=\"1.0\" encoding=\"UTF-8\"?><!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\"><plist version=\"1.0\"><dict> <key>data</key> <data> AAAARAABAQAAAAALRU1BR1BQU1QAAACaAAAAAMBAAABBUAAAAAAAAECZmZoAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAA= </data> <key>manufacturer</key> <integer>1162690887</integer> <key>name</key> <string>Untitled</string> <key>subtype</key> <integer>154</integer> <key>type</key> <integer>1635083896</integer> <key>version</key> <integer>0</integer></dict></plist>"}
    make new normalize action at after last action with properties {position:0.0, duration:theEntireDuration, enabled:true, name:"NormalizeOperation", preset state:"<?xml version=\"1.0\" encoding=\"UTF-8\"?><!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\"><plist version=\"1.0\"><dict> <key>data</key> <data> AAAAAAAAAAAAAAACAAAAAD+wEHsAAAABAAAAAA== </data> <key>manufacturer</key> <integer>1952542846</integer> <key>name</key> <string>Untitled</string> <key>subtype</key> <integer>1987013664</integer> <key>type</key> <integer>1635085688</integer> <key>version</key> <integer>0</integer></dict></plist>", normalization level:0.0}
    end tell
    end tell
    on error errMsg number errNum
    display dialog errMsg & "/" & errNum buttons {"OK"} default button 1
    return "error"
    end try
    end timeout
    end process
    on processfolder(thisfolder)
    set these_items to list folder this_folder without invisibles
    repeat with i from 1 to the count of these_items
    set this_item to alias ((this_folder as text) & (item i of these_items))
    set the item_info to info for this_item
    if folder of the item_info is true then
    processfolder(thisitem)
    else if (alias of the item_info is false and the file type of the item_info is in the type_list) or (the name extension of the item_info is in the extension_list) then
    processFile(this_item)
    end if
    end repeat
    end process_folder

    without fully understanding what's going on with the script I believe you can add a line after
    processFile(this_item)
    end if
    tell application "finder" to move this_item to folder "My folder" of home
    This will move it to the folder called "My folder" at teh top level of your home directory. to express a longer folder path you'd use something like this
    tell application "finder" to move this_item to folder folder "1" of folder "My folder" of home
    I hope you get the idea.
    Lots of places on the web to learn some apple script. start [HERE|http://developer.apple.com/documentation/AppleScript/Conceptual/AppleScri ptLangGuide/conceptual/ASLRfundamentals.html#//appleref/doc/uid/TP40000983-CH218-SW7].
    <pre style="
    font-family: Monaco, 'Courier New', Courier, monospace;
    font-size: 10px;
    margin: 0px;
    padding: 5px;
    border: 1px solid #000000;
    width: 720px; height: 335px;
    color: #000000;
    background-color: #ADD8E6;
    overflow: auto;"
    title="this text can be pasted into the Script Editor">
    property type_list : {"AIFC", "AIFF", "MPG3", "MooV", "NeXT", "Sd2f", "WAVE"}
    property extension_list : {"aif", "aiff", "mp3", "m4a", "sdII", "mov", "au", "wav"}
    on run
    try
    set myFile to choose file with prompt "Please Pick a File" of type type_list default location (path to desktop) without invisibles and multiple selections allowed
    processFile(myFile)
    on error errText number errNum
    if (errNum is equal to -128) then
    end if
    end try
    end run
    on loadFiles(this_file)
    repeat with one_item in this_file
    my processFile(one_item)
    end repeat
    end loadFiles
    on adding folder items to thisFolder after receiving these_items
    repeat with i from 1 to the count of these_items
    set this_item to (item i of these_items)
    set the item_info to info for this_item
    if folder of the item_info is true then
    process_folder(this_item)
    else if (alias of the item_info is false and the file type of the item_info is in the type_list) or (the name extension of the item_info is in the extension_list) then
    processFile(this_item)
    end if
    tell application "finder" to move this_item to folder "My folder" of home
    end repeat
    end adding folder items to
    on processFile(this_file)
    with timeout of 600 seconds
    tell application "Soundtrack Pro"
    activate
    open this_file
    end tell
    process()
    try
    tell application "Soundtrack Pro"
    tell front audio file document
    save
    close saving no
    end tell
    end tell
    on error errMsg number errNum
    display dialog errMsg & "/" & errNum buttons {"OK"} default button 1
    return "error"
    end try
    end timeout
    end processFile
    on process()
    with timeout of 600 seconds
    try
    tell application "Soundtrack Pro"
    activate
    tell front audio file document
    set theEntireDuration to the duration
    make new normalize action at after last action with properties {position:0.0, duration:theEntireDuration, enabled:true, name:"NormalizeOperation", preset state:"<?xml version=\"1.0\" encoding=\"UTF-8\"?><!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\"><plist version=\"1.0\"><dict> <key>data</key> <data> AAAAAAAAAAAAAAACAAAAAEB+qcwAAAABAAAAAA== </data> <key>manufacturer</key> <integer>1952542846</integer> <key>name</key> <string>Untitled</string> <key>subtype</key> <integer>1987013664</integer> <key>type</key> <integer>1635085688</integer> <key>version</key> <integer>0</integer></dict></plist>", normalization level:0.0}
    make new effect action at after last action with properties {position:0.0, duration:theEntireDuration, enabled:true, name:"Apple:Compressor", preset state:"<?xml version=\"1.0\" encoding=\"UTF-8\"?><!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\"><plist version=\"1.0\"><dict> <key>data</key> <data> AAAARAABAQAAAAALRU1BR1BQU1QAAACaAAAAAMBAAABBUAAAAAAAAECZmZoAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAA= </data> <key>manufacturer</key> <integer>1162690887</integer> <key>name</key> <string>Untitled</string> <key>subtype</key> <integer>154</integer> <key>type</key> <integer>1635083896</integer> <key>version</key> <integer>0</integer></dict></plist>"}
    make new normalize action at after last action with properties {position:0.0, duration:theEntireDuration, enabled:true, name:"NormalizeOperation", preset state:"<?xml version=\"1.0\" encoding=\"UTF-8\"?><!DOCTYPE plist PUBLIC \"-//Apple Computer//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\"><plist version=\"1.0\"><dict> <key>data</key> <data> AAAAAAAAAAAAAAACAAAAAD+wEHsAAAABAAAAAA== </data> <key>manufacturer</key> <integer>1952542846</integer> <key>name</key> <string>Untitled</string> <key>subtype</key> <integer>1987013664</integer> <key>type</key> <integer>1635085688</integer> <key>version</key> <integer>0</integer></dict></plist>", normalization level:0.0}
    end tell
    end tell
    on error errMsg number errNum
    display dialog errMsg & "/" & errNum buttons {"OK"} default button 1
    return "error"
    end try
    end timeout
    end process
    on process_folder(this_folder)
    set these_items to list folder this_folder without invisibles
    repeat with i from 1 to the count of these_items
    set this_item to alias ((this_folder as text) & (item i of these_items))
    set the item_info to info for this_item
    if folder of the item_info is true then
    process_folder(this_item)
    else if (alias of the item_info is false and the file type of the item_info is in the type_list) or (the name extension of the item_info is in the extension_list) then
    processFile(this_item)
    end if
    end repeat
    end process_folder </pre>

  • Writing commands to get specific data channels in the output report via script or automated script generation..

    In my project I have to make certain calculation and then get the data plotted in the given report template. I am using automated script for this. My script is doing all the calculations and then it not selecting and drag-dropping the selected channels on the report template. Its saving the blank report template.
    I am struggling to get the data for specific channels plotted by using the script. I need the selected channels to be plotted on this report template and then get it saved.
    Any help will be deeply appreciated. Thanks
    Solved!
    Go to Solution.

    Hi LaxG,
    Brad is absolute right. It is possible to create your whole layout via script.
    If you have loaded  the example report layout you can copy these lines to create a new line in your plot. This is the recommended object oriented way.
    call Report.Sheets("Blatt 1").Objects("2D-Axis1").Curves2D.Add(e2DShapeLine, "anyName")
    Report.Sheets("Blatt 1").Objects("2D-Axis1").Curves2D.Item("anyName").Shape.XChannel.Reference               = "[1]/Zeit"
    Report.Sheets("Blatt 1").Objects("2D-Axis1").Curves2D.Item("anyName").Shape.YChannel.Reference               = "[1]/Geschwindigkeit"
    For performance reasons it's recommended to use the it like this.
    dim oLine
    set oLine = Report.Sheets("Blatt 1").Objects("2D-Axis1").Curves2D.Item("anyName").Shape
    oLine.XChannel.Reference               = "[1]/Zeit"
    oLine.YChannel.Reference               = "[1]/Geschwindigkeit"
    Like Brad mentioned it is much easier, that you have a stored template of your report with all setings and customisations already done.
    You open this layout file and have stored the names of your calculated channels. When you are doing this with a script they always have the same name and belong to the same group.
    Now you can customize the references of the line items.
    Kind Regards,
    Philipp K.
    AE | NI Germany

  • Duplicate Text From Shell Script in Automator

    I'm trying to run a automator script that allows me to select a couple of files, run a sha1 checksum, and output a text file. My current version works 100% within the automator app, however when I use it as a context menu service, it outputs duplicate text. Here's my current workflow and what it outputs.
    Get Selected Folder Items
    Run Shell Script
    Copy to Clipboard (I've tried "new text file", and "new textedit file" as well)
    Outputs:
    SHA1(~/Desktop/Actions/Test/TEST.atn)= 88902acfb51e0f9a0c6dbedce69ce9618e26bc00
    SHA1(~/Desktop/Actions/Test/TEST.atn)= 88902acfb51e0f9a0c6dbedce69ce9618e26bc00
    Any help would be appreciated.

    Snow Leopard's Services workflow is automatically passed the type of selected items (that is what the selections at the top of workflow window are for), so just remove the *Get Selected Finder Items* action, since that is having the result of doubling the input items.

  • Run Python Script in Automator

    I have a python script (which was written for me), and I would like to make it so that the script executes every x minutes. I know this should be simple to do, but I can't figure it out.
    Thus far, I have created a workflow in automator, used the "Run Shell Script" action, and pasted the script into the text field.
    "Workflow failed - 1 error
    I'm very new to this, so I'm sure it's a simple error. Any help would great.
    Here is the script I am trying to execute.
    #!/Library/Frameworks/Python.framework/Versions/2.7/bin/python
    # you can change the above line to point to the location of python
    # on your system (you can check this by typing 'which python' into
    # Terminal.app), but this isn't necessary if you execute the script
    # using "python ksl.py [URL]"
    # change the value of NAME to your desired name
    NAME = "Bob Jones"
    # change the value of EMAIL to your desired email
    EMAIL = "[email protected]"
    # your message will be the contact name as mined from the page source,
    # followed by whatever message you enter between the following triple quotes
    MESSAGE = """Replace this text with your message. Newlines are also OK."""
    import mechanize
    import re
    import sys
    def setupBrowser(url):
    b = mechanize.Browser()
    # b.sethandlerobots(False)
    # b.addheaders = [('User-agent', 'Mozilla/4.0 (compatible; MSIE 6.0; Windows XP)')]
    try:
    b.open(url)
    except mechanize._mechanize.BrowserStateError:
    print >> sys.stderr, "You have mistyped the URL. It must by in the following format, including the quotes and the preceding 'http://':\n\t %s [--test] 'http://www.blah.com'" % (sys.argv[0])
    sys.exit(1)
    return b
    def grabLinks(b):
    """Takes in a mechanize.Browser() object pointed to a listings URL and returns a listing of classified ad links."""
    links = []
    for link in b.links():
    # change this line if the URL format ever changes
    if re.search(r'&ad=', link.url):
    links.append(mechanize.urljoin(link.base_url, link.url))
    return links
    if _name_ == '_main_':
    # check for proper command line args
    if len(sys.argv) != 2 and len(sys.argv) != 3:
    print >> sys.stderr, "Usage: %s [--test] url" % (sys.argv[0])
    sys.exit(1)
    args = sys.argv[1:]
    if len(args) == 1:
    # start from listings page
    url = args[0]
    # set up the mechanize browser object
    b = setupBrowser(url)
    # grab only the relevant ad links
    links = grabLinks(b)
    if not links or len(links) == 0:
    # the links do not follow the same format as the original page
    print >> sys.stderr, "The link format has changed, or you have mistyped the URL."
    sys.exit(1)
    # open the first link on the listings page
    b.open(links[0])
    else:
    # start from a single listing
    if args[0] != "--test":
    print >> sys.stderr, "Usage %s [--test] url"
    sys.exit(1)
    url = args[1]
    b = setupBrowser(url)
    # grab the HTML so that we can search for the contact name
    response = b.response().get_data()
    # perform a regex search on the HTML for the contact name
    regexSearch = re.search(r'Contact Name:\s*\s(w+)s', response)
    contactName = ""
    if regexSearch:
    # contact name found -- store it
    contactName = regexSearch.group(1)
    else:
    # contact name not found -- use generic greeting
    contactName = "Hello"
    theOne = ""
    # find the "Email Seller" link (stored as "theOne")
    for link in b.links():
    # again, if the URL changes, change this line
    if re.search(r'xmldb=', link.url):
    theOne = mechanize.urljoin(link.base_url, link.url)
    if theOne == "":
    # something went wrong
    print >> sys.stderr, "'Email Seller' link has changed formats within the HTML."
    sys.exit(1)
    b.open(theOne)
    # fill out the forms. note that I am grabbing the SECOND form here.
    # again, this might change over time, so feel free to change this from
    # nr=1 to nr=0 (for the first form), nr=2 (for the third form), etc.
    b.select_form(nr=1)
    b['form_4'] = NAME
    b['form_5'] = EMAIL
    # append the contact name to the rest of the message
    MESSAGE = contactName + """,\n\n""" + MESSAGE
    b['form_6'] = MESSAGE
    # submit the form
    b.submit()
    b.close()

    If the script works, and all you need is to execute every x minutes, use launchd, and its simple to write with the Lingon GUI: http://sourceforge.net/projects/lingon/files/

  • Bridge and PS not communicating with scripts and automation.

    CS4 PS and Bridge is not communicating correctly.
    When opening an image from Bridge it opens whiteout any issues but when choosing Tools and PS and any form of automation or script it will not open and start the requested action.
    Then when choosing same or another action from the tools/PS menu I get the message that PS is currently busy processing another task and it asks me if I wish to cue the action.
    There is no difference if I chose cue or stop after this since nothing is happening how ever long I wait.
    If PS is not started it will start up the application but nothing more after that. I have reinstalled and repaired permissions both after and before.
    A colleague who also using PS CS4 is having the same hardware and is not having the same problem so I guess I am having a problem with some form of configuration.
    CS3 is working correctly on the same machine and is having no issues at all.
    Config is Macbook Pro 2.33Ghz 2gb ram OS 10.5.5 whit all the latest updates.
    TIA for you help or crazy ideas.
    Sven

    As I wrote above I have already repaired the permissions but I have also rebooted several times, I have done that before and after installs and removals off the application and I used the Adobe script CS4 cleaner script to completely remove the apps.
    The applications are all installed on their default locations and has not been moved at all and no names has been changed.
    Does anybody know any more thorough way of removing all settings and preferences for CS4 then that script.
    Maybe there are some remaining settings somewhere that I have not been able to remove.
    Are there any sort of total remover of selected adobe apps rather then having to remove all adobe stuff on the machine that is more that can do more then that script.
    Sven

  • Script for Automator to reorder text in file/folder name.

    I have a folder full of pictures named by their first and last names. I need them to be renamed by listing them by last name first, first name last in order to get them alphabatized properly. Anybody out there have a nice Automator script for me to make this happen? I'm new.
    Looking for it to look like this:
    Brown, John

    Try this (should work for "John H Smith" --> "Smith John H" as well):
    The Run Shell Script Action is:
    for f in "$@"
    do
        basename=${f##*/}
        path=${f%/*}
        ext=${f##*.}
        name=${basename%.*}
        if [[ "$name" =~ \  ]]; then
            fname=${name% *}
            lname=${name##* }
            name="$lname $fname"
            mv "$f" "$path/$name.$ext"
        fi
    done
    If you want a comma, then change: name="$lname $fname" to name="$lname, $fname"
    As with all scripts, back-up the files before running

Maybe you are looking for

  • Bought a Boston sound bar for $339.00 now $299.99 possible to get a refund?

    I bought the Boston soundbar for $339 3 weeks ago and I see its on sale now for $299. Will best Buy get me $40 refund if I take the receipt to the store? Its a hassle to physically unplug the soundbar and return it and they repurchase to save the $40

  • Firewire to VCR & HDD

    My old 17" MBP had both FW800 and 400 ports, though I think it only had one FW bus. This meant I could connect an external drive to the 800 port and a VCR or Camcorder to the 400 port at the same time. The new 17" MBP only has one FW800 port. The ext

  • Opening balance issue

    Hi experts, We carried forward balances from 2008 to 2009 through T code F.16.We have found alll GL accounts has been carried forward properly except one GL code (which is opening balance uploaded in sap)not carried forwaded properly. We have run F.1

  • HR Infotype Screen Programming!

    Hi All, I have a text field in my infotype screen which is editable. By default, the enteries are in CAPS. What do i need to do, if i want the field to accept "Caps" and small letters aswell? Thanks in advance for all the responses. Regards, Sundar.

  • Track Text Edit tags get trounced when applying additional tag?

    Hi all, Just upgraded to FM9. I opened a doc that was originall created in FM8. I had (and still have) enabled tracking of text edits, and can see the FM8_TRACK_CHANGES_ADDED and FM8_TRACK_CHANGES_DELETED tags when I highlight text. However, when I a