> Trying to learn AppleScript by reading the dictionaries is much like
trying to learn a foreign language just from reading a bilingual dictionary
for that language.

That reminds me of trying to learn how to use Unix commands and having
people tell you to "Read the `man` page!"

Years ago (Usenet days, I think) I had a ".sig" file (remember those?)
which included this: "If I understood the man page, I wouldn't have asked
the question".

Real-world examples are always good. Even with some 'textbook examples' I
find myself wondering what is placeholder text and what is not.

TJ





On Mon, Oct 12, 2020 at 8:30 AM Greg Raven <[email protected]> wrote:

> Thanks for supplying this final piece. Trying to learn AppleScript by
> reading the dictionaries is much like trying to learn a foreign language
> just from reading a bilingual dictionary for that language. Why Apple
> decided not to include any code samples in AppleScript dictionaries is
> beyond me.
>
> On Sunday, October 11, 2020 at 10:36:47 AM UTC-7 jj wrote:
>
>> Greg,
>>
>> The BBEdit dictionary mentions that the "normalize line endings" command
>> takes a text specifier as a parameter.
>>
>> ---
>> normalize line endings v : convert any CRLF pairs and LF characters
>> remaining after line-break conversion
>>
>> normalize line endings specifier : text to be modified
>>
>> → text : the modified text
>> ---
>>
>> Your script as written gives to the "normalize line endings" command an
>> implicit parameter of  type application "BBEdit" which apparently is not
>> automatically convertible to a text specifier.
>> Try to give it the contents of your document which is a text specifier
>> (something of the form: characters x thru y of ...).
>>
>> *normalize line endings* contents *of* *first* *document* *of* first
>> window
>>
>> or use a tell block to specify the implicit parameter:
>>
>> tell  first document of first window
>> *normalize line endings*
>> end tell
>>
>> HTH,
>>
>> Jean Jourdain
>> On Sunday, October 11, 2020 at 2:09:30 PM UTC+2 Greg Raven wrote:
>>
>>> Actually, this isn't working for me either. This is what I have so far:
>>>
>>> ```
>>> tell application "Safari"
>>> set sourceCode to source of first document
>>> end tell
>>>
>>> tell application "BBEdit"
>>> activate
>>> make new text window with properties {contents:sourceCode, source
>>> language:"HTML"}
>>> optimize
>>> # normalize line endings
>>> format mode gentle hierarchical with normalizing tag case
>>> copy time of (current date) to latest
>>> save text document 1 to file ("Macintosh HD:Users:greg:Desktop:tossme-"
>>> & latest & ".html")
>>> end tell
>>> ```
>>> The "normalize line endings" command is commented out because it throws
>>> an error so the script does not run to completion. I tried wrapping it in
>>> it's own tell block, but I'm still missing something.
>>>
>>> On Sunday, October 11, 2020 at 4:46:59 AM UTC-7 Greg Raven wrote:
>>>
>>>> Ah, so. Thank you! It never occurred to me that I needed a nested tell
>>>> block.
>>>>
>>>> On Sunday, October 11, 2020 at 12:53:16 AM UTC-7 jj wrote:
>>>>
>>>>> Hi Greg,
>>>>>
>>>>> Here is a script that might do what you want
>>>>>
>>>>> tell application "Safari"
>>>>> set vContents to source of first document
>>>>> set vName to name of first document
>>>>> end tell
>>>>>
>>>>> tell application "BBEdit"
>>>>> tell first window
>>>>> set vDocument to make new document at beginning with properties
>>>>> {name:vName, contents:vContents}
>>>>> tell vDocument
>>>>> normalize line endings
>>>>> format mode no reorganization with normalizing tag case
>>>>> end tell
>>>>> end tell
>>>>> end tell
>>>>>
>>>>> Best regards,
>>>>>
>>>>> Jean Jourdain
>>>>>
>>>>> --
> This is the BBEdit Talk public discussion group. If you have a feature
> request or need technical support, please email "[email protected]"
> rather than posting here. Follow @bbedit on Twitter: <
> https://twitter.com/bbedit>
> ---
> You received this message because you are subscribed to the Google Groups
> "BBEdit Talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/bbedit/7d391789-98d8-43d7-9cea-3b313f75eb88n%40googlegroups.com
> <https://groups.google.com/d/msgid/bbedit/7d391789-98d8-43d7-9cea-3b313f75eb88n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "[email protected]" rather than 
posting here. Follow @bbedit on Twitter: <https://twitter.com/bbedit>
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/CADjGqHvdxrkcfPAevu_wLggaV%2BToSUgv9QR%3DToqQkaXziBR7ig%40mail.gmail.com.

Reply via email to