Automator - new file in a folder

hi all
any script that recognise a new file in a folder which can then trigger off other scripts
basically I am sending in a file via a remote mac using FTP into a hot folder
when the file is complete I want it to be FTPd to a particular destination
(I have droplets to auto FTP so no need for help on this)
kind regards
Matt

on adding folder items to this_folder after receiving added_items
activate application "Transmit"
tell application "Transmit"
-- create new window to upload files with
make new document at before front document
tell document 1 -- send commands to the frontmost document window
tell session 1 -- sends commands to the first session in the window
-- CHANGE: connects to the favorite with the name specified
-- You may also use the connect to command to connect to a non-favorite server
if {connect to favorite with name " name here "} then
-- CHANGE: change remote path if desired
-- set their stuff to "Upload Destination"
-- upload all items dropped onto the droplet
try
repeat with theFile in added_items
-- ignoring result from upload
upload item theFile
end repeat
end try
else
display dialog ("An error occured, could not connect to favorite")
end if
-- once the upload has finished, disconnect
disconnect
end tell
end tell
end tell
tell application "Transmit"
-- create new window to upload files with
make new document at before front document
tell document 1 -- send commands to the frontmost document window
tell session 1 -- sends commands to the first session in the window
-- CHANGE: connects to the favorite with the name specified
-- You may also use the connect to command to connect to a non-favorite server
if {connect to favorite with name " name here "} then
-- CHANGE: change remote path if desired
-- set their stuff to "Upload Destination"
-- upload all items dropped onto the droplet
try
repeat with theFile in added_items
-- ignoring result from upload
upload item theFile
end repeat
end try
else
display dialog ("An error occured, could not connect to favorite")
end if
-- once the upload has finished, disconnect
disconnect
end tell
end tell
end tell
end adding folder items to

Similar Messages

  • HT1347 When I add a folder to the library, does that mean that 'later' when I drop a new file into that folder (already added) it will automatically end up in iTunes? (or do I have to add file/folder to library every time I have a new file??) I'm using XP

    When I add a folder to the library, does that mean that 'later' when I drop a new file into that folder (already added) it will automatically end up in iTunes? (or do I have to add file/folder to library every time I have a new file??) I'm using XP...

    iTunes does not actively scan the media folders.  If you manually add content to a folder, then you must add that content to iTunes manually via the File > Add File/Folder feature.
    The only folder that gets scanned is the "Automatically add to iTunes" folder.

  • Automator and applescript to copy new files in a folder with same name as parent folder

    I have an iMac with a pictures folder (Finder folder) containing several subfolders with pictures. As per now, all these subfolders are imported into an iPhoto library (and the structure of the Finder pictures folder is thus maintained: The iPhoto events are named the same as the Finder subfolder). I.e. I have not created any albums in iPhoto.
    I have also set up a workflow, where new iPhone photos are automatically being synced to specified Finder folders within the iMac pictures folder. So what I want to do is to make a workflow to import potential new photos from week to week into the existing iPhoto structure. I know iPhoto has this Autoimport folder, so this one is unpacked and "mapped". So, this is what I´m hoping to do:
    Automator (iCal - want to do this on a weekly basis):
    - Get specified Finder items -- set to target folder = iMac pictures folder
    - Get folder content (with subfolders)
    - Filter Finder items
         - Items from the last 7 days (which then would be any new files created last week)
    - Applescript/shell script loop(?)
         - Get folder name for each file´s (from previous step) parent folder
         - Create new folder with same name as the file´s parent folder (if not already existing) under the iPhoto Autoimport folder
         - Copy the given file into the folder from above
    - Run iPhoto application (Automator task), which then should just auto import the new photos according to the Finder folder structure
    Whith the workflow above, I aim to maintain the existing iPhoto structure, and just import new photos into the existing structure. Creating folder names under the Autoimport, similar as the existing Finder folder names / iPhoto events should make it possible to have the new files imported under the existing event, right?

    Anyone?
    I have now switched to Aperture (from iPhoto) due to Aperture´s capability to handle Finder folder structure, and due to the possibility of having the pictures within Aperture as referenced files to the pictures within the Finder folders (i.e. possibility to delete pictures from both library and Finder folder at the same time).
    So I have a superior Finder folder called "Album". Within "Album" I have several subfolders (sub albums) containing pictures. The "Album" folder with subfolders are imported into Aperture as "Projects and albums", and the pictures are uploaded within the Aperture structure as referenced files. So for now the Aperture structure is more or less a direct mirror of the Finder folder structure, whereas "Album" is the project.
    And this is my current workflow in Automator, but I´m searching help with my Applescript:
    - Get specified Finder items (target folder = the superior Finder folder "Album")
    - Get Folder content
    - Filter Finder items (to look for potential new files to import into Aperture)
         - Kind is not folder
         - Date created last X days
    The output files from this task enters an Applescript
    on run {input, parameters}
           repeat with f in input (**Loop**)
                   tell application "Finder"
                          set fileName to name of (f)
                          set parentFolder to name of container of (f)
                          tell application "Aperture"
                                 tell library 1
                                        tell project "Album"
                                               if (exists album parentFolder) then
                                                 ** I then would like to check if fileName already exist within the existing album**
                                                 ** If not existing, I would like to import file f into the existing album as a referenced file**              
                                               else if not (exists album parentFolder) then
                                                       make new album with properties {name:parentFolder}
                                                ** I then would like to import file f into the new album as a referenced file**
                                               end if
                                        end tell
                                 end tell
                          end tell
                   end tell
           end repeat
    end run

  • I'm trying to write an Applescript: when I add a file to a folder, I want finder to name it "1" and increment the other files in the folder by 1. i.e. once I drop a new file into the folder, the file originally called "1" will be renamed "2" etc

    I'm trying to write an Applescript. I have never used Applescript but my boss has just asked me to write a script so I dutifully nodded and said "Yes Boss"...
    The funtionality I need is that I want finder to rename the files in folder when I drop a new file in. When I add the new file (file neame: "1") to a folder, I want to increment the other file names in the folder by 1.
    So when I drop a my new "1" file into the folder, the file original file called "1" will be renamed "2", the original file named "2" will be renamed "3" etc
    I'm creating a 'stream' of images. When I add a new image i want it to nudge the other images in the folder along.
    Thanks guys!

    Maybe this will help. If you monitor the "More Like This" box (top right), other threads appear. Opening them usually displays other threads.
    https://discussions.apple.com/message/1986834#1986834

  • Mail Finder doesn't find new files

    When I save a new file to a folder and then to add it as an attachment to a message in Mail, the finder window in Mail doesn't show the new file. I have to exit and restart Mail for the finder window to find the new file. What's going on?

    I often have the same problem, but the annoying workaround I came up with is a little quicker and less annoying than relaunching Mail. I just go into the finder (I don't even need to close the "Attach" window) and change anything about the file—change a single character in the name, move it to another folder, or the desktop, etc.—and the "Attach" window promptly sees it.

  • Update catalog with new files ? - LR 2.2

    I have imported all my files/folders into catalogs in LR2.2
    But if I add new files to a folder, the files do not show up
    in LR. I guess I have to update/refresh the catalog but how
    do I do this ? Do I have to import the folder again, to get
    all the new files into the catalogs ?

    Right click on the folder when in Library and choose "Synchronise folder.....". This will allow you to import the new files in that folder.
    Rich

  • Uninstall the application does not delete all new files and folders.

    If the user decides to uninstall my Air app, it does not delete the created folders with files in AppData. Another problem is that if the application creates new files in the folder Program Files/AirAppFolder, then uninstall of the app are not deleted these files.
    How to solve these problems, help please?

    Hi,
    AIR shouldn't be creating additional files in your program files folder, is this something you're doing programmatically?  If so, you might want to consider using File.applicationStorageDirectory instead given permission problems you'll have on newer operating systems.
    As to uninstalling all files (even the data created in the user's storage folder) this is something you might consider using a native installer to take care of.  Since the AIR installer is unaware of this data, it won't know to delete it on uninstall.  Instead, you'll want to create a custom function in a native installer that deletes these folders/files and then sub launches the AIR install/uninstall.
    Thanks,
    Chris

  • Making a new file

    Whenever I make a new file in a folder, it makes the file appear right where I right-click. It does not snap anything to a grid or anything. Is there some way to change this? I just want the files to be in an orderly fashion.

    In Finder choose View - Clean Up. You can also right click anywhere in a Finder window and choose Show View Options. I would also recommend that you watch the Finder Basics Tutorial at:
    Find Out How Video tutorials

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

  • Trigger automator script when new file created

    I want to create an automator script that will recognise when a new file is created (with a name that matches a particular pattern and in a certain directory) and mail that file to a predefined address. Is that possible?

    yes, this is possible with a folder action. you can attach a folder action to the folder in question. it will watch this folder for new files and trigger when a new file is added. you can create an automator workflow and save it as a folder action plugin.

  • Finder - Create new files directly from a folder using finder ?

    In Finder, is there a way to do a right-click in a folder and create a new file like: New Text File or New Document from that location?
    I used to do this oftenly in Windows (right click, New Word document) but I have not found it in Mac OS X, any work around ?
    Thanks

    Try the [Apple feedback page|http://www.apple.com/feedback>. However, note that this is unlikely to be added. It would be a very cumbersome feature.
    On Windows, you're almost guaranteed to be tied to a particular set of document creation tools. If you're using an office suite other than MS Office, you're so weird you might as well be using a Mac! This means that commands like "New Document" make sense there.
    On a Mac, a "document" could be created with MS Word, Pages, TextEdit, NeoOffice, OpenOffice, Mellel, Nisus Writer Marinter Write, or any of a host of other programs. (Mac users tend to put less emphasis on the popular tool and prefer to use the tool that "fits the hand" best.) Further complicating things is the fact that "document" is a very generic term, since every spreadsheet is a document, every Photoshop file is a document, etc. The contextual menu would rapidly become unmanageable if it had to fill up with "New Whatever Document" commands for every app on your hard drive!
    It is possible for you to add your own custom services to the contextual menu using AppleScript or Automator, and you should be able to create services to create new documents for the apps you use frequently. Check on the [AppleScript forum|http://discussions.apple.com/forum.jspa?forumID=724] for guidance on how to do this.

  • Need a perl script which monitors a network folder and sends email when new files/folders arrived...

    I need a perl script (or something else better) which monitors a network folder and sends email when new files/folders arrived. I tried it in Automator but failed.
    Thanks!

    Yes. I tried it. But whenever I restart m Mac, the watch folder doesn't work until I reconnect to network or run the Automator... I need a simple system that automatically connects to the network and monitor the folder, even I restart the Mac.
    Thanks!

  • How do I change the default save location for new files in Pages back from iCloud to my Documents folder?

    I just upgraded OSX to Mountain Lion and Pages to 4.2, and because OSX is syncing with my iCloud account, when I go to save a new file in Pages it defaults to try to save to my iCloud account rather than giving me the folder structure on my hard-drive that I prefer. It requires two extra steps to save to the proper place in my Documents folder on my hard drive.
    Is there a way to reset the default so that when I go to save a new file, the folder structure opens to the last saved folder (like it does in other non-iCloud applications) rather than defaulting to my iCloud, and to do it without just removing documents from my iCloud account entirely?
    I checked the Preferences for both Pages and iCloud and found nothing about this.

    What I meant is turn off Documents and Data in iCloud in OS X. Keep it on on your iOS devices. iCloud will sync documents between the iOS devices and make them available on the iCloud web site, but it won't mess up iWorks' open and save dialog boxes. It also won't assume that you want all your documents in iCloud, which I think is undesirable anyway.
    Keep iOS and OS X separate, and use the web site to move files between the two as necessary.
    iOS iWork is different from OS X iWork. There are fewer fonts on an iOS device. iOS iWork programs have slightly different feature sets than OS X iWork programs, and the file formats are different. iCloud automatically converts the file format when necessary, but if you make a habit of saving things directly to iCloud, you are limited to the lowest common denominator between the two versions of iWorks. So why would anyone want iWork on the Mac to open and save documents on iCloud by default?
    If you want to store files in the cloud and sync them on your Macs, SugarSync is a much better solution. It lets you choose your sync folders, it doesn't make you reorganize your files, it lets you sync all file types, it doesn't convert files to a different format and back, and it stores everything in the cloud, too. Just the simle act of saving a file backs it up and syncs it. I wouldn't live without it. iCloud is best with iTunes purchases and synchronizing Mac settings and iOS files; I woudln't live without it. The two make an unbeatable combination.

  • Event handler if new File added in current folder

    Hi folks,
    I'm just trying to write a little jsx script for Bridge CS6.
    How can I implement an event handler that will react if the user adds a new thumbnail (new file) to the current folder in bridge.
    I've tested it with this code, but it doesn't work:
    app.document.thumbnail.watch ("children", function(id, oldVal, newVal) {
         $.writeln (oldVal + " to " + newVal);
         // some code here
    Thanks. Greetings

    Beautiful. Works as advertised. Thank you for pointing it out to me. Unfortunate that a basic subset of this extension's behaviour doesn't ship with Thunderbird out of the box, though.

  • Copy new file when dropped in one folder to another

    Hi!
    I have two folders, FolderA and FolderB
    When a file is dropped in FolderA I want it to be copied to FolderB.
    FolderA will contain other items, I only want to copy new files as they are dropped in FolderA regardless of what else is in either Folder and without copying the entire contents of FolderA.
    This seems such a simple request but I cannot fathom it out.
    Any suggestions greatly received.
    Thanks
    Colin

    make the following folder action attached to folder A. (I tested it and it works).
    on adding folder items to this_folder after receiving added_items
    tell application "Finder"
    try
    duplicate added_items to folder "B" of folder "Desktop" of folder "username" of folder "Users" of startup disk
    end try
    end tell
    end adding folder items to
    In place of "username" put the name of your home directory. Also the above script works if folder B sits on the desktop. If it's somewhere else, modify the path in the above script.
    Hope this helps.

Maybe you are looking for