Page 1 of 1

Display 'Import Snapshot' (SOLVED)

Posted: Tue Oct 07, 2014 11:19 am
by Traxgeek
Hi,
I'm sure I've read something 'special' about this in a thread somewhere but... I can't find it now... :oops:

I have a script that takes a snapshot of a card and displays it on another card.
Simple enough and... the script works perfectly on my Mac / PC :

Code: Select all

      set the visible of the templateImage to false
      put the rect of card "crdSource" into sRect
      import snapshot from rect sRect of card "crdSource"
      put the long id of the last image into sImgID

      #set the text of image "imgBackground" of card "crdDestination" of stack "stkSubStack" to the text of sID --This one ?
      put the last image into image "imgBackground" of card "crdDestination" of stack "stkSubStack" --or this one ? (Both pass LC testing but neither display the image on Android)

      if sID begins with "Image id" then
         delete sID --Delete my temp image
      end if
The same code doesn't work for me on Android !!

I THINK I read that one may need to set the specialfolderpath or somesuch to get this to function with mobile but... like I say... I can't find the thread anymore and although I've tried various things ('specialfolderpath' and 'wait with messages' between grabbing and displaying the image) I still come up with nothing.

Anyone able to put me out of my misery please ?

Thanks a million.

Re: Display 'Import Snapshot' (Android)

Posted: Tue Oct 07, 2014 11:56 am
by Klaus
Hi Traxgeek,

not sure what is going wrong, but two hints:
1. you can export a screenshot directly into another image, no need for temporary image objects.
Try this:
...
EXPORT snapshot from rect sRect of card "crdSource" to image "imgBackground" of card "crdDestination" of stack "stkSubStack"
...

2. There is no need to mess with any specialfolderpath here, we stay "inhouse" :D


Best

Klaus

Re: Display 'Import Snapshot' (Android)

Posted: Tue Oct 07, 2014 11:57 am
by Traxgeek
As ever - Thanks Klaus !

I'll go try it now and get back to you.

Re: Display 'Import Snapshot' (Android) (SOLVED)

Posted: Tue Oct 07, 2014 12:10 pm
by Traxgeek
Hmmmm....

I think a restriction of this code line ...

Code: Select all

EXPORT snapshot from rect sRect of card "crdSource" to image "imgBackground" of card "crdDestination" of stack "stkSubStack"
... is that the card in the Sub-Stack has to be open - because I get the following error when I try it :

export: no image selected, or image not open

I'm guessing the image is self-selected (provided 'crdSource' exists - which it does) therefore, my assumption is that, because my sub-Stack card is not yet open, I receive the 'image not open' error...

So, what I'm trying is to put the code line you gave into the card pre-open script... just need to code the card that the new card is to export its snapshot from... simple enough...

Thanks a million Klaus.