Snapshot image saving as a date-time file for iPad

Getting into LiveCode for iOS? Ask your questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
sarahgall
Posts: 1
Joined: Sun Jun 05, 2016 12:53 pm

Snapshot image saving as a date-time file for iPad

Post by sarahgall » Sun Jun 05, 2016 1:43 pm

Hello all,

Im currently trying to create an app for an art exhibition, it is a user interactive form using a stylus on iPad. Very simple but I just cant figure out how to have the screenshot of the user form with effects be saved as different file names. Current code I'm using only allows the one file to save due to a specified name and won't save a new image, but if someone can help add in a date and time variable to the snapshot I should be able to save all without overlap. And not sure if special folder path can link direct to iPad camera roll or how I would do that.

Also have been trying to have these images exported via email attachment but (no handler) error keeps popping up, so i've given up on that not unless someone knows why its not working.

Code: Select all

on MouseUp
   

--save contents of form to Documents folder
set the defaultFolder to specialFolderPath("Documents")
export snapshot from this cd to file "File1.jpg" as JPEG
export snapshot to pictVariable as JPEG

--clear form for next user
set the points of grc "draw" to empty

--to last stack
   go to stack "thankyou"
   
end MouseUp
If anyone has any ideas or links It would be very much appreciated.

Best,
Sarah

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

Re: Snapshot image saving as a date-time file for iPad

Post by Klaus » Wed Jun 08, 2016 4:32 pm

Hi Sarah,

so sorry, almost overlooked this thread!

1. Welcome to the forum! :D

2. To create file name with date and time,do something like this:

Code: Select all

...
put the date into tDate

## The date will contain SLASHES -> 6/8/16, but since this is also the PATH deliniter in Livecode, 
## it is not recommended to use in a filename, so we replace it with "-" or "_" or whatever fits your needs
replace "/" with "-" in tDate

## Now add a SPACE and the time to the variable:
put " " & the time after tDate

## Now construct the correct filename:
put specialFolderPath("documents") & "/Image_" & tDate into tFilename

## Now finally export image:
export snapshot from this cd to file tFilename
...
3. And yes, there is a command to export a snapshot directly to the mobile photoalbum,
check this in the dictionary: mobileExportImageToAlbum...


Best

Klaus

Post Reply