Hi All,
Shane helpfully rewrote a script that I had asked about yesterday here in this post:
https://macscripter.net/viewtopic.php?id=40224
Now I am wanting to take his idea, and turn it into a droplet. The problem I am having is replicating the file reference that is created with the following line:
set theOutput to (choose file name default name "Untitled.jpg")
Since I am working on a droplet, I don’t want to poll the user for a new name for every image, I just want to add "_RGB to the end of the file name. So the the new “theOutput” string would look something like this:
set newOutput to "MyComputer:Users:Chris:Downloads:TestImage_RGB"
set theOutput to (a reference to file newOutput)
Now when I try to reference that as an Alias, of course, I get an error since there is no actual file there yet. So I have tried converting that string into a Posix File and “a reference to file” and neither of them works when I send it gets to the last line of Shanes Script
jpegData's writeToURL:theOutput atomically:true
I get the following error: “-[NSAppleEventDescriptor isFileURL]: unrecognized selector sent to instance 0x614001236f00”
So I know what I am doing wrong. I am not passing the correct “file” specification to that last line of the script. I just don’t know how to create the same file reference that is being created when you prompt the user with:
choose file name default name
Can anyone point out what I am doing incorrectly here?
Also SD sees the two file references differently. When you use “choose file name default name” the info for that variable in SD shows file “Filepath”. But the variable created with the “a reference to file” has a little blank file icon in the value for the file reference and then says file “Filepath”. So that shows me that I have so far not found the right way to specify the file since SD displays the values for those variables differently.
Here is an example of that difference