• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Creating new file etc
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Creating new file etc


  • Subject: Creating new file etc
  • From: Gregory White <email@hidden>
  • Date: Fri, 13 Apr 2007 13:15:46 +1000

Dear List, I would be very grateful for any help you could give me as I've been struggling with it for a few days.

I'm trying to create a new file in the given directory and then replace old data with new data should that be required.
I will get that data from the clipboard as it originates in another app.  The data will be text.

Kind regards,
Greg.

Here is the script which does not work.

tell application "Finder"
copy (the clipboard) to Clip_Board
end tell

set Bookmaker_Folder to "home:Documents:ReferenceWorks Bookmaker:"
--in the finished script I would set  this_book to Clip_Board


set this_Book to "Once upon a time in Silicon Valley... Hello"
set this_file to (((Bookmaker_Folder) as text) & "New Book")
my write_to_file(this_Book, this_file, false)
on write_to_file(this_data, target_file, append_data)
try
set the target_file to the this_file as text
set the open_target_file to ¬
open for access file target_file with write permission
if append_data is false then ¬
set eof of the open_target_file to 0
write this_data to the open_target_file starting at eof
close access the open_target_file
return true
on error
try
close access file target_file
end try
return false
end try
end write_to_file


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: Creating new file etc
      • From: kai <email@hidden>
    • Re: Creating new file etc
      • From: Bill Hernandez <email@hidden>
    • Re: Creating new file etc
      • From: Malcolm Fitzgerald <email@hidden>
  • Prev by Date: Re: AS ERROR...
  • Next by Date: Entourage Read All
  • Previous by thread: Re: AS ERROR...
  • Next by thread: Re: Creating new file etc
  • Index(es):
    • Date
    • Thread