So I have this applescript that tries to grab all images from a folder and sends them to a friend through iMessage.
The folder is structure like so:
Desktop my-folder image-1 image-2 image-2
The problem is that when I read all files to a variable as a string and then try to set them to a
POSIX file I get the error:
Messages got an error: Can’t get POSIX file "/Users/user/Desktop/my-folder/image-name".
do shell script "rm -f ~/Desktop/my-folder/.DS_Store" tell application "System Events" set imgs to POSIX path of disk items of folder "~/Desktop/my-folder" end tell tell application "Messages" set targetServiceId to id of 1st service whose service type = iMessage set theBuddy to buddy "redacted phone#" of service id targetServiceId repeat with img in imgs set imageAttachment to POSIX file img # errors send imageAttachment to theBuddy end repeat end tell
How can I set
imageAttachment correctly to a
POSIX file so that I can send it with iMessage?