I need to check the existance of a folder (among other things) in a script I’m writing, and I was wondering if there is an alternative to specifying the entire path to folder. A lot of languages, if you refer to a file/folder, its usually relative to the folder the app/script is running from…does AppleScript not do it this way?
Also, I need to use a 2 dimensional array in the script I’m writing, but I’ve only gotten it to work by predefining how many lists are within the list (i.e. set db to {{},{},{},etc…}). Is there a way to easily add another list? I’ve tried:
set db to {1,2,3}
set db to {db,{4,5,6}}
set db to {db,{7,8,9}}
But, when I do it this way, the brakets get all weird - {{{1,2,3},{4,5,6}},{7,8,9}} - or something like that, which screws it all up.
To my knowledge, you cannot write a 2D array, let alone just a list to a file, it has to be coerced to a stringified datatype before writing to a file. You could, I suppose, build your variable as a delimited string and write that to a file. Then, read the file and get the text items to get your 3 sublists.
--=============================
--Build your variable and write to a file
set moo to ""
set moo to moo & {1, 2, 3} & return
set moo to moo & {4, 5, 6} & return
set moo to moo & {7, 8, 9} & return
write moo to "Mac HD:Some File"
--=============================
--=============================
--Read your file and get your data
set mooRead to read "Mac HD:Some File" as text using delimiter return
--result is a list of 3 items
--=============================