SD crashed when running the script at the end of this post. The new part of the script was the 2 lines:
set TheDictionary2 to current application's NSDictionary's alloc()
return TheDictionary2
As soon as I entered these lines and clicked the run button SD crashed. Nothing showed up in the console.
I included 4 files with this post:
Uncaught excepotion.txt.zip
Apple crash report.txt.zip
Script debugger crash report.txt.zip
Dictionary.scpt.zip
Uncaught excepotion.txt.zip is the error output that came from clicking the “Show Details” button on the internal error dialog in SD.
Dictionary.scpt.zip is the actual script that causes the crash.
use AppleScript version "2.3.1"
use scripting additions
use framework "AppKit"
use framework "Foundation"
(*
The NSDictionary class is Objectice-C's AppleScripts's equivalent of the record class.
NSDictionary objects allow data for a specified dictionary entry to be created, stored, read, modified and deleted through the use of unique keys.
When a new dictionary entry is created both the key and data associated with that key are created. The presence of these keys is the major
characteristic that diferenciates a dictionary from an array. Dictionaries can be mutable or immutable.
Each key-value pair in the dictionary is called an entry. All the keys in a dictionary must be unique. All keys must be up type string.
*)
-- Once a specific key-value pair has been entered into a dictionary that dictionary entry can not be modifed later
set ImmutableDictionary to current application's NSDictionary's alloc()'s init() --> (NSDictionary) {} (Creates a new, empty immutable dictionary)
set MutableDictionary to current application's NSMutableDictionary's alloc()'s init() --> (NSDictionary) {} (Creates a new, empty mutable dictionary)
set TheDictionary1 to current application's NSDictionary's dictionaryWithObjects:{"value1", "value2", "value3", "value4"} forKeys:{"key1", "key2", "key3", "key4"} --> (NSDictionary) {key3:"value3", key1:"value1", key4:"value4", key2:"value2"}
-- A dictionary can also be created using arrays
set TheValues to current application's NSArray's arrayWithArray:{"v1", "v2", "3", "v4"} --> (NSArray) {"v1","v2","3","v4"}
set TheKeys to current application's NSArray's arrayWithArray:{"k1", "k2", "k3", "k4"} --> (NSArray) {"k1","k2","k3","k4"}
set TheDictionary2 to current application's NSDictionary's alloc()
return TheDictionary2
TheDictionary2's initWithObjects:TheValues forKeys:TheKeys
-- set TheDictionary3 to NSDictionary("key1":" object1", "key2": "object2", "key3": "object3")
set TheDictionary3 to current application's NSDictionary's dictionaryWithDictionary:TheDictionary1
TheDictionary3
Uncaught excepotion.txt.zip (1.5 KB)
Apple crash report.txt.zip (1.5 KB)
Script debugger crash report.txt.zip (34.4 KB)
Dictionary.scpt.zip (7.5 KB)