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.
Similar Messages
-
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.
-
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, -
Create folder action in automator
I want to create a folder action that will move downloaded website backups into a specific folder.
I cribbed the automator folder action shown below from Macworld
The Folder Action appears not to work when left to just monitor the folder.
However, if I force the Action to run from within automator it works, albeit with an error message at the beginning saying that you can't execute the action from within Automator. Still it finds the file and moves it to the intended destination.
By way of checking this I looked at the "Set Up Folder Action" by right clicking on the downloads folder. After clicking there is a long delay but when the panel opens there is no content, see second image below. I tried clicking the + button to add the "Downloads" folder but after a long delay the "Open" dialog closes and nothing has appeared in the panel. I assume that any folder action should show up in this panel, but I've no experience in using it.
Any suggestions as to a problem with the Action or why the panel is blank and why I can't attach the Action using this setup panel?
Thanks
Folder Action
Note: Path and File have been omitted.
Note: OS X 10.10.2
Folder Action SetupI'm confused. You showed two Automator actions with the same name, one was a folder action one wasn't.
Are you sure the correct Automator action (the one that is a folder action) is attached to the folder?
If when the Folders Action setup window is opened and you select Articles_Folder.workflow and then edit script are you getting the right workflow?
Assuming you do I would start off very simply. Try this:
It will label green screen shot image files saved to the Desktop.
See if this works for you. -
System Events create Folder Actions stop suddenly
Hello
I has implemented a applescript in order to backup files to a external HD using folder actions
This script attaches the same script in each new folder recusively, and it adds a new one Folder Action with the same name of the folder.
1 - When a use the Finder to copy around 4000 files and 500 folder, the folder action list increases slowly, but i did not had so much patience to wait the proceeding to complete.
2- When i use the automator with shell script action execution, to copy the files and folder, the process finalizes with success, but the folder action list stops with 10 items instead of 569, that is the number of folders and subfolders. So i do not know what is happening...
3- So I changed the automator action to execute a applescript that executes a shell script, the folder action list stops with 200 folder action approximately. So i do not know what happen too.
What can i solve this backwardness problem?
There are a limit of amount to create of folder action ?There are another user with tha same problems: BookOfPower
https://discussions.apple.com/thread/1233099?start=15&tstart=0
Because applescript is not reliable ? -
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 -
Processing a File (From a Folder Action) Through an AppleScript
I have a Folder Action enabled which automatically uploads images placed in a folder to a FTP server. It works great when I'm at home on my own network, but if I'm somewhere with a firewall that prohibits connecting to my FTP server (i.e. work) or if I am not connected to the internet, the folder action will still run but my images will never get uploaded.
I've attached a screenshot of my workflow. The folder action gets the image added to the folder, copies the original to a different folder, and then scales the image down to a smaller size before uploading it. I'm using the upload workflow action from Transmit.
I figured I could use an AppleScript to check whether or not my computer can reach the ftp server and then wait until it was connected to run the rest of the workflow if it can't reach the server:
repeat with i from 1 to 86400
try
do shell script "ping -o ftp.examplewebsite.com"
exit repeat
on error
delay 5
if i = 86400 then error number -128
end try
end repeat
The only problem is, I'm pretty inexperienced with AppleScript and am not really sure how or where to insert it into my workflow to get the image to "pass through" the AppleScript. Currently, whenever I include this AppleScript in my workflow, before the Upload action, for example, the image ends up not getting passed through the AppleScript and it doesn't get uploaded as a result.
Hopefully this a fairly simple question and someone can help me out, or if there's an easier way to delay running a folder action until I can connect to the server someone will let me know. I can clarify anything if necessary.Good job
I just saw this…
applescript in automator - stop a workflow
It kills the workflow based on a test, so I tried this…
Here is the text if you want to copy & paste. It will fail on Apple.com & stop the workflow. Success should allow it to continue.
on run {input, parameters}
try
set pinged to do shell script "ping -c 3 -q apple.com "
if pinged is equal to 0 then
return input
end if
on error
error number -128 -- exit by user-cancel
end try
end run
on run {input, parameters}
display dialog "Rest of script will now continue..."
return input
end run -
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. -
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 removeExtensionmmh, 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? -
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. -
How to Attach Script to Photoshop Action or Folder?
I'm not familiar with Applescript at all! However, I downloaded a script for use with Photoshop which crops an image to a specific format. It works great if I've got an image open in Photoshop.
What I can't figure out how to do is to either apply that script to an entire folder to process all images in that folder, or better yet, record a Photoshop Action that uses that script.
How can I use that script to do a batch process from either Photoshop or the Finder?
Thanks for any help for this total newbie.The Mac I am currently using does not have 'Adobe Photoshop CS3' installed. However, based on [1], the code samples should work. Some editing may be needed, based on your specific requirements.
Sample code01:
-- Code starts here --
on run ()
my handle_Items(choose folder with multiple selections allowed)
end
on open (dItems)
my handle_Items(dItems)
end
on handle_Items(tItemss)
tell application "Adobe Photoshop CS3"
repeat with i in tItemss
set fList to list folder i without invisibles
repeat with j in fList
try
open file ((i as string) & j)
try
set docRef to current document
set (docWidth,docHeight) to (width of docRef,height of docRef)
set minDimension to docWidth
if docWidth > docHeight then set minDimension to docHeight
crop docRef bounds {(docWidth - minDimension) / 2, (docHeight - minDimension) / 2, (docWidth + minDimension) / 2, (docHeight + minDimension) / 2}
save current document
close current document saving no
end try
end try
end repeat
end repeat
end tell
end handle_Items
-- Code ends here --
Save the code as an application (AppleScript 'applet').
You and then either double click on the applet - and navigate to and select a desired folder (or folders), of which its / their contents will be processed; or, you can drag a folder (or folders) onto the applet, of which the folders contents will be processed.
Code sample02:
-- Code starts here --
on adding folder items to tFolder after receiving tItems
tell application "Adobe Photoshop CS3"
repeat with i in tItems
try
open file (i as string)
try
set docRef to current document
set (docWidth,docHeight) to (width of docRef,height of docRef)
set minDimension to docWidth
if docWidth > docHeight then set minDimension to docHeight
crop docRef bounds {(docWidth - minDimension) / 2, (docHeight - minDimension) / 2, (docWidth + minDimension) / 2, (docHeight + minDimension) / 2}
save current document
close current document saving no
end try
end try
end repeat
end tell
end adding folder items to
-- Code ends here --
See 'Folder Actions Reference' about AppleScript Folder Actions; and, 'Running an automation when a folder is changed' for attaching an AppleScript Folder Action.
[1] - Consult 'photoshopcs3_applescriptref.pdf' for Adobe Photoshop AppleScript classes and commands. -
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
BudgieHello
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) -
OSB : How can we copy actions from one project folder to other projects?
How can we copy actions from one project folder to other projects in OSB?
For eg:
I have a service call out action in Project1/proxySer1
I want to copy this to Project2/proxySer2.
Espicially, in our case error handling callout is common to all of our projects and we should be able to copy from one to another.
Edited by: user10367892 on Aug 20, 2009 12:28 PMThank you for the reply.
It was my fault. I was on two different servers, while i was doing this and so didn't work. But copy /past action works as you suggested.
Can I select multiple actions from one stage and paste to different proxy service? I have too many options to copy/paste and hence I have this question.
Is there any other way of copying all selected actions in one stage to another, but not the complete stage itselft? -
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 -
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.
Maybe you are looking for
-
Why does the mouse scroll no longer work in Firefox 4?
I upgraded to Firefox 4 and suddenly my mouse scroll no longer works. It works fine for other programs and IE also Chrome, just not Firefox 4. How do I fix this? If this cannot be fixed, how can resort back to the old version?
-
Can't update vault - icon is pale red
For some reason I can't seem to be able to update my vault. The drive is connected and appears in the vault pane, but the update vaults icon is a pale red. Update All Vaults in the File menu is also grayed out. There is over 200GB available on the dr
-
OWB 10.1.0.4.0 deployment results in RPE-01011
We are deploying the same project, developed in OWB version 10.1.0.4.0, to both a test and production server. Since a reorganisation of those servers we've been unable to deploy mappings to the production site, due to an apparent version discrepancy:
-
Hi, While trying to create and save a TPM plan under Marketing Planner, we get the following error: Object 'SEM' not found as part of address 'SAP/PUBLIC/SEM/UPX/LAYOUT/delete.gif' Any idea on how to remove this error? Thanks in advance Sujon
-
Firefox 3 and layout.css.dpi
hello, after an Arch update, Arch offered me Firefox 3 to replace Firefox 2. In the version 3 I realized I can no longer use the layout.css.dpi variable in about:config, which controls the size of rendering fonts. Now I use the -lcd versions of font