Applescript

I am not positive this is the appropriate forum for this question, but I can find little regarding this subject. Is it possible to use applescript to creat a script in hotmail such that when one clicks on a junk mail, the script gets the address, sends it to block senders and registers it and sends one back to hotmail, sending said e-mail to the junk folder at the same time? Apple's website talks about applescript studio, then says it is included in Xcode. Apple suggests it is simple to script using script editor, but it looks like Greek, since I have never programmed before? Thank You

If you're accessing Hotmail via a web browser as is usual, then no, sorry, it's almost certainly not possible, since you can't script a web browser to control Hotmail's functions. If, however, you're using a standalone mail application (such as Apple Mail), then it might be possible.
Note though that most spam comes from random (and usually fake) addresses, so sending it to a blacklist of some sort generally won't be effective since the spam will almost never come from the same purported email address twice.

Similar Messages

  • Shell commands in applescript noob

    Hi all this is my first post in these forums and I come seeking help with a certain script I'm writing for my current college job. The purpose of the script is to install creative cloud from a server and this is as far as I've got. First I can get as far as setting the correct directory in the server by doing:
    do script "cd /Volumes/applications/Mac/'Adobe Creative Cloud'/'Enterprise - enduser'/Build"
    now when I press run the terminal screen pops up just fine with no errors in the right directory. However I've been reading up that to do other commands in the same shell I must do do shell script. When doing this however terminal doesn't do...anything. The reason why I was trying this is because my next command would be initiating the install which is the command:
    "installer -verbose -pkg 'enterprise_Install.pkg' -target /" with adminitrator privilages
    Now my question is how would formulate this within applescript? Thanks.

    do shell script "cd /Volumes/applications/Mac/'Adobe Creative Cloud'/'Enterprise - enduser'/Build ;  installer -verbose -pkg 'enterprise_Install.pkg' -target / with administrator privilages"
    You got the double quote in the wrong place.
    do shell script "cd /Volumes/applications/Mac/'Adobe Creative Cloud'/'Enterprise - enduser'/Build ;  installer -verbose -pkg 'enterprise_Install.pkg' -target / " with administrator privilages
    It is easier to diagnose problems with debug information. I suggest adding log statements to your script to see what is going on.  Here is an example.
        Author: rccharles
        For testing, run in the Script Editor.
          1) Click on the Event Log tab to see the output from the log statement
          2) Click on Run
        For running shell commands see:
        http://developer.apple.com/mac/library/technotes/tn2002/tn2065.html
    on run
        -- Write a message into the event log.
        log "  --- Starting on " & ((current date) as string) & " --- "
        --  debug lines
        set unixDesktopPath to POSIX path of "/System/Library/User Template/"
        log "unixDesktopPath = " & unixDesktopPath
        set quotedUnixDesktopPath to quoted form of unixDesktopPath
        log "quoted form is " & quotedUnixDesktopPath
        try
            set fromUnix to do shell script "sudo ls -l  " & quotedUnixDesktopPath with administrator privileges
            display dialog "ls -l of " & quotedUnixDesktopPath & return & fromUnix
        on error errMsg
            log "ls -l error..." & errMsg
        end try
    end run

  • New Applescript version breaks old code

    Hi there,
    First off, I'm not an Applescripter, but I have one script I wrote a few years back (with help from kind people on the net) to generate and save tiny applications which, when called from within an Adobe Flash executable, would open the required file using the Mac OS native application associated with them (i.e a doc file wouldbe opened by Word if installed, TextEdit if not...)
    It used to run fine on my old Powerbook G4 on an old version of AppleScript, but times change and, one whizzy Intel processor later, I'm trying to get the same script running on OS 10.8 with AppleScipt 2.5.1, with varied results.
    Basically, what the script should do is read a comma delimited file in the same folder as the script, called 'fileNames.csv' which contains the names of all the files that I want the tiny apps to open. Each item will then have its own file created by the AppleScript, named after each item, which get saved in an pre-existing folder in the same directory as the script and fileNames.csv file, called 'fscommand'.
    The example of the fileNames.csv file I'm having issues with:
    yr2_unit_1_tn.doc,yr2_unit_2_tn.doc,yr2_unit_3_tn.doc ... etc up until  yr2_unit_20_tn.doc
    The script always used to work fine, but the new version of AppleScript seems to have broken it. When I run it now, it creates all the .app files up until 'yr2_unit_11_tn.doc.app' but then stalls in 'Running...' mode in the AppleScipts editor, and refuses to save apps for the final nine files in the .csv file.
    It still runs ok from an older AppleScript editor (2.2.1) but this only saves PowerPC applications, which won't run on Intel Macs. And this would be me running away from the problem, rather than attempting to solve it ;-)
    I'm thinking it's a filename issue, as it always seems to break when attempting to save "yr2_unit_11_tn.doc.app" when "yr2_unit_1_tn.doc.app" already exists in the 'fscommand' folder. If I create a new 'fileNames.csv' file which only contains ten entries from 'yr2_unit_11_tn.doc' to  'yr2_unit_20_tn.doc', and run the script to an empty 'fscommand' folder, it processes all the files fine. It just won't do all twenty entries from 1 to 20.
    Here's the script. I know I'm doing something really stupid here, but as a rock bottom novice AppleScripter, I can't see the error, or why it would work in one version of AppleScript and not another. I can post a link to the zipped files if this is any help in solving it. Thanks in advance for any help! :-)
    tell application "Finder" to get folder of (path to me) as Unicode text
    set cwd to result
    set fileRef to open for access alias (cwd & "fileNames.csv")
    set theList to read fileRef using delimiter ","
    close access fileRef
    set theFolder to alias (cwd & "fscommand")
    set theFolderPath to theFolder as string
    #Create the .app files and save them in theFolder
    set NL to ASCII character 10
    tell application id "com.apple.ScriptEditor2"
    launch
              repeat with theItem in theList
                        set x to make new document
                        set x to the front document
                        set theCharacters to characters of theItem
                        set theReversedCharacters to reverse of theCharacters
                        set theReversedFileName to theReversedCharacters as string
                        set theOffset to offset of "." in theReversedFileName
                        set theReversedSuffix to text 1 thru (theOffset - 1) of theReversedFileName
                        set theSuffix to (reverse of (characters of theReversedSuffix)) as string
                        set the text of document 1 to "tell application \"Finder\"" & NL & "activate" & NL & "set cwd to get folder of container of (path to me) as Unicode text" & NL & "open file (cwd & \"assets:" & theSuffix & ":" & theItem & "\")" & NL & "end tell"
      compile document 1
                        set file_path to theFolderPath & theItem & ".app"
                        save document 1 as "application" in file file_path
      close window 1
              end repeat
    end tell

    That seemed to be it. I put a tiny delay in between saving the document and closing the window and the file runs smoothly through all 20 items.
    compile document 1
    set file_path to theFolderPath & theItem & ".app"
    save document 1 as "application" in file file_path
    delay 0.3
    close window 1
    Never thought that I'd reach the day where I was trying to slow the computer down to process something more carefully :-D

  • Applescript to suck ical dates into iweb

    I was referred to this forum from the iweb forum (http://discussions.apple.com/thread.jspa?threadID=2513935&tstart=0).
    Here's what I would like to do: I am an athletic director and would I have entered all of my school's athletic contests into iCal. I would like to set up something in which iWeb can pull the events out of iCal (I have mobileme) into a "week at a glance" type of display on our athletics page (made with iweb). Ideally it would automatically update so that as events are completed, the next events would show up. I don't want to embed a calendar.
    I want something that looks like the table on the right of this page: www.twu.ca/athletics.
    Is there an applescript that could help me pull dates from iCal into a text box in iWeb?

    Hi,
    You may be able do this with an Applescript. However there is not enough information supplied to know.
    How are ther events formatted in iCal? Do they contain the full name of the person? Do they say how old they are? Are the people already in Address Book, or would they all be new cards?
    Best wishes
    John M

  • New bee looking for applescript help with text edit app

    I have a huge text files (20+) , I want to find a list of words like weather, farmers, ploughing. I want to find these words one at a time, as my text file is 250+ Mb in size.
    I want applescript to count the how many times each word appears in the text.
    Paste that occurrence of word into an spreadsheet file in a row named after text file , and in a column named weather, farmers, ploughing.
    Please help.
    Thanks much.
    CF
    PS so far I can open the text files with applescript, that is about the extent of my ability in programing.
    Message was edited by: coldfusions onco

    For a file of that size, you would need to use some shell utilities to get decent performance. To count words, the following script breaks up the text into words, then counts the number of times the specified word is found (a dictionary file is used as an example, so the match is equivalent to 'contains'):
    <pre style="
    font-family: Monaco, 'Courier New', Courier, monospace;
    font-size: 10px;
    font-weight: normal;
    margin: 0px;
    padding: 5px;
    border: 1px solid #000000;
    width: 720px;
    color: #000000;
    background-color: #DAFFB6;
    overflow: auto;"
    title="this text can be pasted into the Script Editor">
    set theFile to "/usr/share/dict/web2" -- a 2.5MB list of words
    set someWords to {¬
    {theWord:"weather", theCount:0}, ¬
    {theWord:"farmers", theCount:0}, ¬
    {theWord:"ploughing", theCount:0}}
    repeat with anItem in someWords
    set aWord to quoted form of theWord of anItem
    try -- break up into individual words, then search and count
    set theCount of anItem to (do shell script "tr -cs '[:alpha:]' " & quoted form of linefeed & " < " & theFile & " | grep -ic " & aWord) as integer
    end try
    end repeat
    someWords
    </pre>
    Is this related to your Automator post?

  • Applescript: Copy File Names into an Email

    *I've been slowly teaching myself Applescript, and can't seem to find a way to do a few things. Basically what I'm trying to do is set up a script that will run when items are dropped into a folder on my FTP. I want the script to have a pop-up dialogue, and generate an email to certain users announcing new files are on the FTP. I have these 2 parts down, but I would also like the body of the email to include a list of the filenames. This part I can't figure out.*
    *I just need to find a function that will copy the filenames of new items, and paste them into the body of the email already being generated. My current code is below. Anyone have any ideas to help me expand?*
    property dialog_timeout : 15 -- set the amount of time before dialogs auto-answer.
    on adding folder items to this_folder after receiving added_items
    try
    tell application "Mail"
    set theMessage to make new outgoing message with properties {visible:true, subject:"New Files on FTP", content:"New files have been posted to incoming folder of the FTP."}
    tell theMessage
    make new to recipient at end of to recipients with properties {name:"Jane Doe", address:"[email protected]"}
    make new to recipient at end of to recipients with properties {name:"John Smith", address:"[email protected]"}
    end tell
    send theMessage
    end tell
    tell application "Finder"
    --get the name of the folder
    set the folder_name to the name of this_folder
    end tell
    -- find out how many new items have been placed in the folder
    set the item_count to the number of items in the added_items
    --create the alert string
    set alert_message to ("Folder Actions Alert:" & return & return) as Unicode text
    if the item_count is greater than 1 then
    set alert_message to alert_message & (the item_count as text) & " new items have "
    else
    set alert_message to alert_message & "One new item has "
    end if
    set alert_message to alert_message & "been placed in folder " & «data utxt201C» & the folder_name & «data utxt201D» & "."
    set the alert_message to (the alert_message & return & return & "Would you like to view the added items?")
    display dialog the alert_message buttons {"Yes", "No"} default button 2 with icon 1 giving up after dialog_timeout
    set the user_choice to the button returned of the result
    if user_choice is "Yes" then
    tell application "Finder"
    --go to the desktop
    activate
    --open the folder
    open this_folder
    --select the items
    reveal the added_items
    end tell
    end if
    end try
    end adding folder items to
    Message was edited by: markeze

    AppleScript forum under OS X Technologies.

  • How to handle return values in AppleScript

    Warning: AppleScript newbie on the loose without adult supervision.
    I have an Omnis Studio app that calls an AppleScript that in turn invokes a couple of shell commands. As an aside, I don't believe Omnis Studio can invoke a shell script directly without other complications.
    What I would like to do is capture the return code and/or any stdout from the shell commands in the AppleScript, then pass that result out as a return value from the AppleScript.
    Q1. How does one hold the return values, exit code, stdout, etc. of a shell script in AppleScript?
    Q2. How do I tell AppleScript to pass the results back to the calling routine?
    Examples, links to documentation, etc, will be gratefully accepted.

    There is a whole forum for just Applescript here:
    http://discussions.apple.com/forum.jspa?forumID=724

  • Shell script in Applescript

    I have a program that I run via Terminal, but I don't want a terminal window open while I run it (Just personal preference). I have an applescript set up to run the Terminal command, but the thing is that the command is "on" while the program is running, Is there some way that I can have the command go and then end the script wihtout closing the program? Or am I out of luck and have to have the Terminal window open?
    The program I am using is located here http://sites.google.com/site/sc2gears/
    Thanks for the help!

    The program is distributed (according to the docs) as a .command file, so you can get the efect you want like so:
    do shell script "/Users/yourname/further/path/Sc2gears-os-x.command &> /dev/null &"
    the &> /dev/null tells applescript that you don't care about any output, so it moves on to the next command, and the closing & sets the process up as a standalone.  Note:
    If the process doesn't close itself automatically you'll need a separate way of doing that
    if the process produces output you want to keep, don't use /dev/null - use an appropriate file path
    (obviously) '/Users/yourname/further/path' needs to be replaced with the correct path to the command, and needs to be single-quoted/escaped if it contains spaces or other unix-confounding characters

  • Shellscript in Applescript

    I made a shell script that works until one point where the Escape key needs to be pressed. Does anybody know how to make applescript make a keystroke while inside of the shell script???

    theAnimator: I've followed you through several threads apparently trying to solve a simple problem, but it seems you are getting lots of partial answers and you are now trying to piece them together, but the real solution is much simpler. Instead of trying to turn that interactive process (where you need to type the escape character) into a non-interactive one, the interactive process that you're trying to adopt (perhaps with expect) was dubious advice. That problem could have been solved directly with a simpler non-interactive solution that doesn't rely on the keyboard.
    For example, if you can put the lines you want to insert into a file, "finsert", and you want to insert those lines between lines 12 and 13 of file fdata, the following Unix shell script would do that:
    # make backup
    cp fdata fdata.bak
    # copy first 12 lines
    head -n 12 fdata.bak > fdata
    # copy insert text
    cat finsert >> fdata
    # copy remainder
    tail -n +13 fdata.bak >> fdata
    Note the distinction between > and >> in the script.

  • Help in Applescript?

    Hey guys I really need help here...
    I've been trying to write an applescript to login my college account.
    I got pass the sign in part but im stuck on figuring out how to click a certain button on the webpage.
    Did a little research and found that it was either UI scripting that I should use or java command.
    But im on OSX Maverix and I can't figure out how to enable UI scripting and how to use it (in doesn't show in the accessibility list)
    And for the java commands, I know how to find the source code of a page but i can't figure out how to find the button code, and how to write the script... Any help would be appreciated thank you!
    So far thats my script:
        set thePassword to *password*
        set theID to *IDnumb*
        tell application "Safari"
        Activate
        Open Location *Website*
        delay 5
        keystroke ID
        keystroke tab
        keystroke password
        keystroke return
        delay 2
    End tell

    Here is how I navigate these two panels.  First, I click on the vnc icon.  I then curser down to to the line "Connect to Listening VNC Viewer...".  Press return.  Type in ip address.  Press return. 
    first part clicks on vnc icon.
    move mouse and click mouse are not standard.  They are an applescript addon  see comment below.  Do not know if available with mavericks.
    For you situations you probably do not have to click on the button. Use the tab to move to the button you wish to click.  Press return.  ( keystroke return )
    log "  --- Starting on " & ((current date) as string) & " --- "
    -- Go after screen resolution
    do shell script "/usr/sbin/system_profiler SPDisplaysDataType | grep 'Resolution'" -- get info
    tell the result to set {DisplayWidth, DisplayHeight} to {word 2, word 4} -- get resolution
    if DisplayWidth = 800 then
        (move mouse {474, 14})
    else
        (move mouse {698, 11})
    end if
    click mouse
    tell application "System Events"
        repeat 6 times
            key code 125 -- cursor down        key code 125
            delay 1
        end repeat
        delay 2
        keystroke return
        delay 3
        keystroke "192.168.0.101:5900"
        -- if you went to press return after typing the password
        delay 3
        keystroke return
        -- incase we get an error message. should probably be ok, in good case.
        delay 3
        keystroke return
    end tell
        First, there is the XTools scripting addition, which will give AppleScript the ability to move the mouse.
        http://www.lestang.org/osax/XTool/
        XTool-2.0.dmg.tgz
        Installation :
        Drag XTool.osax from insite the image to one of the following locations (create the directory if it does not exist) :
        a : ~/Library/ScriptingAdditions/
        b : /Library/ScriptingAdditions/
        c : /System/Library/ScriptingAdditions/
        I have it in directory /System/Library/ScriptingAdditions/
        My other two directories do not exit: ~/Library/ScriptingAdditions/ &
            /Library/ScriptingAdditions/
    .     Next, you will need to place a script application into your login items (System Preferences > Accounts > Login Items) that will move the mouse when you log in:

  • Help in Applescript Mail option

    Hi Forum,
    I'm using tis applescript, to check the folder for files and sent mail via applescript.
    It works quiet good. The problem is if the document does not contain any files, also the mail is sent to the receipient.
    I'm requesting forum , to correct this applescript, to send the mail only if the files are found inside the folder.
    on run
              set myFolder to "/Users/wander5/Desktop/QuarkRescueFolder"
              set {TID, text item delimiters} to {text item delimiters, linefeed}
              tell application "Finder" to set myFiles to name of files of (POSIX file myFolder as alias)
              set newNames to paragraphs of (do shell script "sed 's/\\(.*\\)\\((.*)\\)/\\2 \\1/' <<< " & quoted form of (myFiles as text))
              repeat with i from 1 to count myFiles
                        tell application "System Events" to set name of (first file of folder myFolder whose name is (item 1 of myFiles)) to (item 1 of newNames)
              end repeat
              set text item delimiters to TID
              set fileList to list folder myFolder without invisibles
              repeat with tFile in fileList
                        set recipientName to "Wander5"
                        set recipientAddress to "[email protected]"
                        set theSubject to "Please check Files has been completly copied from server"
                        set theContent to "check files have been copied"
                        tell application "Mail"
      # # Create the message
                                  set theMessage to make new outgoing message with properties {subject:theSubject, content:theContent, visible:true}
      ##Set a recipient
                                  tell theMessage
      make new to recipient with properties {name:recipientName, address:recipientAddress}
      ##Send the Message
                                            send
                                  end tell
                        end tell
      ##end tell
              end repeat
    end run
    Many thanks,

    I didn't test but don't you just need to test fileList's length/count before you loop the list…?
    on run
              set myFolder to "/Users/wander5/Desktop/QuarkRescueFolder"
              set {TID, text item delimiters} to {text item delimiters, linefeed}
              tell application "Finder" to set myFiles to name of files of (POSIX file myFolder as alias)
              set newNames to paragraphs of (do shell script "sed 's/\\(.*\\)\\((.*)\\)/\\2 \\1/' <<< " & quoted form of (myFiles as text))
              repeat with i from 1 to count myFiles
                        tell application "System Events" to set name of (first file of folder myFolder whose name is (item 1 of myFiles)) to (item 1 of newNames)
              end repeat
              set text item delimiters to TID
              set fileList to list folder myFolder without invisibles
              if length of fileList > 0 then -- Its not an empty list…
                        repeat with tFile in fileList
                                  set recipientName to "Wander5"
                                  set recipientAddress to "[email protected]"
                                  set theSubject to "Please check Files has been completly copied from server"
                                  set theContent to "check files have been copied"
                                  tell application "Mail"
      # # Create the message
                                            set theMessage to make new outgoing message with properties {subject:theSubject, content:theContent, visible:true}
      ##Set a recipient
                                            tell theMessage
      make new to recipient with properties {name:recipientName, address:recipientAddress}
      ##Send the Message
                                                      send
                                            end tell
                                  end tell
                        end repeat
              end if
    end run

  • Typing ⌘ in applescript...

    I am trying to write an AppleScript that will allow me to go to my most used websites with a voice command. (I'm really hooked on this Speakable Commands thing.)
    However, I've run into a bit of a roadblock with certain keystrokes...
    CODE FOLLOWS:
    tell application "System Events" to keystroke "l {⌘ down}"
    tell application "System Events" to keystroke "http://awebsiteilike.com"
    tell application "System Events" to key code 36
    CODE ENDS:
    So ⌘l highlights the browser address bar.
    keystroke website is next
    then code 36 the key code for ENTER
    When this script is run though, it ends up scrolling and opening a find on this page bar and types the web address in there.
    I'm pretty sure the problem is that AppleScript is not associating "⌘" with the COMMAND/Open Apple key.
    So what I'm looking for is pretty simple here. Just need the proper way to address the ⌘ key in AppleScript.
    I've looked around and not found the answer, so figured I'd ask here, for my and the benefit of all who are learning this scripting language.

    OK, so I tried this...
    CODE BEGINS:
    tell application "System Events" to keystroke "\ \sml"
    tell application "System Events" to keystroke "www.awebsite.com"
    tell application "System Events" to key code 36
    CODE ENDS:
    saving it as open websitename\ \sml
    Now if this were just some kind of key macro script, I guess the \\sm command would help. However, since this is a Speakable Command script, my guess is it wants me to say "open website\\sml" instead of "open website"
    Trying to find the answer on my own... but so far no luck.

  • How to retrive ip address of connected device in shell script or applescript

    Hi all,
    From Mac PC, how to get ip address of connected device in shell script or applescript.
    there is any way to launch an app on ipad in shell script or applescript.
    thank you in advance for your help
    Mickael

    Hi all,
    From Mac PC, how to get ip address of connected device in shell script or applescript.
    there is any way to launch an app on ipad in shell script or applescript.
    thank you in advance for your help
    Mickael

  • Problem with shell commands and scripts from an Applescript Application

    Hi-
    I am fairly new to OSX software development. I am trying to build an application that creates a reverse SSH tunnel to my computer and starts OSXvnc. The idea is that my Mom or anyone else who needs help can connect to me without having to tinker with their firewalls.
    There are plenty of resources on how to do this, and I have found them. What I have a problem with is the following.
    I am building this application in Xcode as an Applescript application, because Applescript and shell scripting are the only forms of programming I know. I use an expect script to connect through SSH, and a "do shell script" for the raw OSXvnc-server application to allow screen sharing.
    The problem is that when I click on the button to launch OSXvnc-server or the button to launch SSH, the application freezes until the process it spawns is killed or finishes. For example, I can set SSH to timeout after 60 seconds of no connection, and then the Applescript application responds again. I even tried using the ssh -f command to fork the process, but that doesn't seem to help.
    I am also using "try" around each of the items.
    What am I doing wrong? How can I make the buttons in my app launch SSH and OSXvnc-server without hanging the application while it waits for them to finish?
    Thanks so much!

    See here for an explanation of the syntax.
    (20960)

  • Do shell script problem in Applescript

    Hi,
    I am an Applescript novice and have been trying to write a code to go to a particular folder, look for all files in the folder tree with extension .m2v and run an executable file to decode them. My problem is that when I run my code (containing do shell script), it searches through all files and folders on Mac HD and starts decoding .m2v files elsewhere that I don't want.
    Eventually it runs out of space (.m2v file decoding takes a lot of space), because it is dumping all decoded .yuv files onto the HD.
    When I run the command on Terminal, it executes the decoding perfectly and stores the decoded files in the same folder.
    Please help me about what's going on.
    My code is something like:
    tell application "Finder"
    set DestinationFolder to "xxxxxx:xxxx:xxxx"
    set NumFolders to (get count of folders under Destination folder)
    repeat for SomeVar from 1 to NumFolders
    set FolderinQuestion to folder SomeVar of DestinationFolder
    -- Tried tell application "Terminal" here, but did not know --how to export the FolderinQuestion variable from Finder to --Terminal
    do shell script " \" cd \" & (POSIX path of (result as text));
    for file in `find $pwd \"*.mov\"`
    do
    /usr/local/bin/decode file
    done"
    end repeat
    end tell
    I would greatly appreciate some guidance.

    The root of the problem is that you're trying to quote the cd command for some reason:
    <pre class=command>do shell script " \" cd \" & (POSIX path of (result as text));
    ...</pre>
    In addition to that you're including the & (POSIX path of (result as text)) as part of the shell command whereas this should be OUTSIDE of the quotes in order to get evaluated
    If you work that through you'll end up with a shell command that looks like:
    <pre class=command>" cd " & (POSIX path of (result as text))</pre>
    If you try to run that in a terminal you'll get a cd : command not found error and that's why the rest of it appears to fail.
    The solution to that one is simple - just don't bother quoting the cd and put the POSIX path stuff outside of the quotes to get it evaluated at runtime:
    <pre class=command>do shell script "cd " & quoted form of POSIX path of (FolderInQuestion as text)) & ";
    # rest of shell commands here"</pre>
    Now, as for the rest of the script there are a few things I would change.
    First, unless you need to know the index, don't do:
    >repeat for SomeVar from 1 to NumFolders
    set FolderinQuestion to folder SomeVar of DestinationFolder
    the issue is that the number of folders to process may change during the script's execution (other processes may create or remove folders). This will, at best, cause some folders to be skipped and, at worst, cause the script to fail.
    If you're iterating through a list, the best option is to just:
    <pre class=command>repeat with FolderInQuestion in (folders of DestinationFolder)
    ...</pre>
    This automatically sets the iterator (in this case, FolderInQuestion, to the first item in the list and increments it for each iteration through the loop.
    Secondly, in your shell script itself, scrub the entire do/done loop. You're already using find, so have that do the hard work using the -exec switch:
    <pre class=command>find path -name "*.mov" -exec /usr/local/bin/decode {} \;</pre>
    In find's case, {} is substituted with the current file's path.
    Putting this together you'd get:
    <pre class=command>tell application "Finder"
    set DestinationFolder to "xxxxxx:xxxx:xxxx"
    repeat with folderInQuestion in (get folders of folder DestinationFolder)
    do shell script "cd " & quoted form of POSIX path of folderInQuestion & "; find . -name \"*.mov\" -exec /usr/bin/decode {} \\;"
    end repeat
    end tell</pre>
    Note that I've used 'quoted form of POSIX path' - this takes care of any shell-unsafe characters like spaces in the path name. I've also used \\; for the -exec switch - this is so that AppleScript passes the \ to the shell command rather than using it for its own escaping.
    But you're not done yet!
    There's still one fatal flaw in this process - and that is the fact that find by default, is recursive - it will walk through every directory that it finds.
    This means that if you start at the top folder and iterate through, find will find all .mov files and decode them. Your script then cd's to the first subdirectory and repeats the process - decoding all the .mov files in that directory and all its subdirectories even though they've ALREADY been decoded.
    The upshot is that you only need to run one loop starting at the top level. You don't need to iterate through all the subdirectories since find will do that for you.
    In addition to that, there might not be a need to use cd at all since the first argument to find is the directory to start searching in. Unless there's some reason that you need to start decode from the top level directory (e.g. is that where it saves the files?), you can drop the whole repeat loop altogether and just run with:
    <pre class=command>set startFolder to (choose folder)
    do shell script "find " & quoted form of posix path of startFolder & " -name \"*.mov\" -exec /usr/bin/decode {} \\;"</pre>
    That's the entire script - a radical compression of your original.

  • Problem with backtick replacing apostroph in applescript/shell script

    I've got a script that appears to be using a backtick instead of an apostrophe which is causing an error in my shell script. For the life of me I can't seem to find where the error is being generated?
    The script is attached below. I'm using Exiftool, an app that writes metadata to image files. The shell script
    set cmd to "exiftool -CopyrightNotice=" & exifCopyright & " " & thisFilePath & ""
    set theResult to do shell script cmd
    works fine but the following shell script
    set cmd to "exiftool" & space & authorStr & " " & thisFilePath & ""
    set theResult to do shell script cmd
    returns the error "sh: -c: line 0: unexpected EOF while looking for matching `''
    sh: -c: line 1: syntax error: unexpected end of file" number 2. The code in the event log in applescript editor looks exactly the same to me but one fails in the shell script.
    It has been suggested by the developer of Exiftool, Phil Harvey, that there is a backtick in the second shell script. I read somewhere in the applescript docs that this is due to a change in OS 10.6? Any suggestions on how to fix this?
    Thanks.
    Pedro

    Yea, the authorStr value has a space like "Joe Smith"
    Then you need to use quoted form of this string, too:
    set cmd to "exiftool " & quoted form of authorStr & space & thisFilePath
    although the format looks wrong to me - shouldn't there be some kind of switch, such as "-author=' before it?
    You have to consider how you'd enter this at the command line to work out how best to translate it to AppleScript. For example, if the command line version were:
    exiftool -author='John Doe' /path/to/some.jpg
    you can see the quotes are around the name, not the entire -author switch. In this case you should be looking at something like:
    set authorStr to "John Doe"
    set theFilePath to "/path/to/some.jpg"
    set theCmd to "exiftool -author=" & quoted form of authorStr & space & quoted form of theFilePath
    Now you could, of course, use quoted form when you create the variables (e.g. set authorStr to quoted form of "John Doe"), but that may screw you up later on if/when you try to use authorStr in some other way, so I find it best to use quoted form only where it's needed.

Maybe you are looking for

  • How do I fully reset my Nano 2 so I can sell it

    After purchasing a touch 4g, Im ready to sell my nano 2g. i have removed the music, but how do i wipe the user info so i can sell it and the purchaser can set it up new for themselves. as of now, the serial number is attached to my account

  • Stereo - no surround sound

    Hi gang, Setup of my 2nd Gen ATV has gone very smoothly. Only one problem. All movies play as stereo, even when there is a 5.1 surround track. When I go into the Audio settings, if I turn Dolby Digital from Auto to On and then play a movie, my receiv

  • Drag and drop external text into a Flex component

    Hi, is there any way to allow drag and drop of external text (for example, selected text from another browser or even from the address bar) into a Flex component like TextArea? I know how to drag and drop between two different Flex components but in

  • Upgradation to Oracle App Server 10.1.2.3

    Hi Our application was developed using JDev Build 1929. It was working fine. We upgraded to JDev 10.1.2.3.0 Build 1936. The application was still working fine. But recently we upgraded our application server patches from OAS 10.1.2.2 to OAS 10.1.2.3

  • Error deploying application on Weblogic

    I'm deploying a web application on Weblogic but I can't execute it. The state of the application is 'ready' but when I push start, weblogic show me an error: java.lang.ClassNotFoundException: com.sun.faces.config.ConfigureListener I think it can be a