Using export snapshot with a file dialogue box

Steve King st.king42 at
Sat Jul 3 12:19:34 EDT 2010


I am exporting a screen image of a card to file. 

I allow the user to select a filename then save the image using the script
below. I have had to add a 400mS wait in for the save dialogue to vanish
before the snapshot is taken. This works OK, but is there a better way to do
it that guarantees that the save dialogue will be gone first? At the moment
I know 100mS is plenty on my system so I have selected 400mS as margin

   ask file  "Save Dive/Air Plan image as:" with the DefaultFolder with
filter "JPG File, *.JPG" 
   put it into UserFileName
   if it is not empty then       
      set the itemdelimiter to "."
      if item 2 of UserFileName is empty then
         put UserFileName & ".jpg" into UserFileName
      end if
      wait 400 milliseconds
      Put the rect of this stack into MyScreen
      export snapshot from rect MyScreen to file UserFileName as JPEG
      Answer "Screen saved as" & UserFileName with "OK"
   end if


More information about the Use-livecode mailing list