• 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
Setting the correct linefeed.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Setting the correct linefeed.


  • Subject: Setting the correct linefeed.
  • From: Arnold Nefkens <email@hidden>
  • Date: Tue, 5 Feb 2008 20:59:36 +0100


Hello list, 

Im currently building a AppleScript Studio application that creates a series of set folders and creates 2 shell scripts . The problem is that the shell scripts do not get set with the correct linefeed. They are set to the Mac <CR> setting instead of the , correct in my case, setting.

Below the basis of the shell script creation:

set fileRef to (open for access alias scriptinstall with write permission)
write "#!/bin/sh" & return to fileRef as «class utf8» starting at eof
write "# Date:" & Thedate & return to fileRef as «class utf8» starting at eof
write "# Build by:" & BouwerNaam & return to fileRef as «class utf8» starting at eof
write "# " & return to fileRef as «class utf8» starting at eof
write "# This script installs :" & RadiaNaam & ". Logfile located at /var/log/radia/" & RadiaNaam & ".log" & return to fileRef as «class utf8» starting at eof
write "# " & return to fileRef as «class utf8» starting at eof
write "# Installationline:" & return to fileRef as «class utf8» starting at eof


write return to fileRef as «class utf8» starting at eof
write "/usr/sbin/installer -pkg /Library/Radia/package/" & RadiaNaam & ".pkg " & "-target / -allow -verboseR >>/var/log/radia/" & RadiaNaam & ".log" & return to fileRef as «class utf8» starting at eof
write return to fileRef as «class utf8» starting at eof
close access fileRef

I've found the following at macscripter.net:
http://macscripter.net/articles/402_0_10_0_C/

I've followed the second example and created the following routine:
set txt to " #!/bin/sh" & return & "# Aanmaakdatum:" & Thedate & return & "# Script build by:" & BouwerNaam & return & "# " & return & "# This script installs:" & RadiaNaam & ". Logfile located at /var/log/radia/" & RadiaNaam & ".log" & return & "# " & return & "# installation line" & return & "/usr/sbin/installer -pkg /Library/Radia/package/" & RadiaNaam & ".pkg " & "-target / -allow -verboseR >>/var/log/radia/" & RadiaNaam & ".log"
set tid to AppleScript's text item delimiters
set AppleScript's text item delimiters to ASCII character 10 -- (a line feed)
set newTxt to text items of txt -- not text of, text items of
set AppleScript's text item delimiters to tid -- whatever they were before - ALWAYS SET THEM BACK!


set fileRef to (open for access alias scriptinstall with write permission)
write newTxt to fileRef starting at eof
close access fileRef

The script does work, however the linefeed is still set to Mac <CR>... And to open all the scripts build by the application using TextWrangler in order to set them correct is not really a option... Building around a 60 to a 100 unix scripts a month....

Does someone know what to do? And what to change?

Thank you in advance.
---

Arnold Nefkens

Nefkens Advies    

email@hidden

Apple Certified Desktop Technician
Apple Certified Portable Technician
Apple Certified Helpdesk Specialist
Apple Certified Technical Coordinator
Apple Certified System Administrator



 _______________________________________________
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: Setting the correct linefeed.
      • From: Christopher Nebel <email@hidden>
  • Prev by Date: Re: Apple Mail - "content" command suddenly does not work
  • Next by Date: Re: Setting the correct linefeed.
  • Previous by thread: Re: on error result, how to parse
  • Next by thread: Re: Setting the correct linefeed.
  • Index(es):
    • Date
    • Thread