Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'AppleScript formatting question' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
AppleScript formatting question
Authored by: st3phen on May 03, '07 10:59:56AM

I copied'n'pasted the suggested AppleScript into Script Editor. But when I try to "compile" it, I get an error on line 6 (do shell script...) immediately after /Developer/ADC\ stating
"Syntax Error: Expected """ but found unknown token."
(The dialogue's quotes are actually begin-curly-quote + straight quote + end-curly-quote.)

Any tips on this?



[ Reply to This | # ]
AppleScript formatting question
Authored by: djbe on May 03, '07 11:06:08AM
I had to change it a bit to get it to work:
on opening folder this_folder
  tell application "System Events"
    if file "/Developer/ADC Reference Library/index.html" exists then
      -- display dialog "it exists!" --used for testing
    else
      do shell script "hdiutil attach -noverify -mountpoint "/Developer/ADC Reference Library" /Developer/DevLibrary.dmg"
    end if
  end tell
end opening folder
Does anybody know how to mount the image without it showing up on the desktop? (and in the sidebar of finder windows)

[ Reply to This | # ]
AppleScript formatting question
Authored by: markuswarren on May 03, '07 11:27:04AM
the man entry for hdiutil mentions the following:

-nobrowse mark the volumes non-browsable in applications such as the Finder.

You would need to modify the "do shell script" line to the following:


do shell script "hdiutil attach -mountpoint /Developer/ADC\\ Reference\\ Library/ /Developer/DevLibrary.dmg -nobrowse"
The volume won't appear on the desktop, nor in the sidebar as a volume. When you navigate to the path where the mountpoint folder is located, then you will be able to browse and open the files within (or I was able to in my brief test). The volume is read-only at this point though.

[ Reply to This | # ]
AppleScript formatting question
Authored by: markuswarren on May 03, '07 11:17:25AM
The problem is due to the backslashes' in the "do shell script line" not being escaped, thus when it's compiled it gets an error. The line in question should read:

 do shell script "hdiutil attach -mountpoint /Developer/ADC\\ Reference\\ Library/ /Developer/DevLibrary.dmg"
The full script code, with the amended line would be:

on opening folder this_folder
	tell application "System Events"
		if file "/Developer/ADC Reference Library/index.html" exists then
			-- display dialog "it exists!" --used for testing
		else
			do shell script "hdiutil attach -mountpoint /Developer/ADC\\ Reference\\ Library/ /Developer/DevLibrary.dmg"
		end if
	end tell
end opening folder


[ Reply to This | # ]