How to put an image into the system-wastebox of macOS or winXP

Reinhold Venzl-Schubert r.venzl-schubert at macbay.de
Wed Oct 29 05:57:20 EDT 2008


Hi Ken,

thanks for your answer. It also showed me where to look in the  
userguide.

Reinhold


Am 21.10.2008 um 19:00 schrieb use-revolution-request at lists.runrev.com:

> Message: 2
> Date: Mon, 20 Oct 2008 12:41:13 -0500
> From: Ken Ray <kray at sonsothunder.com>
> Subject: Re: How to put an image into the system-wastebox of macOS or
> 	winXP
> To: Use Revolution List <use-revolution at lists.runrev.com>
> Message-ID: <C5222CE9.16580%kray at sonsothunder.com>
> Content-Type: text/plain;	charset="US-ASCII"
>
>
>> I want to put an image out of a folder into the wastebasket of macOS
>> or win.
>> How can I do it?
>
> Here you go (this assumes Rev 2.9+). Note that oddly enough,  
> Windows doesn't
> return an error message if it can't execute the VBScript code  
> properly, so
> you'll have to check for the file's existence after you execute the  
> code to
> confirm it really is gone. Watch for line wraps:
>
> on MoveToTrash pFile
>     -- Assumes pFile is full file path
>     if there is not a file pFile then
>        return "Error: File '" & pFile & "' does not exist."
>     end if
>     switch (the platform)
>        case "MacOS"
>           put "tell app `Finder`" & cr & \
>           "move POSIX file `" & pFile & "` to trash" & cr & \
>           "end tell" into tScript
>           replace "`" with quote in tScript
>           do tScript as "AppleScript"
>           if the result is "execution error" then return "Error:  
> Could not
> move file '" & pFile & "' to the Trash."
>        break
>        case "Win32"
>           replace "/" with "\" in pFile
>           put "Const RECYCLE_BIN = &Ha&" & cr & \
>           "Set objShell = CreateObject(`Shell.Application`)" & cr & \
>           "Set recycleFolder = objShell.NameSpace(RECYCLE_BIN)" &  
> cr & \
>           "recycleFolder.MoveHere `" & pFile & "`" into tScript
>           replace "`" with quote in tScript
>           do tScript as "VBScript"
>           -- VBS doesn't return any error codes for this action, so  
> need to
>           -- check file existence and return an error if necessary
>           if there is a file pFile then
>              return "Error: Could not move file '" & pFile & "' to the
> Recycle Bin."
>           end if
>        break
>     end switch
> end MoveToTrash
>
>
>
> Ken Ray
> Sons of Thunder Software, Inc.
> Email: kray at sonsothunder.com
> Web Site: http://www.sonsothunder.com/




More information about the use-livecode mailing list