Why is no dialog displaying in this script? Help!

Hi

I’m new to this game - can someone explain why this script (which runs as a Big Cat CMM script when I click on an app) opens the dictionary fine if the app has one, but fails to display the error message if it doesn’t?

on main(myApp)
tell application “Script Editor”
try
open myApp & “.asdictionary”
on error
display dialog “no dictionary…” buttons {“Sigh…”} default button 1
return
end try
end tell
end main

I’m going to elaborate it to show i.e. no dictionary, not an app, etc. - but first I want to understand the syntax mistake I’m making that means there’s no message in the first place…

  • padmavyuha

I’m not sure about this, but it could be because it’s not really producing an error and your display dialog is enclosed within the try block. Likewise, no error is returned when you drag and drop a non-scriptable applications icon onto the Script Editors icon to see if it has a dictionary.

Oh, okay - I did wonder if it was just because there was no error, but there should be if the dictionary doesn’t exist, surely?

Do you know if there’s an ‘if exists’ kind of statement I can do on the
myApp & “.asdictionary” string? I tried writing one of those instead, and it didn’t show anything when I fed it an unscriptable app.

In the Finder dictionary, there is a class Application File that has the property ‘has scripting terminology’, but I’m damned if I can figure out how to use it…[/b]

tell application "Finder" to¬
	set hasTerminology to has scripting terminology of alias "path:to:app"

It returns a boolean (true/false).

– Rob

file, alias, reference to file, path, posix path, posix file, that posix path of posix path doesn’t return a posix path but something useless!..

I never saw a prog env so complicated and unclear about files!! About that, is there a full sumary explaining all the differences?

I was trying recently do various tests to see but when I saw that:
set myAlias to myPath as alias
wasn’t exactely the same than :
set myAlias to alias myPath

and that the following code given in the doc couldn’t compile for me :
set fileSpec to new file default name “New Report”

(inside tell or not)

I gave up :-). I try stick using only alias (but file should exists) and use as few than possible posix stuff.

About knowing if a file exists, I saw get info and catch error used but alias seems a good way too (with catch too).

There is an interesting thread about ‘has scripting terminology’ at this link…

http://bbs.applescript.net/viewtopic.php?t=3705&start=0&postdays=0&postorder=asc&highlight=scripting+terminology

Also, where are the .asdictionary files kept? I could only find one on my drive and it’s for an AppleScript Studio project I was playing with.