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!
on mouseUp
global tSeltxt
-- put the filename of this stack into tFilenm
-- put the number of chars of tFilenm into tNum
-- put tNum-18 into tMin
-- delete char tMin to tNum of tFilenm
put the defaultFolder into tFilenm
put tFilenm &" /thumbnails/" into tStam
lock screen
put selectedtext of fld index into tVar
put tVar into tSeltxt
put lineoffset (tVar,fld index) into tLO
put number of lines of fld index into tLines
put tLO && "of" && tLines into tKeus
set the label of button "linenumber" to tKeus
put fld "titel" of card tVar of stack "recepten" into fld "titel"
put fld "nodig" of card tVar of stack "recepten" into fld "ingr"
put fld "recept" of card tVar of stack "recepten" into fld "recept"
delete last image
-- put tFilenm & "thumbnails/" into tStam
import paint from file tStam& tVar&".jpg" --------------------errormessage, see below
set the rect of last image to the rect of button "pict"
set the lockloc of last image to true
unlock screen
end mouseUp
errormessage: field "index": execution error at line 24 (import: can't open file, mask file or display) near "D:/Livecode /thumbnails/Cassoulet.jpg", char 1
What's wrong ?. When i use the outcommented lines: no problem
Rob
Hi Rob,
Paths are different for each plateform and you have to consider if this is a stack or a standalone.
This function return the path of the folder where the stack is (no tested for Linux)
function getPathFolder
put the filename of this stack into P
set the itemdel to "/"
if the environment = "development" then
delete item-1 of P
else -- It's in a StandAlone mode.
if the platform = "MacOS" then
delete item -4 to -1 of P
else
delete item-1 of P
end if
end if
set the itemdel to ","
return p
end getPathFolder
Best regards
Jean-Marc
Last edited by jmburnod on Tue Aug 05, 2014 8:55 am, edited 1 time in total.
In cases like this, a little:
...
put tStam & tVar & ".jpg" into tFile
answer (there is a file tFile)
## FALSE should give you a hint that the pathname is not correct.
...
may also help!