Hello All,
In this code snippet I'm trying to retrieve the second word of line 1 in my text file:
set the itemdel to "/"
put the effective filename of this stack into mPath
put mPath & "/settings.txt" into mPath
answer(mPath)
put word 2 of line 1 of URL ("file:" & mPath ) into tPath
answer(tpath)
mpath gives me the correct path to my file but tPath is always showing me and empty string.
Is the syntax for this line: put word 2 of line 1 of URL ("file:" & mPath ) into tPath
correct?
Thanks!
Accessing files query
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Re: Accessing files query
Try putting the url into a variable and then reading the second word of the variable.
Re: Accessing files query
Thanks, Magice.
I did some debugging and was neglecting to delete the last item in my path to where my txt file resided.
All is well now.
Thanks for the response
I did some debugging and was neglecting to delete the last item in my path to where my txt file resided.
All is well now.
Thanks for the response

Re: Accessing files query
Code: Select all
on mouseUp
answer file ""
if it is not empty then
put it into theFilePath
end if
put URL ("file:" & theFilePath) into theWord
put theFilePath & cr & word 2 of line 1 of theWord
end mouseUp