• 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
Re: open for access command, more re my original query
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: open for access command, more re my original query


  • Subject: Re: open for access command, more re my original query
  • From: "Stockly, Ed via AppleScript-Users" <email@hidden>
  • Date: Wed, 13 May 2020 22:14:13 +0000
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=latimes.com; dmarc=pass action=none header.from=latimes.com; dkim=pass header.d=latimes.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=iQqIAcUvetvuK9ugUU6TN8pXPffBojzxPKDqEBdfvls=; b=NntGyqaWN9sAF/f/vacK1PIMNoik+Wzyo+AkWtejZGzxOBVGj32DcqvBVq3GsYNVDlhfa9QyP41pK1MmoMI1nXJXVuzl0F1SfJN/RNUnCfGORR5b6AsPsgmHEv/RR8u7wIuuNUwcVmucNSd7ZT7O2ViKbU0l4p1BNp19pJdIR11YIJr/tJMY18QCyhC7uSWuoaeTMoYOPFO6Z91HhD8ejAcWUX/H+ihvCt2vWfawnU8WCeOTZP4Jswp9Er1GEQp8ondCuTZKEWzZkqrTBcsymRKCjWI11otWKrCrt8Y9Mw6u1TdiyhT6/oRLsxj7tfIePHLbNYBC1l845sM239WNqA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HwgLr+H6X2ds7xJ2wNHd394ModA4s2JvwzA7kuw+rDr/nGXCcqRAsJGIJphDAVRCDm5RI809DC1+XCaePmxs+XXhtISAOfK6XkLNxtFTYoIQtByO8rpgs5/kK1LdBsurGLE+IBEorOc1012FKcdQAWSCjKJHoDImxOfs1NVDMzY78ua2zq1lLh6eGd+hLU9q1gFVztg60iEt8qaLWadFFujtPuCXbck/jFqXjhNr7ZaHEf0BZ5as1NMBrtD/69F5wXf/zG3XI95TG3z9eaPIahs+f/MfjKc6R5btiOcSulua+I3s9tEqH5533t1oC8AOFUWcKIzdVDwk660wcLPuJQ==
  • Thread-topic: open for access command, more re my original query

First, the "open for access" command is not required if you just want to read a
file. It's only required to write to files (and will create a file to write to
if one doesn't exist). All you need is read

 "set aVariable to read myFile"

Second, the read command simply reads what's stored on the disk. If it's plain
text that's what you get. If it's a binary file you'll most likely see
gibberish. If it's HTML or XML or RTF you'll see all the style tags.

If you don't need the tags and metadata, but just the text the read command may
not be what you need.

Something like:

Tell application  "BBEdit"
  open myFile
  Set myText to text of window 1
  Close window 1
End

HTH


On 5/13/20, 3:03 PM, "le0car--- via AppleScript-Users"
<email@hidden> wrote:



    re members responses, It seems I have heard before "open for access
command, is suitable, strictly speaking, for text files",

    concerning specifics of format of the files I am trying to have my script
work with. the files are not text files, rather are rtf "rich text format" (a
format which supports, color characters, special characters etc.), I made the
files in the word processor TextEdit, that is, simply the word processor that
comes with macintosh os.
    I realize that this application doesn't script well, but that happens to be
the format of the stuff I have all typed up.

    related: I'd considered: I have found that these rtf files may be opened in
BBEdit, then saved anew from that application, the newly saved files shall be
text files; I find then, that open for access acting upon these text files,
(then read), produces an ok result, that is, the document's text alone, without
the internal data baggage that I've been plagued with.

    But that's making things more complicated, not less.


    Re Yvan's reply, your posted suggested script segment. looks esoteric to me
(my limited AppleScript skills), still, I would play with it, yet — if I
understand you correctly, this script writing (all of it) is pert to txt files,
and not rtf files.

    If the documents are text ones you may use:

    set t to ""
    set L to choose file of type {"txt"} with multiple selections allowed
    repeat with ff in L
            set someText to read ff as «class utf8»
            set myText to my recolle(paragraphs 1 thru 4 of someText, return) &
return & return
            set t to t & myText
    end repeat
    set the clipboard to t
    #=====

    on recolle(L, d)
            local oTIDs, t
            set {oTIDs, AppleScript's text item delimiters} to {AppleScript's
text item delimiters, d}
            set t to L as text
            set AppleScript's text item delimiters to oTIDs
            return t
    end
    recolle


    Regards, Leo

     _______________________________________________
    Do not post admin requests to the list. They will be ignored.
    AppleScript-Users mailing list      (email@hidden)
    Help/Unsubscribe/Update your Subscription:

https://nam04.safelinks.protection.outlook.com/?url=https://lists.apple.com/mailman/options/applescript-users/ed.stockly%40latimes.com&amp;data=02|01|email@hidden|21c8955f76f74b74957608d7f78974fd|a42080b34dd948b4bf44d70d3bbaf5d2|0|0|637250042073637338&amp;sdata=TVqBylWKmf0EEHIe46GZ5dg1SaCnopgzEDf6jle06/0=&amp;reserved=0
    Archives:
https://nam04.safelinks.protection.outlook.com/?url=http://lists.apple.com/archives/applescript-users&amp;data=02|01|email@hidden|21c8955f76f74b74957608d7f78974fd|a42080b34dd948b4bf44d70d3bbaf5d2|0|0|637250042073637338&amp;sdata=h51HUadMDXr0rz5jzqVySWSAH9PAedBg240+oI33qyk=&amp;reserved=0

    This email sent to email@hidden


 _______________________________________________
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: open for access command, more re my original query
      • From: Deivy Petrescu via AppleScript-Users <email@hidden>
References: 
 >open for access command, more re my original query (From: le0car--- via AppleScript-Users <email@hidden>)

  • Prev by Date: open for access command, more re my original query
  • Next by Date: Re: open for access command, more re my original query
  • Previous by thread: open for access command, more re my original query
  • Next by thread: Re: open for access command, more re my original query
  • Index(es):
    • Date
    • Thread