Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Create a new blank file of any kind with Quicksilver' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Create a new blank file of any kind with Quicksilver
Authored by: StrawHousePig on Mar 30, '07 11:30:12PM
I just the other day cooked up something in AppleScript to do this very job.

set doc_list to {"Add new..."}
tell application "Finder"
  if not (exists folder "NewHere" of folder (path to application support from user domain)) then
    display dialog "This is the first time you've run NewHere." & return & return & "Files added to the list are located at" & return & "~/Library/Application Support/NewHere" & return & "Removing a file from this folder removes it from the list."
    make new folder at folder (path to application support from user domain) with properties {name:"NewHere"}
  else
    try
      set doc_list to doc_list & name of every file of folder "NewHere" of folder (path to application support from user domain) as list
    end try
  end if
  set my_file to choose from list doc_list with prompt "Choose a document to place here"
  if result is not false then
    set my_file to item 1 of my_file as string
    if my_file is "Add new..." then
      set new_file to choose file
      duplicate file new_file to folder "NewHere" of folder (path to application support from user domain) with replacing
      set my_name to text returned of (display dialog "Enter a name for the new file." default answer (name of new_file as text))
      my do_it((name of new_file as text), my_name)
    else
      set my_name to text returned of (display dialog "Enter a name for the new file." default answer my_file)
      my do_it(my_file, my_name)
    end if
  end if
end tell

on do_it(my_file, my_name)
  tell application "Finder" to set my_dest to (folder of the front window) as text
  set my_dest to my_dest & my_name as text
  set my_origin to (path to application support from user domain) & "NewHere:" & my_file as text
  do shell script "cp " & quoted form of (POSIX path of my_origin) & " " & quoted form of (POSIX path of my_dest)
  tell application "Finder" to open my_dest as alias
end do_it

Save as an app (which I named NewHere) and drop it in the Finder's toolbar. It has a couple of idiosyncrasies (chiefly replacing without prompting) and could stand some tightening, but it's easy enough to work with and will let you rename the file being duped to the Finder's frontmost window.

[ Reply to This | # ]
Create a new blank file of any kind with Quicksilver
Authored by: StrawHousePig on Mar 30, '07 11:33:41PM

Oh crap... Apologies for stretching the window. :(



[ Reply to This | # ]
no worries
Authored by: robg on Mar 31, '07 05:31:37AM

Fixed :)

-rob.



[ Reply to This | # ]