The first thing would probably be to not use exceptions for flow control.
You don’t mention how you are calling the shell command or how you are handling the progress bar stop button, but if you are using NSTask, you can keep track of it (property, etc). Then the task can be terminated immediately in the stop button handler before performing the normal progress bar dismissal.
Post
Replies
Boosts
Views
Activity
Control-x normally doesn’t do anything in the Finder - what are you expecting it to do?
The standard AppleScript display dialog is modal, so you will need to use something else, for example a window or panel via some AppleScriptObjC or a separate helper application.
You need to use the terms my or of me for KVO compliance, for example
set my myValue to "No"
Those terms are not part of the AppleScript language itself, so you aren’t going to find them in the AppleScript Language Guide (although they are available from the System Events processes suite). You can use something like the Accessibility Inspector application (included with Xcode) to find which terms are used for any given UI element - the terms themselves are defined in macros or constants in the various Cocoa frameworks, such as Application Services.
In AppleScript, control statements such as if are not expressions and do not return results - until a statement that yields a result is executed, the value of the built-in result property is undefined.
You shouldn't rely on the value of the result property remaining stable across multiple statements - in this case, when executing the if x = 4 statement in the repeat loop, the property is getting cleared. This kind of issue can be avoided by explicitly setting your own variable to a value to test, for example set myResult to button returned of (display dialog "whatever").
If this is in Mojave or later, does the application have the appropriate NSAppleEventsUsageDescription - https://developer.apple.com/documentation/bundleresources/information_property_list/nsappleeventsusagedescription key(s) in the Info.plist?
You need to give your application permission in System Preferences > Security & Privacy > Privacy > Accessibility.
Are you asking about creating an NSPanel similar to the one presented by the system, and if so, exactly what are you wanting to do?
https://support.apple.com/HT208531 - is your device compatible?
The Finder doesn't know about POSIX paths, so you will need to use HFS paths, aliases, or coerce to the POSIX file class. A better approach might be to use System Events, which can handle POSIX paths.
All the open handler does is pass on the items that were dropped onto the application, it doesn't have anything to do with the type of files. Has the Info.plist been modified? Does it do the same thing from a new user account?
Your installer would need to place the file there before it can be used like that. You can also place the icon file in the application bundle's Contents/Resources folder and access it using path to resource.
In AppleScript, the words of a string are where there is a continuous series of letters, numbers, and certain symbols, so an easy way to get rid of that whitespace would be to get the first word, for example:first word of fileCount
When using the repeat with X in Y form of the repeat statement, the loop variable X is actually a reference to an item in the list Y. Depending on what you are doing with the variable X, the value may not be dereferenced (yet), so comparisons can fail. To be sure you are using the value of X instead of its reference, you can coerce it to the desired class or get its contents, for example:if contents of X = "whatever" then somethingAlso note that index is reserved word (note the different font in the Script Editor), and may result in unexpected behavior if used as a variable name.(Edit: ninja'd by hhas01)