Re: I must be Daft! (creating a new text file)
Re: I must be Daft! (creating a new text file)
- Subject: Re: I must be Daft! (creating a new text file)
- From: david <email@hidden>
- Date: Sat, 5 Apr 2003 23:28:23 -0500
On Saturday, April 5, 2003, at 09:27 PM, Jay wrote:
Hi David,
Would something like this be what you're looking for? It saves a text
file (with text entered by user in a dialog) in a folder called
'iPhotoFolder' that resides on the Desktop. This works for me in OS
10.2.4, AS 1.9.1. Hope it helps.
-----------------------------------------------
set FileTxt to (display dialog "Please Insert Information:" default
answer "" buttons "OK" default button 1 with icon 1)'s text returned
set FileLoc to ((path to desktop as string) & "iPhotoFolder:title")
try
set newFile to (open for access file FileLoc with write permission)
write FileTxt to newFile
close access newFile
on error err
close access newFile
display dialog "There was an error!" & return & err
end try
-----------------------------------------------
Jay
On Saturday, April 5, 2003, at 07:18 PM, David G. Simmons wrote:
I am either stupid, or just missing something REALLY basic, but I
cannot for the LIFE of me manage to create a simple text file, in a
folder of my choosing.
I create the Folder (actually, iPhoto creates it for me) then I prompt
the user for some text, and try to create a new file with that
information.
I have to say that I am failing miserably. All I want to do is prompt
for a simple text string, then save that text string into a file
called
"title" in a directory which already exists on the users Desktop.
So far everything fails. I realize that this is a pretty basic thing,
and have read the language guide, the Finder dictionary, etc. and am
still failing. Please, someone guide me!
David,
FYI
there is a script that came with Mac OS X located:
Macintosh HD:Library:Scripts:Info Scripts:PathOfSelectionToClipBoard
select the file you want to write to, then pull down the applescript
menu, selecting 'Info Scripts' PathOfSelectionToClipBoard
when dialog 'my pathname is: click 'Put on Clipboard'
paste the path into your script
ie: if you have a file on your desktop called "title", its path would
be:
"Macintosh HD:Users:UserName:Desktop:title"
ie: if you have a file on your desktop called title.rtf, tucked away in
a folder, its path would be:
"Macintosh HD:Users:UserName:Desktop:iPhotoFolder:title"
note:
UserName = name of Your UserName
revising Jay's script only if you would like to keep existing text and
add new strings to the eof on a new line
set FileTxt to (display dialog "Please Insert Information:" default
answer "" buttons "OK" default button 1 with icon 1)'s text returned
set FileLoc to ((path to desktop as string) & "iPhotoFolder:title")
try
set newFile to (open for access file FileLoc with write permission)
set eof_text to get eof of newFile
write FileTxt & return to newFile starting at (eof_text + 1)
;; write FileTxt to newFile
close access newFile
on error err
close access newFile
display dialog "There was an error!" & return & err
end try
-----------------------------------------------
david in maine
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.