Simple add new item script question

I'm new to Applescript and I hope this is a simple question...

I've set up my iMac as a shared fax. Whenever it receives a fax, I have it to save the fax to a folder (called Incoming Fax) on my desktop.

Every time a fax comes in, I want an alert to come up on the screen. The add new item alert script sounds like just what I need. Whenever it alerts, someone will check it and either delete it or snd it along to whereever it has to go.

In reading the description, I'm a little confused. I have no idea what to do. Can someone help me set this up?

Thanks so much.

Steve

PB 1.67 15 Superdrive, Mac OS X (10.4.7)

Posted on Jul 28, 2006 5:01 AM

Reply
7 replies

Jul 28, 2006 5:50 AM in response to sypark

Your question is simple and properly described; however, not everyone may have a copy of 'AppleScript: The Missing Manual' and thus not know of the 'add new item alert script' code.

Non-'AppleScript: The Missing Manual' solutions:

Solution 01:

on adding folder items to this_folder after receiving these_items
display dialog "A new FAX has been received" buttons {"OK"} default button "OK" giving up after 3
end adding folder items to

Solution 02:

on adding folder items to this_folder after receiving these_items
say "A new FAX has been received"
end adding folder items to

Solution 03:

on adding folder items to this_folder after receiving these_items
set tString to "A new FAX has been received"
say tString
display dialog tString buttons {"OK"} default button "OK" giving up after 3
end adding folder items to

---

Save the 'on adding folder items ...' code, as 'Script' in the '/Library/Scripts/Folder Action Scripts/' folder.

-----

To 'Enable Folder Actions', 'Configure Folder Actions...', 'Attach a Folder Action...', etc., please consult ' AppleScript in Mac OS X - Folder Actions'.

Jul 28, 2006 3:36 PM in response to sypark

I did a 'Find' for 'add new item alert' and nothing appeared. I then 'Google'd 'add new item alert script' - and the 'AppleScript: Missing Manual' link was noted.

Other than to add a folder action script that I have created; I had not explored the contents of the '/Library/Folder Action Scripts/' folder. Well, until now - for your post, and another 'Apple Discussions: AppleScript' folder action script related post.

-----

Based on your original post - 'I've set up my iMac as a shared fax. Whenever it receives a fax, I have it to save the fax to a folder (called Incoming Fax) on my desktop. Every time a fax comes in, I want an alert to come up on the screen.' - you have to do (write) nothing - AppleScript code wise.

All you have to do is:
01. Open the 'Incoming Fax' folder.
02. Right button click ['control' key - click, if with a single button mouse] on the opened window, and select the contextual menu's 'Attach a Folder Action...' menu item.
03. If you note that 'Enable Folder Actions' is also a menu item (as opposed to 'Disable Folder Actions') - right button click ['control' key - click] on the opened window, and select the contextual menu's 'Enable Folder Actions' menu item.

From this point on, as a file or files are saved to, or dropped on (added to), the 'Incoming Fax' folder, an dialog box will appear stating 'x new items have been placed in folder "Incoming Fax".' (where 'x' is the number of just added items.

---

So there you have it, you have used AppleScript without writing a single line of code!

-----

With respect to 'this_folder' and 'added_items' in 'on adding folder items to this_folder after receiving added_items' - yes, you can replace them with any (non AppleScript reserved) names you prefer.

Mac OS X (10.4.4)

Jul 28, 2006 7:31 PM in response to sypark

From 'Solution 01:' ...

on adding folder items to this_folder after receiving these_items
beep
display dialog "A new FAX has been received" buttons {"OK"} default button "OK" giving up after 3
end adding folder items to

---

As per 'Standard Additions' dictionary (select 'Script Editor's 'Window, Library' menu item, and from the resultant 'Library' window double click on 'Standard Additions') - 'display dialog' is not an 'alert' window; thus, the reason for just adding 'beep' before the 'display dialog ...' line of code, above.

-----

As far as AppleScript documentation - if you have installed 'Developer' then just navigate to '/Developer/ADC Reference Library/documentation/AppleScript/', and double click on the 'index.html' file. Or, go to ' AppleScript (on-line)', and / or use ' Google'.

Mac OS X (10.4.4)

Aug 4, 2006 12:21 PM in response to dev_sleidy

Another follow-up to the folder action...

If the folder was on another networked user's drive, is there a way of dragging let's say a fax file to a file on my desktop that saves it automatically on the other user's folder, so that it would alert that other user, rather than manually opening up the network user's drive and manually placing that file?

Thanks.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Simple add new item script question

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.