I'm trying to save data on mobile (android) but not having any success - it works on Windows though.
The code is here:
Code: Select all
global gAllLines,gMyCategories,gMySelection,gMySelectedLineNrs,gCurrentView,gSFPath
on preopenStack
local tIndex = 1, tTemp
set the itemDel to tab -- or default comma
if the owner of this stack = empty then --mainstack
if the environment is "mobile" then set the fullscreenmode of me to "exactFit"
switch platform() --the platform
case "mobile"
## Android
put specialFolderPath("documents") into gSFPath
break
case "Win32"
## Everything >= Win2000
if the systemversion contains "NT" then put specialFolderPath(26) into gSFPath
break
case "MacOS"
## MacOS X
put specialFolderPath("preferences") into gSFPath
break
end switch
put gSFPath &"/MQdata" into gSFPath
if there is not a folder gSFPath then new folder gSFPath --new folder
if result() <> empty then answer "Sorry, but there was a problem writing to a .ini file." with "OK"
put empty into gAllLines
put fld "Data" into gAllLines
if there is no file (gSFPath &"/Selection.ini") then
put empty into gMySelection
repeat for each line i in gAllLines
put item 1 of i & tab & item 2 of i & return after gMySelection
add 1 to tIndex
end repeat
delete char -1 of gMySelection--***return char too
put gMySelection into URL ("file:" & gSFPath &"/Selection.ini")
else
put URL ("file:" & gSFPath &"/Selection.ini") into gMySelection
## refresh gAllLines:
put empty into gMySelectedLineNrs
repeat for each line i in gMySelection
if item 2 of i is "true" then
put item 1 of i & tab after gMySelectedLineNrs
end if
end repeat
delete char -1 of gMySelectedLineNrs --tab
repeat for each line i in gAllLines
if item 1 of i is among the items of gMySelectedLineNrs then
put "true" into item 2 of i
end if
put i & cr after tTemp
end repeat
delete char -1 of tTemp --cr
put tTemp into gAllLines
end if
if there is no file (gSFPath &"/AppsData.ini") then
put empty into gMyCategories
set the hilite of btn "s" to true
set the hilite of btn "m" to true
set the hilite of btn "l" to true
put "s" & tab after gMyCategories
put "m" & tab after gMyCategories
put "l" & tab after gMyCategories
put gMyCategories into URL ("file:" & gSFPath &"/AppsData.ini")
else
put empty into gMyCategories
put URL ("file:" & gSFPath &"/AppsData.ini") into gMyCategories
set the hilite of btn "s" to ("s" is among the items of gMyCategories)
set the hilite of btn "m" to ("m" is among the items of gMyCategories)
set the hilite of btn "l" to ("l" is among the items of gMyCategories)
end if
end if
send mouseUp to btn "All Lines"
pass preopenStack
end preopenStack
Thanks.
keram