LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
Glenn Boyce
- Posts: 137
- Joined: Thu Jul 24, 2008 11:22 pm
Post
by Glenn Boyce » Wed May 26, 2010 5:30 am
I want to load a text file from my H drive into a table field. i've tried the syntax below but can't get it to go.
Code: Select all
put URL ("file:" & "H:/Excel/Revolution/Stock files from QAD") into fld "StockCover" of card "Planning"
would someone please set my right!
Thanks
Glenn
-
dickey
- VIP Livecode Opensource Backer

- Posts: 118
- Joined: Wed Apr 08, 2009 11:54 pm
Post
by dickey » Wed May 26, 2010 6:02 am
Hello Glenn,
Perhaps you need to specify the file extension. Or alternatively you could try open file, read from file, close file etc.
How did you go connecting you scales to your PC?
Kind regards,
Andrew
-
Klaus
- Posts: 14198
- Joined: Sat Apr 08, 2006 8:41 am
-
Contact:
Post
by Klaus » Wed May 26, 2010 12:22 pm
Hi Glenn,
if you really have this file with exactly this name on your hd, then you could check for possible problems like this:
...
put URL ("file:" & "H:/Excel/Revolution/Stock files from QAD") into aVariable
answer the result
## "the result" is empty on success and may give a hint on what goes wrong otherwise
...
Best
Klaus
-
Glenn Boyce
- Posts: 137
- Joined: Thu Jul 24, 2008 11:22 pm
Post
by Glenn Boyce » Wed May 26, 2010 11:41 pm
Hi Andrew and Klaus
Haven't looked at the scales thing yet. Got some more basic issues to resolve first. Mean time we'll just manually enter the weight data.
I notice that in the code I supplied that i didn't have the actual file name at the end. I added that and used the answer result script and when i execute the script it says it can't open file which doesn't help me a lot!
-
Curry
- Posts: 111
- Joined: Mon Oct 15, 2007 11:34 pm
-
Contact:
Post
by Curry » Thu May 27, 2010 4:26 am
First, either use "answer file" to choose the file, or put your path in a variable and use "if there is a file" to verify you're correct.
Every character matters in the path, it's unforgiving, so you have to double-check.
Then, make sure you don't have the file open in another app! You might think for read-only it wouldn't matter, but it could be locked.
Best wishes,
Curry Kenworthy
LiveCode Development, Training & Consulting
http://livecodeconsulting.com/
WordLib: Conquer MS Word & OpenOffice
SpreadLib: "Excel-lent" spreadsheet import/export
http://livecodeaddons.com/
-
Glenn Boyce
- Posts: 137
- Joined: Thu Jul 24, 2008 11:22 pm
Post
by Glenn Boyce » Fri May 28, 2010 12:22 am
I'm really struggling with this. I thought it would be easy peasy! I can't get the file to open and have cut and pasted the file location only changing the \ to / as i understand I'm meant to do. Would putting the file i want to open in a directory close to the application help? I was trying to pull it in from a remote drive.
-
Glenn Boyce
- Posts: 137
- Joined: Thu Jul 24, 2008 11:22 pm
Post
by Glenn Boyce » Fri May 28, 2010 12:29 am
I have created the following:
Code: Select all
on mouseup
answer file "Select a file to open:"
put it
end mouseup
this gives me the answer in the message box:
H:/Excel/Revolution/QADFiles/stock.txt
Now I want to put the contents of that file into a table field called "StockCover"
I've tried opening the file using:
Code: Select all
put URL ("file:" & "H:/Excel/Revolution/QADFiles/stock.txt")into aVariable --into fld "StockCover" of card "Planning"
answer the result
the result is "Can't open file"
I've looked at the file and it's not locked or used on anything else. It is an excel file saved as a text file which I can upload manually into fld "StockCover" without any issues at all. All I want to do is automate that process!
cheers
Glenn
-
Curry
- Posts: 111
- Joined: Mon Oct 15, 2007 11:34 pm
-
Contact:
Post
by Curry » Fri May 28, 2010 1:12 am
If you follow my signature consulting link to find my email...and send me your stack and the file to import, I can get the import and the column separation (your other topic) working quickly for a very small flat fee.
Best wishes,
Curry Kenworthy
LiveCode Development, Training & Consulting
http://livecodeconsulting.com/
WordLib: Conquer MS Word & OpenOffice
SpreadLib: "Excel-lent" spreadsheet import/export
http://livecodeaddons.com/