Hi all,
I am experiencing issues with the Mac version of my LiveCode project not exporting data. I can run the program on a Mac just fine, but it won't produce a .txt file with the data. LiveCode also won't store the data internally. I haven't had any issues with the PC version.
The stack script is included below:
on finish
global data,sessionNum,subID,cond,totaltime,testorder
put ((the ticks - totaltime)/60)/60 into totaltime
-- set the decorations of stack "CAM" to default
-- set the backdrop to none
-- show taskbar
put subID & "," & totaltime & "," & the time & "," & the date & return into everything
put data&return after everything
put everything & return after field "savedata" of card "main task materials"
put the ticks into timestamp
put ("Newcombe"&subID&" "×tamp&".txt") into filename
open file filename for write
if the result is empty then
write everything to file filename
close file filename
end if
end finish
on extractdata
put field "savedata" of card "main task materials" into everything
put line 1 of everything into subID
put ("Newcombe extraction for "&subID&".txt") into filename
open file filename for write
if the result is empty then
write everything to file filename
close file filename
end if
end extractdata
on matlists
global matlist,matlist2,data,sessionNum,cond,criterion,relearn,IDU,keepscore,
put empty into data
repeat with x = 1 to 100 -- set up to handle up to 100 items; if more, change this value
put 0 into line x of keepscore
end repeat
put 1 into criterion
put empty into matlist
put card field "items" of card "main task materials" into hold
put card field "IDU" of card "main task materials" into IDU
put the number of lines in hold into numitems
repeat with x = 1 to numitems
put "test," & (line x of hold) & return after matlist
put "study," & (line x of hold) & return after matlist
end repeat
put the number of lines in matlist into numlines
if line numlines of matlist is empty then
delete line numlines of matlist
end if
put empty into matlist2
end matlists
Mac version not exporting data
Moderator: Klaus
Re: Mac version not exporting data
hi,
Welcome to this forum.
I think you have to define a destination folder because on IDE default folder is the path of LiveCode app in Application folder
This works to write to a file of documents folder. Have a look to specialfolderpath, note some folders are protected for write
Best regards
Jean-Marc
Welcome to this forum.
I think you have to define a destination folder because on IDE default folder is the path of LiveCode app in Application folder
This works to write to a file of documents folder. Have a look to specialfolderpath, note some folders are protected for write
Code: Select all
on extractdata
put field "savedata" of card "main task materials" into everything
put line 1 of everything into subID
put specialfolderpath(documents) & "/" & "Newcombe extraction for " & subID & ".txt" into filename
--put everything into url("file:" & filename)-- you may use this line to write in your file instead the five lines below
open file filename for write
if the result is empty then
write everything to file filename
close file filename
end if
end extractdata
Jean-Marc
https://alternatic.ch