I'm doing a script that takes a list of e-mail from a text file and then allow me to select a save as a string. I found some ways to get the path of the file, but I'm in check by pulling the list

I found some ways to get the path of the file, but I am defeated by pulling the list from that. the function of the path get gives me the path as "Macintosh Users:: Documents: extractedb.txt (myUsername).

What I can't understand is how to get a dialog box to display a list that represents the content in the text file, I need to change the contents of the text file, I need the box to show me what I chose and I want to save my selection as a single string.
e '.

example of extractedb.txt information:

[email protected]

[email protected]

[email protected]

* has a random number of emails as well *.

I want this is to pull those emails from the text file and turn them into a list so I can get to be a selection in my dialog box.

Any help would be great = D

Assuming you have a text file with your example e-mail addresses, the following AppleScript will read this file in a list (mf_List) and then use this list as input to choose among the list. Because multiple selection is allowed (control button), the output is sent to a list (sel_addr). We check if the Cancel button was pressed by testing for false and if this condition is met, we the script error.  Based on a single or multiple list item content of the list, display accordingly.

game of mf to ((path to the folder as text) & "mail_list.txt")

the value mf_List to {}

the value sel_addr to {}

the value mf_List to paragraphs of (read file mf)

the value sel_addr to (choose from the list mf_List with title ¬

('Mail list' with multiple selections allowed without empty selection allowed)

If sel_addr is equal to false then

Error number-128

return

end if

If length of sel_addr is equal to 1 then

sel_addr display dialog box as text

on the other

the value Point to the text of TID to AppleScript delimiters

the value Point text in AppleScript return delimiters

display the dialog box elements of sel_addr in the text

the value Text of point AppleScript delimiters to TID

end if

return

Tags: Mac OS & System Software

Similar Questions

Maybe you are looking for