Hi,
Can anyone see where the syntax error is for the 2 sh.execute commands? Been looking at this for 2 hours now
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
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
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