Code: (Select All)
Screen _NewImage(800, 600, 32)
Open "MyFile.txt" For Output As #1
Print #1, "Test:" + Date$ + " " + Time$
Close
Print "File created called MyFile.txt"
Recycle "MyFile.txt"
Print "MyFile.txt should now be recycled and in the Recycle Bin, instead of just erased permanently."
Print "Check your recycle bin to see if it exists there and contains a simple message of 'Test'."
End
Sub Recycle (file$)
If _FileExists(file$) Then
$If WIN Then
ps$ = "powershell -NoLogo -NoProfile -Command "
ps$ = ps$ + Chr$(34) + "Add-Type -AssemblyName Microsoft.VisualBasic; "
ps$ = ps$ + "[Microsoft.VisualBasic.FileIO.FileSystem]:eleteFile('"
ps$ = ps$ + file$
ps$ = ps$ + "','OnlyErrorDialogs','SendToRecycleBin')" + Chr$(34)
Shell _Hide ps$
$ElseIf MAC Then
' Build an osascript command that tells Finder to delete the POSIX file (move to Trash)
' Use single quotes around the whole -e argument in the shell, and escape inner double quotes for AppleScript.
cmd$ = "osascript -e " + Chr$(34) + _
"tell application " + Chr$(34) + "Finder" + Chr$(34) + _
" to delete POSIX file " + Chr$(34) + file$ + Chr$(34) + Chr$(34)
Shell cmd$
$Else
'Assume Linux-like environment with gio available
Shell _Hide "gio trash " + Chr$(34) + file$ + Chr$(34)
$End If
End If
End Sub
One last test. This is after pestering AI to sort out the formatting issue. It claims this will work. LOL
Tony suggests changing that delete to move and giving it a test if this doesn't work. @NakedApe mind giving both variations a try and see what we break?

