Featured Post

QAnon: The Q-Sort Personality Profile Builder

Gettin Billy with It QAnon is based on Q-Sort: A psychological technique of which there are many variations, resulting in 50 descript...

Monday, April 23, 2018

New Item Alert - Folder Scripts

This script was found in /Library.  Apparently, it alerts a remote user as to when a new item has been added in a folder, and what that item is:


(*
add - new item alert

This Folder Action handler is triggered whenever items are added to the attached folder.
The script will display an alert containing the number of items added and offering the user
the option to reveal the added items in Finder.

Copyright © 2002–2007 Apple Inc.

You may incorporate this Apple sample code into your program(s) without
restriction.  This Apple sample code has been provided "AS IS" and the
responsibility for its operation is yours.  You are not permitted to
redistribute this Apple sample code as "Apple sample code" after having
made changes.  If you're going to redistribute the code, we require
that you make it clear that the code was descended from Apple sample
code, but that you've made changes.
*)

property dialog_timeout : 30 -- set the amount of time before dialogs auto-answer.

on adding folder items to this_folder after receiving added_items
try
tell application "Finder"
--get the name of the folder
set the folder_name to the name of this_folder
end tell
-- find out how many new items have been placed in the folder
set the item_count to the number of items in the added_items
--create the alert string
set alert_message to ("Folder Actions Alert:" & return & return) as Unicode text
if the item_count is greater than 1 then
set alert_message to alert_message & (the item_count as text) & " new items have "
else
set alert_message to alert_message & "One new item has "
end if
set alert_message to alert_message & "been placed in folder " & «data utxt201C» & the folder_name & «data utxt201D» & "."
set the alert_message to (the alert_message & return & return & "Would you like to view the added items?")
display dialog the alert_message buttons {"Yes", "No"} default button 2 with icon 1 giving up after dialog_timeout
set the user_choice to the button returned of the result
if user_choice is "Yes" then
tell application "Finder"
--go to the desktop 
activate
--open the folder
open this_folder
--select the items
reveal the added_items
end tell
end if
end try

end adding folder items to

Keep in mind that many of these pernicious intrusions target system files that are supposed to be there, and are otherwise innocuous.  This one came to my attention as it had been recently accessed.  That may be normal, but I've never seen any of these commands or options before, during, or after adding anything to a folder, so I cannot say.  I also don't use Scripting, but this may have been installed by a third-party program for reasons unknown.

Calls to Apple Customer Support were continually re-routed by the automated system, which kept prompting me to enter a contact number.  I eventually reached a voice mailbox, and have not received a return call.

© Copyright 2018, The Cyberculturalist

No comments: