@#$@#$@#!!!!

So I have this very long and complex script. It was developed under a 11 version of eggplant. I recently was forced to upgrade to the newest and greatest. Well now I’m having ST errors popping up everywhere. 1st one is I was removing parentheses from a string that has the following in it without the quotes of course “(0,0,0,0,0)”. In version 11 I used

delete every occurrence of "(" from string

and then

delete every occurrence of ")" from string

That worked great. Now on version 12, it throws a fit on the 2nd part. It’ll delete the first parenthesis just fine. When it gets to the 2nd part it errors and complains about not being able to understand the command. SO, I tried “Delete ANY” without the “occurrence”. SAME THING. I ended up only with

delete "(" from string

and

delete ")" from string

Ok, so I’m passed that, even though it’s stupid that it didn’t recognize it. Now onto the one that really ticks me off. I’m trying to copy a file from one location across a network to another location. Written in version 11, I had no issues with this. Now that I’m in 12, it’s freaking out, but what I think is the “quotes”. Because once I remove all the variables and the quotes, I am left with "can’t understand “file” at or near 10. Now I am hoping that’s not the case and it’s the damn “tilde ~”. I’m tired of troubleshooting this script and doing workarounds. Help. The line is this.

This returns: STFileSystemException Failed to copy file or folder ~/Documents/GifCentral/ScreenCapture.gif (Error: The operation couldn’t be completed. No such file or directory)

copy file "~/Documents/GifCentral/ScreenCapture.gif" to folder global VolumeFolder&global WebFolder&"/OCR_Profiles/"&global profileID&"/ScreenCapture/"

without the variables it returns: STFileSystemException: Failed to copy file or folder ~/Documents/GifCentral/ScreenCapture.gif (Error: The operation couldn’t be completed. No such file or directory)

copy file "~/Documents/GifCentral/ScreenCapture.gif" to folder "/volumes/wwwroot/OCR_Profiles/Joe/ScreenCapture/"

without the quotes: Syntax Error at line 1: Syntax Error - can’t understand “file” at or near character 10

copy file ~/Documents/GifCentral/ScreenCapture.gif to folder /volumes/wwwroot/OCR_Profiles/Joe/ScreenCapture/

BOTH FILE AND FOLDER EXIST!

I take it that this is on the Mac? None of the string manipulation behavior changed between v11 and v12 and your initial example works fine for me. So if you run this code, it doesn’t work for you?:

put "(0,0,0,0,0)" into string
delete every occurrence of "(" from string
delete every occurrence of ")" from string
put string

For me, it outputs “0,0,0,0,0”

Now on version 12, it throws a fit on the 2nd part.

You’re going to have to be more specific than “throws a fit”. How about an actual error message?

Make sure that if you’ve cut and pasted this code from somewhere that it doesn’t use curly quotes – curly quotes are not the same as straight quotes and don’t function as delimiters (never have).

You definitely can’t have unquoted file paths. There does appear to be a problem resolving the tilde when using “copy file”; “move file” and “delete file” are working. As a workaround, you could do something like this:

set tilde to file "~"

and then use tilde as a variable in your command:

copy file tilde & "/Documents/GifCentral/ScreenCapture.gif" to folder global VolumeFolder&global WebFolder&"/OCR_Profiles/"&global profileID&"/ScreenCapture/"

or you could call the variable “home” or something instead of “tilde” – just a thought.

eggPlant v13 is due out later this month; we’ve logged this issue and hopefully we can get a fix in for that release. Note that any changes that are deliberately made that change behavior in such a way that they could cause compatibility issues with older scripts are flagged in red at the very beginning of the notes for the release where they appear. We try to avoid any such changes and when they are made, they are not made lightly. Usually they represent a fix to an inconsistent or buggy behavior that was unintentional to begin with.

Regarding file paths beginning with “~”, you can use the resolvedFilePath function to get the actual path. Or use “the home folder”:

put resolvedFilePath("~")
/Users/doug
put home folder
/Users/doug/