Launching Preview

Scott Rossi scott at tactilemedia.com
Thu Nov 21 16:27:00 EST 2013


Hi Jim:

I'm not sure how you expect Preview to display something it can't normally
access through it's File menu, but try this and see if it works for you.

on mouseUp
   set itemDel to "/"
   put item 1 to -2 of the tempName into theFolder
   put "tempexport.png" into theFile
   put (theFolder & "/" & theFile) into theFilePath
   export snapshot from grc "oval" to file theFilePath as PNG
   launch theFilePath with "Preview.app"
end mouseUp


I'm not positive but I believe the temp folder should always be available
to write to unless the host machine is severely locked down.

Regards,

Scott Rossi
Creative Director
Tactile Media, UX/UI Design




On 11/21/13 6:47 AM, "Jim Hurley" <jhurley0305 at sbcglobal.net> wrote:

>Hi Roger,
>
>Thanks. This level of Apple Script is over my head, I'm afraid.
>
>I tried it, but "theGroup" didn't show up in Preview.
>
>I'm surprised that LC doesn't have a more direct way of getting a
>snapshot into Preview than first creating a file to disk, i.e.
>
>      export snapshot from rect (rect of  graphic "oval") of this card
>to file tPathAndName as PNG
>      launch document tPathANDNAME
>
>Might there be a way to launch Preview and then "activate" the "New from
>clipboard" within Preview? Not sure what I mean by "activate."
>
>Jim Hurley
>
>> 
>> Message: 6
>> Date: Wed, 20 Nov 2013 13:13:29 -0500
>> From: Roger Eller <roger.e.eller at sealedair.com>
>> To: How to use LiveCode <use-livecode at lists.runrev.com>
>> Subject: Re: Launching Preview
>> Message-ID:
>> 	<CAAT6EXOD5n-XTppehu0eGYXBJBygGHT=XwFfDAQq6LiYoUDQQQ at mail.gmail.com>
>> Content-Type: text/plain; charset=ISO-8859-1
>> 
>> Ok, this one works, and it doesn't matter if Preview is already open.
>> 
>> on mouseUp
>>   put "tell application" && quote & "System Events" & quote && "to
>> keystroke" && quote & "n" & quote && "using {command down}" into
>> tAppleScript
>>   export snapshot from grp "theGroup" to tempVariable as PNG
>>   set the clipboardData["image"] to tempVariable
>>   launch "Preview.app"
>>   do "tell Preview" & cr & "end tell" as AppleScrpt -- focus on Preview
>>   do tAppleScript as AppleScript -- Apple-N (New from Clipboard)
>> end mouseUp
>> 
>> ~Roger
>> 
>
>
>_______________________________________________
>use-livecode mailing list
>use-livecode at lists.runrev.com
>Please visit this url to subscribe, unsubscribe and manage your
>subscription preferences:
>http://lists.runrev.com/mailman/listinfo/use-livecode
>






More information about the use-livecode mailing list