Hello,
The script below compiles and executes without returning any errors, but does not produce the desired outcome during testing.
The desired outcome is to move extra plist files for the weather widget to the Trash. Such files contain an extra extension consisting of a variable combination of characters and numbers. An example is
widget-com.apple.widget.weather.plist.r2wmTrw
What have I done improperly in this AppleScript?
-- Get current user's name
tell application "System Events"
set currentUser to (name of current user)
end tell
-- Check downloads folder and move extra weather widget plist files to the trash
tell application "Finder"
try
delete (every file of folder "Preferences" of folder "Library" of currentUser of folder "Users" whose name contains "widget.weather" and name extension is not "plist")
end try
end tell
Before writing the above script, I tried to accomplish the above goal by building an Automator app that included a command that (in turn) included "whose extension is not plist." The resulting app does move extra plist files to the Trash, but it also moves itself to the Trash! I don't understand that behavior!
Thanks in advance,
Barry