Hi @ all,
I’m just working on a script that creates a simple GUI for a terminal based application.
In order to make it run smoothly I would like the user to enter her or his username.
The input should then influence the path: “/Users/<input_by_user>/Desktop/test.txt”
Does anyone of you has an idea how to manage that?
Thanks in advance
joh
Model: MacBook, 2GHz, 4GB RAM, 320GB
AppleScript: newest
Browser: Firefox 3.0
Operating System: Mac OS X (10.5)
Hi,
it’s probably not necessary to enter the user name
POSIX path of (path to desktop) & "test.txt"
points to the file “test.txt” on desktop of the current user
Hi Stefan,
again: Thanks for the quick reply.
Unfortunately I need a bit more: I need the link to the home-directory.
I tried simply home, but AS considers it as a variable. I dnt really understand why, since in other scripts i just viewed, the home-attribut works as it should.
Do you have any clou, how to define the home-directory?
Thanks again viele Grüße nach nebenan…
joh
POSIX path of (path to home folder)
is the same like
~
in the terminal
That’s it!!!
Thanks a lot. An afternoon’s work is over!!!
All the best
joh
If you want them to choose a file, you could do something like this:
set x to choose file
set y to POSIX path of x
That will give you the entire path of the chosen file as text.
Hi cwt,
thanks for this hint. Probably I wont need it for this script, but I’ve just started with this whole thingy, so rather sooner than later I will need that tip.
Thanks a lot.
All the best
joh
Actually, you’ve probably already got it in your script. If you’re having the user choose ( x ) the file, then you’ve got an alias of the file. If you need the posix ( y ) path, you just need to set it. By the way, I should have used “the quoted form of” in my example:
set y to the quoted form of POSIX path of x