save data to PC

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
sharyn
Posts: 3
Joined: Thu Feb 27, 2014 7:45 pm

save data to PC

Post by sharyn » Thu Feb 27, 2014 8:05 pm

Several years ago made program in RunTime 2.8.1 on a Mac. Made standalone for Mac and PC. Worked well, and saved collected responses to
a data folder on the computer, both Mac and PC. Have since downloaded community Livecode and also upgraded the Mac operating system. Opened the program in Livecode, made some minor changes - nothing to do with writing the responses to the data file, and again made standalones. Runs well on Mac and PC but doesn't save the responses to the PC. Any solutions?

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10333
Joined: Wed May 06, 2009 2:28 pm

Re: save data to PC

Post by dunbarx » Thu Feb 27, 2014 8:15 pm

I think the file structure change that happened several versions ago may be the culprit. Someone will come in soon and tell you.

Craig Newman

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: save data to PC

Post by Klaus » Thu Feb 27, 2014 9:01 pm

Hi sharyn,

1. welcome to the forum! :D

2. we MIGHT need to take a look at your script(s) to answer this 8)


Best

Klaus

sharyn
Posts: 3
Joined: Thu Feb 27, 2014 7:45 pm

Re: save data to PC

Post by sharyn » Fri Feb 28, 2014 3:03 pm

Hi,
Data path set up as follows:

set the itemdel to "/"
get the filename of this stack
delete the last item of it
put it into OPath
put OPATH & "/data/" into DPATH
.....
data written to computer:

put fld "Finishdata" on card "Bio" into URL ("file:" & DPATH & APPLICANT & TAB & OMSASN & "data.xls")

Any help greatly appreciated. I'm a research assistant, not a programmer, so assume I know very little.

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: save data to PC

Post by Klaus » Fri Feb 28, 2014 3:15 pm

Hi sharyn,

AHA! :D

OK, the problem is, that the user of your standalone does not have WRITE permission in the application folder!
Same for Windows!

So better change your scripts to read/write from/to the users DOCUMENTS folder!

Code: Select all

...
put specialfolderpath("documents") & "/data/" into tPath

## Check if folder already exists, if not create it!
if there is not a folder tPath then
  create folder tPath
end if
.....
## I presume that APPLICANT and OMSASN are variables?
## If they are just "names" you should put QUOTES around them

## Hint 1:
## A TAB in a filename as not really a good idea, so I replace it with an UNDERSCORE in the example.
put fld "Finishdata" OF card "Bio" into URL ("file:" & tPath & APPLICANT & "_" & OMSASN & "data.xls")

## Hint 2: adding the suffix XLS to a simple textfile does not make it a valid EXCEL document.
## But since I do not use Office, this might work anyway :-)
...
Best

Klaus

sharyn
Posts: 3
Joined: Thu Feb 27, 2014 7:45 pm

Re: save data to PC

Post by sharyn » Fri Feb 28, 2014 9:06 pm

Hi,
The code as I've written worked well on Mac and PC (Windows). Still works on the Mac, but not the PC, so I think there must be something other than what you've suggested. I'll give it a try, though. Thanks.

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: save data to PC

Post by Klaus » Fri Feb 28, 2014 10:09 pm

Sorry, I should have written:
...
the user of your standalone MAY not have WRITE permission in the application folder!
...
And with specialfolderpath("documents") you are always safe :D

Post Reply