image
image

Go Back   macosx.com > Mac Help Forums > HOWTO & FAQs

Reply
 
Thread Tools
  #9  
Old November 16th, 2001, 01:49 PM
Registered User
 
Join Date: Jul 2001
Location: Copenhagen, Denmark
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
dkearford is on a distinguished road
applescript droplet

I made this applescript droplet earlier today to do something similar - its abit sloppy and comes with no guarantees, but it should work.

on open (daFile)

-- define variables
set daFile to daFile as string
set daPath to "" as string
set badChar to {space, "'", "\"", "*", "?", "[",} -- etc
set i to 1

-- check each char of daFile
repeat while i <= (the length of daFile)
set j to 1
set daChar to character i of daFile

-- file or directory?
if daChar is ":" then
set daChar to "/" -- directory
else if daChar is "/" then -- file
set daChar to ":"
end if

-- test against list of bad chars
repeat while j <= the number of items in badChar
if daChar is (item j of badChar) then
set daChar to "\\" & (item j of badChar)
end if
set j to j + 1
end repeat

-- update daPath
set daPath to daPath & daChar

-- loop
set i to i + 1
end repeat

-- name of startup vol
tell application "Finder"
set startupvol to the startup disk as string
end tell

-- name of disk of daFile
set thisDisk to the first word of daFile & ":"

-- reconstruct daPath
if thisDisk is startupvol then
set i to 1
repeat while character i of daPath is not "/"
set i to i + 1
end repeat

set daPath to (characters (i) thru (the length of daPath) of daPath) as text
else
set daPath to "/volumes/" & daPath
end if

-- put daPath on clipboard
set the clipboard to daPath
end open

hope this is of some use
Reply With Quote
  #10  
Old November 16th, 2001, 02:56 PM
Registered User
 
Join Date: Jul 2001
Location: Copenhagen, Denmark
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
dkearford is on a distinguished road
how did you find that out? it would have saved me writing the droplet in my lunch break...
Reply With Quote
  #11  
Old January 29th, 2003, 08:00 AM
Registered User
 
Join Date: May 2002
Posts: 51
Thanks: 0
Thanked 0 Times in 0 Posts
PowerPC is on a distinguished road
where ?...

Scruffy, but where do your put the script so that you don't have to type "set prompt =" every time you start a terminal session ?

I also couldn't find any "bash_local" file to edit

Thanks.
Reply With Quote
  #12  
Old February 20th, 2003, 08:58 PM
michaelsanford's Avatar
Psycholinguist
 
Join Date: Oct 2002
Location: Ottawa/Montrιal
Posts: 2,172
Thanks: 0
Thanked 0 Times in 0 Posts
michaelsanford is on a distinguished road
PowerPC, you put the set prompt = "" command into your ~/.login file, which is read every time you start a shell.
As with most things unix, if you don't have that file, just make one

This is what my (~/.login) looks like:
Code:
set prompt = "[helios:%~]%# "
date;uptime;ifconfig ppp0 | grep inet | awk '{print $2}';mysqladmin ping;
Which gives me a nice printout like this
Code:
      Welcome to Helios
// AUTHORIZED PERSONNEL ONLY //

Thu Feb 20 21:54:33 EST 2003
 9:54PM  up 7 days,  8:54, 3 users, load averages: 0.37, 0.07, 0.03
64.230.12.222
mysqld is alive
[helios:~]%
Incidentally the bit above the date about authorized people only is contained in /etc/motd (Message Of The Day) and is a non-executable text that's displayed to all users who start a shell.
__________________
michaelsanford.com • Blog • Twitter • Tumblr • LinkedIn
• iMac Aluminum 24" |
MacOS X 10.5-current | 3.06 GHz Intel Core Duo | 4 GB RAM | 1 TB HDD
• iBook G4 1.42 GHz | MacOS X 10.5-current | 1 GB RAM, 100 GB HDD
• AMD Athlon64 3500+ | Slackware 12 (2.6.21.5-smp) | 2 GB RAM, 2•120 GB RAID 1, 2•500 GB RAID 0
Reply With Quote
  #13  
Old February 21st, 2003, 12:59 AM
symphonix's Avatar
Scratch &amp; Sniff Committee
 
Join Date: Jul 2001
Location: The Australian Jungles
Posts: 4,022
Thanks: 2
Thanked 2 Times in 2 Posts
symphonix is on a distinguished road
And here's a tip that many would find painfully obvious, but it is useful nonetheless.

If you drag a file from the finder onto an open terminal window, it enters the file's full path at the prompt.

So, you could type P-I-C-O-Space and drag a config file onto the window, and the command line would read:

pico /path/to/configfile
__________________
- iMac G5 1.8GHZ 17" | SuperDrive | 160GB | 512MB | Airport Extreme | Bluetooth Keyboard & Mouse | Wacom Intuos II
- Pentax *ist DL - JVC MiniDV Camcorder - Airport Express - iPod Nano 1gb white
Reply With Quote
  #14  
Old February 21st, 2003, 02:33 AM
Registered User
 
Join Date: May 2002
Posts: 51
Thanks: 0
Thanked 0 Times in 0 Posts
PowerPC is on a distinguished road
Thanks, Michael!

Actually I put it into /etc/csh.cshrc and it works! But I forget to mention it on macosx.com. Hope it's not too late ) Thanks, again
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[HOWTO] - Clone a finder window. MacLuv HOWTO & FAQs 2 May 21st, 2004 10:12 PM
[HOWTO] - Cool Keyboard/Mouse Combos zootbobbalu HOWTO & FAQs 45 October 8th, 2003 06:36 AM
Starting finder window from Terminal Ripcord Mac OS X System & Mac Software 2 June 22nd, 2003 06:57 PM
Path Finder (ex-SNAX) - great Finder replacement celeborn Mac OS X System & Mac Software 2 January 18th, 2003 10:48 PM


All times are GMT -5. The time now is 05:50 AM.


Mac Support® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0
Copyright 2000-2008 DigitalCrowd, Inc.