Syntax Error?

Hi,
Can anyone see where the syntax error is for the 2 sh.execute commands? Been looking at this for 2 hours now :frowning:

I get the feeling it has something to do with all the nested quotation marks and apostrophes, but I’m baffled as to how to correct it.
Thank you all in advance.

[code]If LoginCheckBox.Value then

Dim sh As New Shell
sh.Execute “osascript -e 'tell application “System Events” to make login item at end with properties {path:”/Applications/Digital\ Assets\ Manager/Digital\ Assets\ Manager\ App/Digital\ Assets\ Manager.app", hidden:false}’"
sh.close

Else

Dim sh As New Shell
sh.Execute “osascript -e ‘tell application “System Events” to delete login item “Digital\ Assets\ Manager.app”’”
sh.close

End If[/code]

You did not escape the double quotes.
Try

sh.Execute "osascript -e 'tell application ""System Events"" to make login item at end with properties {path:""/Applications/Digital\\ Assets\\ Manager/Digital\\ Assets\\ Manager\\ App/Digital\\ Assets\\ Manager.app"", hidden:false}'"

Thanks Ulrich.
That solved the syntax errors, but now the pesky script itself doesn’t add my app to the login items - it seems to dislike the escaping slashes \, but I though that had to be done when using the Terminal?

Thanks Ulrich for solving the syntax error - much appreciated.

Well, you asked about the Syntax error :wink:
Sorry, the shell is something I don’t use that often. Hopefully someone else can jump in.

SOLVED.
I had to remove the escaping slashes. It seems sometimes they need to be added, and sometimes not :slight_smile:

Use escaping slashes when you don’t surround a path in quotes, do not use escapes if you use quotes.

Ahaaaa - thanks Tim - that makes much more sense :slight_smile: