Applescript Turning list in .txt file into Choose From List
I am working on an applescript that will take a list of names in a .txt file and turn it into a list that the user can choose from in a "Choose from list" box.
While you can put a variable into the list brackets ( ex.: {variable_name, variable_name2}) and then assign a string to each variable, so that variable_name can stand for "2", "3", "4", and that will make 4 separate items in the dialog box. Example:
set variable_name to {"2", "3", "4"}
choose from list variable_name --
It displays 3 items to click in the choose from list box
But when I try:
set variable_name to (read file TextFile.txt)
choose from list variable_name
It displays 1 item to click in the choose from list box.
When I write to the .txt file, I'm using this command:
my WriteLog("\"2\", \"3\"")
on WriteLog(the_text)
set this_story to the_text
set this_file to (((path to desktop folder) as text) & "TextFile.txt")
my write_to_file(this_story, this_file, true)
end WriteLog
on write_to_file(this_data, target_file, append_data) -- (string, file path as string, boolean)
try
set the target_file to the target_file as text
set the open_target_file to ¬
open for access file target_file with write permission
if append_data is false then ¬
set eof of the open_target_file to 0
write this_data to the open_target_file starting at eof
close access the open_target_file
return true
on error
try
close access file target_file
end try
return false
end try
end write_to_file
MacBook Pro (13-inch Mid 2012), OS X Mavericks (10.9.5)