Hi I’ve been trying to get this script working forever yet I can’t seem to get the error “Finder can’t make into that type of data” error and even if I fix that I get others. Please Help!
set theAsk to display dialog “What would you like to name this backup?” default answer “” buttons {“Next”} default button 1
set theGo to text returned of theAsk
display dialog “Do you want to back up a file or folder?” buttons {“File”, “Folder”, “Cancel”} default button “File”
if button returned of result = “File” then
set theStart to (choose file with prompt “Select a file:”) as string
else if button returned of result = “Folder” then
set theStart to (choose folder with prompt “Select a folder:”) as string
else
quit
end if
set instantFolder to (theGo & " Backup: " & (current date))
set theTarget to do shell script “file2=cat ~/Library/Auto-BackupDataHD/deepfile2
echo $file2”
set whereToStore to instantFolder
tell application “Finder” to make folder whereToStore --added
– removed: do shell script “mkdir "/Volumes/” & theTarget & “/” & instantFolder & “"”
display dialog theStart & " to " & theTarget & “/” & instantFolder & “/”
duplicate theStart to theTarget & “/” & instantFolder & “/”
Browser: Safari 125.9
Operating System: Mac OS X (10.4)
let’s have a look at the event log…
tell current application
display dialog "What would you like to name this backup?" default answer "" buttons {"Next"} default button 1
{text returned:"junk", button returned:"Next"}
display dialog "Do you want to back up a file or folder?" buttons {"File", "Folder", "Cancel"} default button "File"
{button returned:"File"}
choose file with prompt "Select a file:"
alias "Macintosh HD:Users:me:Desktop:text.txt"
current date
date "Monday, May 9, 2005 8:51:13 PM"
do shell script "file2=`cat ~/Library/Auto-BackupDataHD/deepfile2`
echo $file2"
""
end tell
tell application "Finder"
make new folder "junk Backup: Monday, May 9, 2005 8:51:13 PM"
"Finder got an error: Can't make some data into the expected type."
What are you trying to do in the do shell script. Just make the folder? Are you missing a pipe or ; or something? If that’s cool the way it is, the bigger problem is that when you include a date in a path, you get a bunch of :'s in the file name which will look like directories to the finder.
It wasn’t completely clear to me what you were doing in some places, but hopefully this will be helpful:
set theAsk to display dialog "What would you like to name this backup?" default answer "" buttons {"Next"} default button 1
set theGo to text returned of theAsk
display dialog "Do you want to back up a file or folder?" buttons {"File", "Folder", "Cancel"} default button "File"
if button returned of result = "File" then
set theStart to (choose file with prompt "Select a file:") as string
else if button returned of result = "Folder" then
set theStart to (choose folder with prompt "Select a folder:") as string
end if
--eliminate ":" from folder name
set theDate to (current date)
set theTime to time string of theDate
set AppleScript's text item delimiters to ":"
set theParts to text items of theTime
set AppleScript's text item delimiters to "."
set theWhole to theParts as string
set timeStamp to (weekday of theDate as string) & ", " & month of theDate & " " & day of theDate & ", " & year of theDate & " " & theWhole
set instantFolder to (theGo & " Backup--" & timeStamp)
--get path of location for new folder
set theTarget to ((path to library folder from user domain as text) & "Auto-BackupDataHD:")
--create new folder and copy selected file or folder to it
tell application "Finder"
set theFinish to (make new folder at folder theTarget with properties {name:instantFolder})
duplicate alias theStart to theFinish
end tell
Browser: Safari 125.12
Operating System: Mac OS X (10.3.8)
wow you guys are great…thanks a ton for your help, script went of without a hitch. But one last question. I’m trying to make this a droplet also so I added this script I whipped up…and get the error the variable theFile isn’t defined.
on open of finderObjects
repeat with k in (finderObjects)
theFile(k)
if folder of (info for k) then
tell application “Finder” to set variable to (entire contents of k)
end if
end repeat
end open
on theFile(k) – an example of doing something with each item
tell application “Finder”
set theFinish to (make new folder at folder theTarget with properties {name:instantFolder})
duplicate alias theFile to theFinish
end tell
end theFile
Browser: Safari 125.9
Operating System: Mac OS X (10.4)