On 8/31/2014, 9:10 AM, Eric Sciolli wrote:
Hello again
in first mail I wasn't enough clear: I have some images in a card of a
stack which I want to export and save on the hardisk of the user. For this
I used binFile this way:
ask file "Save image as:"
put it into lFolderPath
create folder lFolderPath & "/img"
put "binFile:/" & lFolderPath & "/img/gruppo.png" into lImage
put img "gruppo" of cd "stampa" of stack "stampaObiettivi" into URL lImage
put "binFile:/" & lFolderPath & "/img/utente.png" into lImage
put img "utente" of cd "stampa" of stack "stampaObiettivi" into URL lImage
The script works for macosx: it creates a folder img and export the 2
images in that folder; on windows it creates the folder but it's empty. Is
there a problem of compatibility with windows?
The "ask file" command will not allow the user to choose a location that
does not already exist, so you shouldn't be creating folders. The string
returned by "ask file" is the actual path that your handler should use
without any changes:
ask file "Save image as:"
if it is empty then exit to top -- or "exit handlerName"; user cancelled
put it into tPath
put img "gruppo" of cd "stampa" of stack "stampaObiettivi" into URL
("binfile:" & tPath)
That's all you need. It works identically on both Mac and Windows. If
you really do want the user to indicate a folder instead of a file path
(so that you can name the image file yourself) then:
ask folder "Choose a folder:"
if it is empty then exit to top -- user cancelled
put it & "/gruppo.png" into tPath
put img "gruppo" of cd "stampa" of stack "stampaObiettivi" into URL
("binfile:" & tPath)
Like "ask file", the "ask folder" command will not allow the user to
choose a folder that does not already exist.
If you really do want to create a subfolder inside the user's chosen
folder, you must specifically create it:
ask folder "Choose a folder:"
if it is empty then exit to top -- user cancelled
put it into tPath
if there is no folder (tPath & "/img" then create folder (tPath & "/img")
put tPath & "/img/gruppo.png" into tPath
put img "gruppo" of cd "stampa" of stack "stampaObiettivi" into URL
("binfile:" & tPath)
--
Jacqueline Landman Gay | [email protected]
HyperActive Software | http://www.hyperactivesw.com
_______________________________________________
use-livecode mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode