Saving Images
Posted: Tue Jan 17, 2017 2:30 pm
I am trying to save images so I don't overwrite the previous save.I am saving an image count and adding the variable nPic.
The example shown will save the image OK. You can see the line that doesn't work but the file name works correctly.
on mouseUp
---image count
set the defaultFolder to specialFolderPath("desktop")
put URL ("file:Image_Count.txt")into field "Image Count"
put the text of field "Image Count" into nPic
add 1 to nPic
wait 4 ticks
put nPic into field "Image Count"
put field "Image Count" into URL ("file:Image_Count.txt")
-- the next line saves image OK
put specialfolderpath ("desktop") & "/Image.png" into tFile
-- the next line saves the file name correctly but saves the file with o bytes /no image###
###put specialfolderpath ("desktop") & "/Image.png" && nPic into tFile
## This is only necessary, if you are on a Mac!
set the filetype to ""
---set the selected of image "Display" to true----not sure if I need this line??
--- export image to file: either line works
export img "Display" to file tFile as png
--export snapshot from img "Display" to file tFile as png
end mouseUp
This is all that is preventing me from complete my app.
Any suggestions greatly appreciated
The example shown will save the image OK. You can see the line that doesn't work but the file name works correctly.
on mouseUp
---image count
set the defaultFolder to specialFolderPath("desktop")
put URL ("file:Image_Count.txt")into field "Image Count"
put the text of field "Image Count" into nPic
add 1 to nPic
wait 4 ticks
put nPic into field "Image Count"
put field "Image Count" into URL ("file:Image_Count.txt")
-- the next line saves image OK
put specialfolderpath ("desktop") & "/Image.png" into tFile
-- the next line saves the file name correctly but saves the file with o bytes /no image###
###put specialfolderpath ("desktop") & "/Image.png" && nPic into tFile
## This is only necessary, if you are on a Mac!
set the filetype to ""
---set the selected of image "Display" to true----not sure if I need this line??
--- export image to file: either line works
export img "Display" to file tFile as png
--export snapshot from img "Display" to file tFile as png
end mouseUp
This is all that is preventing me from complete my app.
Any suggestions greatly appreciated