AppleScript / Shell Script to read 'curl -L' data I have Dropbox file with two lines of data that I'd like to parse into two variables. The following function should have the right logic but doesn't seem to work:

set versionFile to do shell script ("curl -L 'https://www.dropbox.com/s/5eugzgr1alfgsp9/version.txt?dl=1'")
set lineDelimiter to read versionFile using delimiter return
repeat with oneLine in lineDelimiter
    if length of oneLine is greater than 0 then
        set variable to oneLine
        log "variable: " &amp; variable
    end if
end repeat


Error:
error "Can’t make \"1.0.0.2
 www.example.com/download-link-here\" into type file." number -1700 from "1.0.0.2
 www.example.com/download-link-here" to file

Any help is greatly appreciated. Cheers.
As coded, versionFile is a variable that contains the contents of the file not the file itself and you're using the read command improperly, as it reads data from a file, not a variable.

Change:

set lineDelimiter to read versionFile using delimiter return


To:

set lineDelimiter to paragraphs of versionFile




set versionFile to do shell script ("curl -L 'https://www.dropbox.com/s/5eugzgr1alfgsp9/version.txt?dl=1'")
set lineDelimiter to paragraphs of versionFile
repeat with oneLine in lineDelimiter
    if length of oneLine is greater than 0 then
        set variable to oneLine
        log "variable: " &amp; variable
    end if
end repeat




Results:

tell current application
    do shell script "curl -L 'https://www.dropbox.com/s/5eugzgr1alfgsp9/version.txt?dl=1'"
        --&gt; "1.0.0.2
www.example.com/download-link-here"
    (*variable: 1.0.0.2*)
    (*variable: www.example.com/download-link-here*)
end tell




Since the versionFile variable contains the text contents of the file, then in this case to work with it, use the elements of text objects, one of which is paragraph and in the context defined as:


  A series of characters beginning immediately after either the first character after the end of the preceding paragraph or the beginning of the text and ending with either a carriage return character (\r), a linefeed character (\n), a return/linefeed pair (\r\n), or the end of the text. The Unicode "paragraph separator" character (U+2029) is not supported.