"Put URL" command can't find my file?

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
Mistfall
Posts: 23
Joined: Tue Dec 30, 2008 1:26 pm
Contact:

"Put URL" command can't find my file?

Post by Mistfall » Fri Jan 16, 2009 1:51 am

Hi all!

I'm trying to get data from My_file.txt , which is in the same folder as my Rev stack. Here's what I wrote:

on mouseUp
put URL "file: My_file.txt" into theFile
put theFile into field "heresMyFile"
end mouseUp

Field "heresMyFile" comes up empty. When I tried to debug by saying:

put URL "My_file.txt" into theFile
put the first word of "theFile" into message

Message gives me empty, although I have opened My_file.txt and seen that it does indeed contain text.

Since it is in the same folder as my Rev project, I didn't think I had to state the entire file path, so I'm not sure what is wrong!

I'm grateful for any help! Thanks!

Janschenkel
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 977
Joined: Sat Apr 08, 2006 7:47 am
Contact:

Post by Janschenkel » Fri Jan 16, 2009 6:30 am

The first thing I spotted was a space between the colon and the name of your file - but I think that's just a typo when copying to the forums?
Other than that, the fact that the file is in the same folder as the project is no guarantee that the engine will start looking in that folder - you will have to set the defaultFolder global property to that folder before using a relative file URL.

Jan Schenkel.
Quartam Reports & PDF Library for LiveCode
www.quartam.com

Mistfall
Posts: 23
Joined: Tue Dec 30, 2008 1:26 pm
Contact:

Thank You!

Post by Mistfall » Fri Jan 16, 2009 1:38 pm

Thank you! I think I have both of those problems going on.

I didn't know about having to set the default folder!

Post Reply