Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (*
- Demonstration of how dropping files on AppleScript icon works. Shows how to debug via on run path. Shows items added to folder.
- Save as an Application Bundle. Don't check anything.
- Shows log statement.
- It is easier to diagnose problems with debug information. I suggest adding log statements to your script to see what is going on. Here is an example.
- For testing, run in the Script Editor.
- 1) Click on the Event Log tab to see the output from the log statement
- 2) Click on Run
- Author: rccharles
- *)
- -- Gets invoked here when you run in AppleScript editor.
- on run
- -- debug lines
- set desktopPath to (path to desktop) as string
- -- here is a log statment.
- log "desktopPath = " & desktopPath
- -- Be sure to select a file on your DESKTOP.
- set see to alias (desktopPath & "Picture 1.png")
- -- Simulate dropped items list.
- set dropped_items to {see}
- common(dropped_items)
- end run
- -- Folder actions.
- -- Gets invoked here when something is dropped on the folder that this script is monitoring.
- -- Right click on the folder to be monitored. services > Folder Action Settup...
- on adding folder items to this_folder after receiving added_items
- common(added_items)
- end adding folder items to
- -- Gets invoked here when something is dropped on this AppleScript icon
- on open dropped_items
- common(dropped_items)
- end open
- on common(dropped_items)
- -- Write a message into the event log.
- log " --- Starting on " & ((current date) as string) & " --- "
- tell application "Script Editor"
- activate
- end tell
- log "class = " & class of dropped_items
- repeat with droppedItem in dropped_items
- log "The droppedItem is " & droppedItem & "; class = " & class of droppedItem
- display dialog "The droppedItem is " & droppedItem giving up after 3
- end repeat
- end common
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement