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 [EMAIL PROTECTED]:
Message: 2
Date: Mon, 20 Oct 2008 12:41:13 -0500
From: Ken Ray <[EMAIL PROTECTED]>
Subject: Re: How to put an image into the system-wastebox of macOS or
winXP
To: Use Revolution List <[email protected]>
Message-ID: <[EMAIL PROTECTED]>
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: [EMAIL PROTECTED]
Web Site: http://www.sonsothunder.com/
_______________________________________________
use-revolution mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution