Folder Action to Launch Perl Script

Hello.
I wrote a perl script which I wanted to execute when a file was dropped into a folder. I added a folder action with a very simple applescript:
on adding folder items to this_folder after receiving added_items
do shell script ¬
("perl /Users/Alexander/Library/Scripts/gte2.pl")
end adding folder items to
The folder action didn't do anything, any thoughts on what I'm doing wrong? Note, the perl script works fine when I run it from the terminal.
thanks.

Thanks Camelot, I appreciate the help. My script below is trying to read data from a file in folder in my system. So I will try your suggestion, I didn't realize the environment and path my be different.
Regards Alex
#!/usr/bin/perl -w
#This program is to convert files from gamin running GPS watch to text file which can be loaded into excel.
# To make executable, remember to set: chmod u+x <file>
#set all the flags. Note the flags are used to stop the matching
$i = 1; $k = 0; $start = "no";
#Open data file and find values
open(DATA,"/Users/Alexander/Alex's Misc/Health/Garmin_Conversion/run.tcx") || die "Couldn't open file*\n";
#read in the data line by line until "end of file"
while (<DATA>){
#start parsing for information to keep
if (/.<Id>./) {
@Idline=split(/>/);
@Idbeat=split(/T/,$Idline[1]);
$Id=$Idbeat[0];
if (/.<Track>./){
$start = "yes";
if ($start eq "yes"){
if (/.<Time>./) {
@timeline=split(/T/);
@timebeat=split(/Z/,$timeline[2]);
$Time[$i]=$timebeat[0];
elsif (/.<LatitudeDegrees>./) {
@HRline=split(/>/);
@HRbeat=split(/</,$HRline[1]);
$Latitude[$i]=$latbeat[0];
elsif (/.<LongitudeDegrees>./) {
@longline=split(/>/);
@longbeat=split(/</,$longline[1]);
$Longitude[$i]=$longbeat[0];
elsif (/.<AltitudeMeters>./) {
@altline=split(/>/);
@altbeat=split(/</,$altline[1]);
$Altitude[$i]=$altbeat[0];
elsif (/.<DistanceMeters>./) {
@distline=split(/>/);
@distbeat=split(/</,$distline[1]);
$Distance[$i]=$distbeat[0];
elsif (/.<Value>./) {
@HRline=split(/>/);
@HRbeat=split(/</,$HRline[1]);
$HR[$i]=$HRbeat[0];
$i++;
} #string matching
} #if start flag is yes
} #while data loop
close (DATA) || die "couldn't close file.\n";
#write all data to file in space delimited format
open (NEWFILE, ">/Users/Alexander/Alex's Misc/Health/Garmin_Converted/$Id run") || die "can't create file.\n";
$Time[0]="Time"; $Latitude[0]="Latitude"; $Longitude[0]="Longitude"; $Altitude[0]="Altitude"; $Distance[0]="Distance"; $HR[0]="HR";
print NEWFILE "0 $Time[0] $Latitude[0] $Longitude[0] $Altitude[0] $Distance[0] $HR[0]\n";
for ($j = 1; $j <= $i; $j++) {
$k=$j+1;
print NEWFILE "$j $Time[$j] $Latitude[$j] $Longitude[$j] $Altitude[$j] $Distance[$j] $HR[$j]\n";
} #for j loop
close (NEWFILE) || die "couldn't close newfile.\n";
#This is the end of the program

Similar Messages

  • Folder Actions script no longer runs on new file creation

    Hope this isn't trivial.......first time posting here...hopefully in the right place.I'm not a total Mac OS X newbie...and surely no techie, either. Dabbled a wee bit with Automator and scratchin' my head on this one. Help, please!
    Any idea why folder actions not running when a new file is saved? A simple add-color-label script created in Automator was workin' fine before I did a Snow Leopard-to-Leopard downgrade clean-install & account migration from external HD (TimeMachine) backup. Folder actions are enabled and script runs only if I start it with Automator Runner. Previously, it would label the file as soon as I saved it....now it needs a manual start. Is this default behavior in Leopard? Or am I missing something or doin' something wrong? Or is this a consequence of downgrade? I was sure I had the same script workin ok in my original Leopard install - though possibly un-modified at that time.
    I have no clue why, but the new version I created recently (cpl wks ago?)worked the first time I added a new file but not thereafter...and in that instance it only labelled the file in Finder upon quitting Preview (file is a Grab saved as pdf).
    The reason for the downgrade was compatibility problems with Photoshop CS4 on SL (OS & app all updated yet crashin' at the drop of a hat) - maybe due to lack of RAM? (only 1GB). Saw quite a few posts regarding SL running CS4 problems, so now I'm back to running 10.5.8 ..again.. and PS actually runs smooth like it did before.
    Maybe these console messages are a help......or am I barkin' up the wrong tree?
    6/11/11 7:44:54 PM /System/Library/CoreServices/Folder Actions Dispatcher.app/Contents/MacOS/Folder Actions Dispatcher[91] CPSGetProcessInfo(): This call is deprecated and should not be called anymore.
    6/11/11 7:44:54 PM /System/Library/CoreServices/Folder Actions Dispatcher.app/Contents/MacOS/Folder Actions Dispatcher[91] CPSPBGetProcessInfo(): This call is deprecated and should not be called anymore.
    6/11/11 7:44:54 PM /System/Library/CoreServices/AppleScript Runner.app/Contents/MacOS/AppleScript Runner[264] CPSGetFrontProcess(): This call is deprecated and should not be called anymore. 
    6/11/11 8:19:12 PM Automator Runner[415] Error while processing arguments
    6/11/11 8:20:31 PM /Applications/AppleScript/Folder Actions Setup.app/Contents/MacOS/Folder Actions Setup[420] CPSGetProcessInfo(): This call is deprecated and should not be called anymore.
    6/11/11 8:20:31 PM /Applications/AppleScript/Folder Actions Setup.app/Contents/MacOS/Folder Actions Setup[420] CPSPBGetProcessInfo(): This call is deprecated and should not be called anymore.
    6/11/11 8:20:32 PM [0x0-0x5b05b].com.apple.systemevents[421] com.apple.FolderActions.enabled: Already loaded
    And for that matter....why does Automator throw these messages? All apps (except iWork '08 apps) and OS are up to date.
        - Just a few of the many actions not loaded:
    6/11/11 7:48:25 PM Automator[294] The action “Start iTunes Visuals” could not be loaded because the application “iTunes” is the wrong version.
    6/11/11 7:48:25 PM Automator[294] The action “Stop iTunes Visuals” could not be loaded because the application “iTunes” is the wrong version.
    6/11/11 7:48:25 PM Automator[294] The action “Update iPod” could not be loaded because the application “iTunes” is the wrong version.
    6/11/11 7:56:33 PM Automator[294] name = name was not found
    6/11/11 7:56:33 PM Automator[294] name = name extension was not found
    6/11/11 7:56:33 PM Automator[294] name = file type was not found
    6/11/11 8:00:29 PM Automator Runner[339] Error while processing arguments
    6/11/11 8:00:30 PM Automator Runner[339] The action “Import Files into iTunes” could not be loaded because the application “iTunes” is the wrong version.
    6/11/11 8:00:30 PM Automator Runner[339] The action “Add Songs to iPod” could not be loaded because the application “iTunes” is the wrong version.
    6/11/11 8:00:30 PM Automator Runner[339] The action “Add Songs to Playlist” could not be loaded because the application “iTunes” is the wrong version.
    6/11/11 8:00:30 PM Automator Runner[339] The action “Apply SQL” could not be loaded because the application “Xcode” was not found.
    Do I need to wipe the drive again and re-install everything?
    Any help is greatly appreciated. Apologies if this seems long-winded.

    Folder Actions are set up a bit differently in Leopard (they use an AppleScript wrapper), and several actions have been updated to use new technologies available in Snow Leopard.  Looking at some of your console logs, it looks like some actions or workflows were just copied over from Snow Leopard.  When changing versions like that, you should rebuild the workflows so that they link to the correct actions, and check added actions for any dependencies (an action won't be loaded if it requires resources that are not available).
    Resaving your Folder Action workflow as a Folder Action Plug-in should do the trick.

  • Folder action plug in not working

    Hi,
    Using Automator I created a workflow that filters .avi files, then opens tubitunes to convert them to .m4v
    When I run a test it works perfectly, but when I save it as a plug-in to the folder and drop an item in that folder, nothing happens.
    any help will be greatly appreciated

    Be sure your folder action script is saved into your /Library/Scripts/Folder Action Scripts folder. I'm new to these things, but I have a working script which I tried to enable using the Attach Folder Action option with the script saved on my desktop and it didn't work -- moving it into that folder above made it work, but I'm still having some issues.
    For me it seems that the Enable Folder Actions keeps disabling itself. My folder action works once (mine is launching VisualHub to convert videos to mp4) but doesn't work again. Checking on the status of the folder, it reads "Enable Folder Actions" again, which means it has been disabled.
    I'm running 10.5.4 on a Mac Pro. This was updated from a fresh 10.5.1 install.

  • Folder actions no longer works after migration

    The script below was working perfectly on an iMac G4. I use it as a type of print spooler for a DOS application that runs in Dosbox for OS X (also works for OS9 apps). I just send the file to the monitored folder and the script prints the contents and deletes the file from the folder.
    I moved to an iMac G5 and used Setup Assistant to transfer my system (no lectures please...). Configure Folder Actions indicates that the script is enabled for the particular folder. However the Folder Action is no longer triggered when I add files to the monitored folder. I have tried repairing permissions, recompiling the script, deleting the folder and creating a new one...
    Is this a quirk of migration?
    on adding folder items to this_folder after receiving added_items
    delay 20 -- time for job to finish?
    repeat with each_item in added_items
    tell application "Printer Setup Utility" to open each_item
    delay 40 -- time before file is deleted from folder
    tell application "Finder" to delete each_item
    tell application "Printer Setup Utility"
    quit
    end tell
    end repeat
    end adding folder items to

    Michael,
    That script seems to work here.
    You could check whether the script is actually attached by using the Folder Actions Setup utility which is located here:
    ~/Applications/AppleScript
    This utility gives you all the folders and their attached scripts in one window.
    You might also want to check to see whether locating your script in the following location helps:
    ~/Library/Scripts/FolderActions
    as that is where the utility wants them to go when you are attaching a folder action script to a folder.

  • AppleScript Folder Actions

    I'm new to this group, and my question may have been answered a long time ago as I'm using OS 10.5.8. I've been teaching myself AppleScript, and have been using "AppleScript - The Missing Manual" by Adam Goldstein and "AppleScript 1-2-3" by Sal Soghoian and Bill Cheeseman. All has gone well until now. I'm working on a couple of folder actions and have hit a wall. I've successfully written "on opening..." and "on closing..." actions. However, I have been 100% UNsuccessful at writing "on adding folder items to..." scripts. Action scripts are saved in the proper location, are attached properly, and folder actions are enabled. I turned a primary "on adding..." script (one I started out to do) into a droplet, and it functions perfectly when files are dropped on it. Help in explaining to me "the error of my ways" would be appreciated.

    If there is an error in a folder action script, it tends to fail silently - for example, your *opening folder* script will fail because you are not coercing theCount (a number) to text (display dialog doesn't like lists, which is what you are getting by concatenating a string to a number).
    Since you have a droplet that works correctly, you can just add a folder action handler to that script. I use a folder action template that includes handlers so that it can be run and tested from the *Script Editor* (it can also be used as a droplet). In the following example, the doStuff handler is what does the stuff, and the other handlers (including the folder action) just pass items to it.
    <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; height: 340px;
    color: #000000;
    background-color: #FFD891;
    overflow: auto;"
    title="this text can be pasted into the Script Editor">
    on run -- application double-clicked or run from the Script Editor
    tell application "Finder" to try
    set someItems to (the selection) as alias list
    on error errorMessage number errorNumber
    set someItems to (the selection) as alias as list
    end try
    if someItems is {} then set someItems to (choose file with multiple selections allowed)
    doStuff for someItems
    return
    end run
    on open theFiles -- items dropped onto the application
    doStuff for theFiles
    return
    end open
    on adding folder items to this_folder after receiving these_items
    handle items added to a folder
    parameters - this_folder [alias]: the folder added to
    these_items [list]: a list of items (aliases) added
    returns nothing
    doStuff for these_items
    return
    end adding folder items to
    to doStuff for someFiles
    do stuff with each file in someFiles
    parameters - someFiles [list]: a list of files to do stuff with
    returns nothing
    repeat with anItem in someFiles
    try
    -- do stuff, for example:
    tell application "Finder"
    set theName to name of anItem
    considering case -- case sensitive match
    if "-P" is in theName then
    move anItem to alias "HD:Users:myself:Property:All Property"
    else if "-GP" is in theName then
    move anItem to alias "HD:Users:myself:Photography:General Photos"
    else
    log "no match"
    end if
    end considering
    end tell
    on error errorMessage number errorNumber -- oops
    log errorMessage
    -- activate me
    -- display alert "Error " & errorNumber message errorMessage
    end try
    end repeat
    return
    end doStuff
    </pre>

  • How to launching a perl script by the "begin" script of a jumpstart

    Hi all,
    i have an urgent pb with my solaris jumpstart, let me explain to you :
    i want that the begin script launch some perl script, but i have a problem
    here is my "begin" script:
    echo "Begining ISO FLAR based jumpstart."
    echo ""
    echo "Starting Ullink Configuration"
    env > /tmp/env
    /bin/sh << EOF
    /usr/bin/perl /cdrom/.archives/admin-scripts/sethostname.pl
    EOFmy perl script use a STDIN
    with this configuration, the perl script is launching but it runs in a loop indefinitely with an error "use of uninitialized value", because (i think) a value is return to the begin scritp and not to the perl script.
    well, on a pre-installed solaris, if a launch the begin script, it happens the same thing, it runs in a loop, BUT if i comment the line "/bin/sh <<EOF" and "EOF", it works.
    at this step, i say "ok it's cool my script is working", but when i use it during the jumpstart instalaltion, the perl script does not start, without any particular error.
    here is my perl script, if you want to test :
    #!/usr/bin/perl -w^M
    # Set Hostname for Ullink Jumpstart^M
    ^M
    use strict;^M
    ^M
    sub hit_enter {^M
        print "Hit enter to continue\n";^M
        <STDIN>;^M
        print "\033[2J";^M
    }^M
    ^M
    sub get_hostname {^M
        my %towns_list = (^M
            'Paris' => 'PA',^M
            'New-York' => 'NY',^M
        );^M
    ^M
        my %sites_list = (^M
            'Office' => 'OFC',^M
            'Redbus' => 'RED',^M
            'Telehouse' => 'TLH',^M
            'DTC' => 'DTC',^M
            'iAdvantage' => 'IAD',^M
            'Nutley' => 'NUT',^M
            'Level3' => 'LV3',^M
            'Equinix' => 'EQX',^M
            'Tata' => 'TAT',^M
            'Switch-data' => 'SWI',^M
            );^M
    ^M
        my %usage_list = (^M
            'Production' => 'PRD',^M
            'UAT' => 'UAT',^M
            'DMZ' => 'DMZ',^M
        );^M
    ^M
        sub select_list {^M
            my $counter=-1;^M
            my %hash_list = @_;^M
            my @keys = keys %hash_list;^M
    ^M
            # Clear screen^M
            print "\033[2J";^M
            print "In which country this machine is hosted or will be host and will be used ?\n\n";^M
    ^M
            # Get all keys from hash^M
            my $key;
            while ($key = each %hash_list ) {^M
                $counter++;^M
                print "$counter - $key\n";^M
            }^M
    ^M
            print "\nChoose the number corresponding to your choice :\n";^M
            my $choice_number;
            chomp ($choice_number = <STDIN>);^M
    ^M
            # Verify answer^M
            if (($choice_number =~ /\d+/) and ($choice_number <= $counter)) {^M
                # Add choice to chosen hostname^M
                my $chosen=$hash_list{$keys[$choice_number]};^M
                return $chosen;^M
            } else {^M
                print "\nYour answer is not correct, you need to enter a number between 0 and $counter\n";^M
                &hit_enter;^M
                &select_list;^M
            }^M
        }^M
    ^M
        sub srv_number {^M
            print "\033[2J";^M
            print "What is the server number ?\n";^M
            my $server_number;
            chomp ($server_number = <STDIN>);^M
            if ($server_number =~ /\d+/) {^M
                return $server_number;^M
            } else {^M
                print "\nYour answer is not correct, you need to enter a number\n";^M
                &hit_enter;^M
                &srv_number;^M
            }^M
        }^M
    ^M
        my $full_hostname = &select_list(%towns_list).'-';^M
        $full_hostname = $full_hostname.&select_list(%sites_list).'-';^M
        $full_hostname = $full_hostname.'SRV-';^M
        $full_hostname = $full_hostname.&select_list(%usage_list).'-';^M
        $full_hostname = $full_hostname.&srv_number;^M
    ^M
        sub write_hostname2tmp {^M
            open (HOSTNAME, ">/tmp/set_hostname") or warn "Couldn't write $_[0] to temp file : $!\n";^M
                print HOSTNAME "$_[0]\n";^M
            close (HOSTNAME);^M
        }^M
    ^M
        print "\033[2J";^M
        print "Is $full_hostname the correct name for this server ? (y/n)\n";^M
        if (<STDIN> =~ /y|yes/i) {^M
            &write_hostname2tmp($full_hostname);^M
        } else {^M
            print "Would you like to retry (r) or set manually the hostname (s) ? (r/s)\n";^M
            if (<STDIN> =~ /s/i) {^M
                print "Type the full required name and hit enter when finished :\n";^M
                chomp ($full_hostname = <STDIN>);^M
                &write_hostname2tmp;^M
            } else {^M
                &get_hostname;^M
            }^M
        }^M
    }^M
    ^M
    # Start configuration^M
    print "\033[2J";^M
    print "\n########################################################\n";^M
    print "#\t\t\t\t\t\t       #\n";^M
    print "#\t\t\tULLINK\t\t\t       #\n";^M
    print '#  Solaris Environnement Installation for Datacenters  #';^M
    print "\n#\t\t\t\t\t\t       #";^M
    print "\n########################################################\n\n";^M
    print "Before starting installation, you need to enter a set of informations.\n(answer to all questions, you can Ctrl+C to stop now)\n\n";^M
    &hit_enter;^M
    ^M
    &get_hostname;^Mthank for your help
    Edited by: ullink on Jun 25, 2009 6:05 AM

    Hi Manju,
    You can try the following command and check if any helps:
    Get-Exchangeserver |where-object{$_.AdminDisplayVersion -like "Version 15*"} |Get-MailboxStatistics | Ft -auto -wrap DisplayName,database,servername,*size*,*time*
    Best regards,
    Niko Cheng
    TechNet Community Support

  • Need a Folder Action Script to automate running of Applescripts in iTunes

    I posted this in the OSX forum but thought i'd try here too:
    I have a couple of applescripts that I have begun using on some of my podcasts. Specifically they will deselect "Skip When Shuffling" and "Remember Track Position" (Thanks Doug!). I feel like it is getting tedious to have to remember to run these scripts every time the Podcast updates a new episode. I'm looking for a folder action script that will run these applescripts whenever a new item is added to their folder. While I try to puzzle one together (having never written one) does anyone have anything to fit these needs?

    Yes.
    I recently need one to do something else.
    I'll just give you the script I am using, you can hack at will...
    property TargetPlaylist : "Library"
    on adding folder items to this_folder after receiving added_items
    repeat with each_item in added_items
    tell application "iTunes"
    add each_item to playlist TargetPlaylist
    end tell
    end repeat
    tell application "Finder"
    move every item of this_folder to the trash
    empty the trash
    end tell
    end adding folder items to
    This script when attached as a folder action will add the items dropped into it to my iTunes library, then delete them.
    You can easily tear this one apart to get what you need done.
    Beavis2084

  • Script works in Script Debugger, but not a folder action - can u help?

    Hi
    I have written the following script to run as as folder action and it works fine when running it through in debug mode in Script Debugger, but as a folder action nothing happens.
    I wonder if someone could have a look and spot what the problem is.
    Thanks
    Nick
    on adding folder items to this_folder after receiving added_items
    set convertPath to "Macintosh HD:opt:local:bin:ffmpeg"
    tell application "Finder"
    set inPath to this_folder as alias
    set outPath to this_folder as alias
    set filesToConvert to (name of every item of inPath whose name extension is "m4a")
    end tell
    repeat with i from 1 to count of filesToConvert
    set fileName to removeExtension(item i of filesToConvert)
    do shell script POSIX path of convertPath & " -i " & (quoted form of ((POSIX path of inPath) & item i of filesToConvert)) & " -f mp3 -ar 44100 -ab 192k -acodec libmp3lame " & (quoted form of (POSIX path of outPath)) & quoted form of (fileName & ".mp3") & " -mapmetadata " & (quoted form of ((POSIX path of inPath) & item i of filesToConvert)) & ":" & (quoted form of (POSIX path of outPath)) & quoted form of (fileName & ".mp3")
    end repeat
    end adding folder items to
    to removeExtension(fileToParse)
    #display dialog fileToParse
    set prevTIDs to text item delimiters of AppleScript
    set text item delimiters of AppleScript to "."
    return first text item of fileToParse
    set text item delimiters of AppleScript to prevTIDs
    end removeExtension

    mmh, well, it seems something is awry with the triggering. other folder action scripts seemed to work fine, but now are intermittent.
    i created the following simple script:
    on adding folder items to this_folder after receiving added_items
    display dialog "1"
    end adding folder items to
    sometimes it works, sometimes not.
    what could be going wrong?

  • Customize Folder Action and Email script

    I have been adapting the below script so if I drop a file on the script, the file will be emaild to the default address. But, I can't figure out how to customize the two below easy tasks into this script. Thanks for any help out there!
    1. A file is moved into folder1 triggers the script.
    2. After the file is email'd I would like it to be moved into folder 2. I have found a script in this forum that moves the file, but I don't know where to add it.
    on adding folder items to theFolder after receiving theAddedItems
    tell application "Finder"
    move theAddedItems to folder "G5:Users:camille:Desktop:folder2:"
    end tell
    end adding folder items to
    The Send File Script that I have been adapting (concept and initial coding by Paul Van Cotthem):
    property this_folder : "G5:Users:camille:Desktop:folder1"
    property emailAddress : "[email protected]"
    global sendAction
    on open fileList
    -- If one prefers to test for folders before the files are created, the enable this code.
    repeat with filePath in fileList
    if (filePath as string) ends with ":" then
    display dialog "Please drop only files, not folder." buttons {"OK"} default button 1 with icon 0
    return
    end if
    end repeat
    enterAddress()
    repeat with filePath in fileList
    set filePath to filePath as string
    if filePath does not end with ":" then -- it's a file
    tell application "Finder" to set fileName to name of item filePath
    tell application "Microsoft Entourage"
    -- This code is faster, but if the user trashed the attached files before sending them, Entourage cannot send the attachtments.
    make new outgoing message at out box folder with properties {recipient:emailAddress, subject:fileName, attachment:filePath}
    -- This code is slower, but attached files are saved into Entourage's message database immediately.
    set theSubject to "File attached: " & fileName
    set newmsg to make new draft window with properties ¬
    {recipient:{address:emailAddress, recipient type:to recipient}, subject:theSubject, content:theSubject, attachment:filePath}
    send newmsg
    end tell -- Entourage
    end if -- file or folder?
    end repeat -- filePath
    end open
    on run
    enterAddress()
    end run
    on enterAddress()
    display dialog "Send to:" buttons {"Cancel", "Send now"} with icon note ¬
    default button 2 default answer emailAddress giving up after 2
    set dialogResult to result
    set sendAction to button returned of dialogResult
    set emailAddress to text returned of dialogResult
    end enterAddress
    G5   Mac OS X (10.3.9)  
    G5   Mac OS X (10.3.9)  
    G5   Mac OS X (10.3.9)  
    G5   Mac OS X (10.3.9)  

    Go ahead and put that chunk of code on a new line at the very bottom of your script. Then between the on adding folder items to theFolder after receiving theAddedItems line and the tell application "Finder" line, insert the word open on a line by itself.
    By putting the term "open" there you are telling the script to run all the code in the "on open" block when triggered by the folder action handler. To make the folder action active you'll need to save the droplet in your ~/Library/Scripts/Folder Action Scripts folder, and then you'll need to attach it to something by control-clicking the desired folder and/or using the Folder Action Setup Utility to connect script to folder.

  • Need help with simple folder action or script

    I have created an export preset in Lightroom that exports images to a folder called "To Email" on my hard drive, and then automatically attaches those images to a new email in my email client (Mailplane).
    It's a great solution that allows me to send a photo via email with one click from Lightroom. However, I want to take it a step further by creating a folder action or script that automatically deletes the image after it is attached to the email. This will allow me to put the folder somewhere deeper in my file system without having to worry about cleaning it out all the time.
    Unfortunately, I have no experience with Automator or AppleScript. Can you help? Thanks.

    I think you need to rework elements of your workflow.
    For example, you say the export preset creates and sends the email.
    If this is the case, the the logical place to make your change would be to edit that preset action (I don't have Lightroom to know whether this is an option there or not).
    The problem with using a Folder Action is that the Folder Action will trigger when the file is dropped in the folder, but that will be before the email is generated or sent, so you run the risk of deleting the file before it's sent.
    So if you can't edit the export preset to do the deletion I would suggest decoupling the 'send an email' and 'delete file' elements from the Lightroom action - in other word change Lightroom to just export the file, and have a separate folder action that triggers when files are added to that folder. The folder action script can take care of generating the email and sending it out, knowing when the email is sent and therefore when it's safe to delete the file.
    WIthout seeing more of the current workflow it's not easy to be more specific.

  • Script Help: Folder Actions - Move files

    Hi,
    So, I'm having some trouble writing a script for a folder action. I basically want the folder to check the file extension of the files that I add to the folder, and if they are music files (mp3, m4a, m4p), to move those files to a different folder. Additionally, is it possible to also move entire folders containing music files to a different folder, instead of just single files?
    Thank you for any help.

    What is your script doing now (note that a name extension does not include the period delimiter)? You can move entire folders, but your folder action script would only pass the items added to the attached folder, not any folder contents. Your folder action script would need to look into any passed folders if you wanted to move them based on their contents.

  • Folder actions: apple scripts translation possible?

    I wonder if the script to automate a folder action, (eg. "new item alert") could be translated into another language, that's to say, is it possible to change the english sentence "add item" into the italian "elemento aggiunto" ? I open the applescript editor but I don't dare to modify any sentence before some expert can reassure me about the safety of this operation.
    Thank you

    You should always work on a copy, or make a copy and store it elsewhere, in case you get into difficulties.
    As regards the alert script, you can modify anything appearing between double quotes: these pieces of text are the displayed items and won't affect the running of the script.

  • Apple Script to automatically apply automator folder action workflows

    Hello
         I'm trying to get an applescript to automatically apply an automator folder action workflow to a folder..
         Getting applescript to apply a scpt file to a folder as a folder action is straight forward. However, it seems that scpt files are different than automator folder action workflows..
         Normally I would just script the folder action in apple script, but this is for someone that can handle automator, but not apple script coding. This whole scripting is to solve the issue of subdirectories being creating and then files or subfolders being created there after. So we need to try to get automator folder actions to propagate though..  easy enough with applescript..
    Any help would be appreciated...

    Here is the code that I needed to happen...  Maybe I just missed something in automator... but this applescript properly applies itself to subfolders, which then allows me to apply specific scripts based on folder names and locations. Also if the subfolders already exist.. the scirpt also is applied to those.
    on adding folder items to this_folder
      createlist(this_folder)
    end adding folder items to
    on createlist(item_list)
              set ActionScript to " REMOVED FOR PUBLIC DISPLAY:ApplyScriptSubfolders.scpt"
              set the the_items to list folder item_list without invisibles
              set item_list to item_list as string
                   repeat with i from 1 to number of items in the the_items
                     set the_item to item i of the the_items
                                       set the_item to (item_list & the_item) as alias
                                       set this_info to info for the_item
                                       if folder of this_info is true then
                              tell application "System Events"
                                                                          display dialog "Attching script to " & the_item as text  --
                                     attach action to folder (the_item as text) using ActionScript
                                                           end tell
                                my createlist(the_item)
                                       end if
                   end repeat
    end createlist
    I appreciate your help.. if you now know what has to happen and have a shorter way of doing so, please do so..
    Thank you again,

  • From script to Folder Action?

    Sample script:
    tell application "Finder"
    set List1 to {"VNG", "COW", "SIN", "CVR", "CRM"}
    set List2 to {"VNG", "SIN"}
    set MissingList to {}
    repeat with i from 1 to count of List1
    if item i of List1 is not in List2 then
    set end of MissingList to item i of List1
    end if
    end repeat
    display dialog MissingList as text
    end tell
    Works, gives me what I want - answer as "COW, CVR, CRM"
    I make a Folder Action from it, like this:
    on adding folder items to this_folder after receiving added_items
    tell application "Finder"
    set List1 to {"VNG", "COW", "SIN", "CVR", "CRM"}
    set List2 to {"VNG", "SIN"}
    set MissingList to {}
    repeat with i from 1 to count of List1
    if item i of List1 is not in List2 then
    set end of MissingList to item i of List1
    end if
    end repeat
    display dialog MissingList as text
    end tell
    end adding folder items to
    Attach it to the folder, try - the answer comes as ""COWCVRCRM", without separating items in a list.
    Why?
    And, BTW, when I work with script I can see an Event Log in a Script Editor, but when Folder Action works - is there any way to see a Log?
    Thank you in advance for any help!
    Vera

    It may be that displaying the dialog via Script Editor instead of whatever app is frontmost when your folder action is triggered causes the difference. It's been known to happen. Try this in place of your code to display the dialog (untested code).
    <pre style="
    font-family: Monaco, 'Courier New', Courier, monospace;
    font-size: 10px;
    margin: 0px;
    padding: 5px;
    border: 1px solid #FF0000;
    width: 720px;
    color: #000000;
    background-color: #ffff99;
    overflow: auto;">
    set {oldDelims, my text item delimiters} to {my text item delimiters, {", "}}
    display dialog (items of MissingList) as text
    set my text item delimiters to oldDelims</pre>
    As for seeing your events, you can write code that can send some of it to a file on the desktop but you won't get all of it, mostly just error info. The best way I know of is to use [Script Debugger|http://www.latenightsw.com/sd4/index.html|http://www.latenightsw.com/s d4/index.html] from Late Night Software Ltd. It may seem expensive initially but it's worth every penny you'll spend on it. Note: the SD download is completely functional for 20 days after installation so you can give it a good workout. Its debugging environment will allow you to step through every line of code, see your variable results for each line and also concurrently view the event log.

  • Single click folder action script

    Hi
    Long shot question here:
    I am wanting to set up a folder action script that is activated by only single clicking a folder (selecting), very much the same as "Macintosh HD:Library:Scripts:Folder Action Scripts:open - show comments in dialog.scpt", the dialog will display when the folder is selected, not opened.
    Is this possible with applescript, or a combination of AS and "do shell script"? if so can I get some pointers please.
    Cheers
    Budgie

    Hello
    The Standard additions dictionary claims:
    adding folder items to: Called after new items have been added to a folder, but only when the folder’s window is open
    adding folder items to alias -- Folder receiving the new items
    after receiving a list of alias -- a list of the tems the folder received
    closing folder window for: Called after a folder window has been closed
    closing folder window for alias -- the folder that was closed
    moving folder window for: Called after a folder window has been moved or resized
    moving folder window for alias -- the folder whose window was moved or resized
    from bounding rectangle -- the previous coordinates of folder window (you can get the new coordinates from the Finder)
    opening folder: Called after a folder has been opened into a window
    opening folder alias -- the folder that was opened
    removing folder items from: Called after items have been removed from a folder, but only when the folder’s window is open
    removing folder items from alias -- the folder losing the items
    after losing a list of alias -- a list of the items the folder lost. For permanently deleted items, only the names (in strings) are provided.
    Other actions , like single click, are NOT treated.
    Yvan KOENIG (from FRANCE dimanche 29 janvier 2006 19:12:18)

Maybe you are looking for

  • Someone help me with severe iTunes problems?

    I am running the latest version of iTunes on my computer running Windows 7. Since November 2010, I have been unable to purchase anything, I have been unable to update my iPod touch 3rd generation, and I have been unable to sync, etc etc. The second I

  • Header infor in ALV

    I have copied FBL1N to ZFBL1N. Then I executed FBL1N by giving multiple vendors for Vendor Account and I executed the same. Output is like : Vendor Number, Company Code, Name and city as header info and then it is displaying Line item info as expecte

  • Backup or Export workspace images

    Hi, I use APEX 4 and embedded PLSSQL gateway. I need to daily export all the images of my workspaces (image are in the database) into a folder or a compressed file. I know how to do this manually using the APEX interface, but I want build a script th

  • Emails won't load

    For about a week now, my emails haven't been loading. The email headers/subject will show but no content in the body. We've changed nothing but noticed this, amongst other things, after the most recent Android install.

  • Problems with accessing collections in 3.0 after upgrade

    Hello ApEx Team, I noticed that my demo on apex.oracle.com related to the XML charts doesn't work properly any more. The chart is there but no values are showing up. The problem has something to do with accessing collections - it seems no data is fou