Monday, October 26, 2020

#26 2020-02-16 12:47:30 am

Shane Stanley
Member
From:: Australia
Registered: 2002-12-07
Posts: 6471

Re: Changing content of paragraph "on the fly"

CK wrote:

Regardless, I would say that a better Good Practice habit to get into would be to forget about storing and resetting them, but always be conscientious to explicitly set the tids immediately before any line in a script that splits text using text items, or joins list items through coercion to text.



We've been down this one lots of times before, but let me add my two cents' worth: I disagree. I think doing both is a safer habit. It's just too easy, IMO, to use TIDs without realising it.


Shane Stanley <sstanley@myriad-com.com.au>
www.macosxautomation.com/applescript/apps/
latenightsw.com

Offline

 

#27 2020-02-16 09:49:54 am

peavine
Member
From:: Prescott, Arizona
Registered: 2018-09-04
Posts: 644

Re: Changing content of paragraph "on the fly"

Thanks CK for the sample scripts and explanations.

I tested your scripts in Script Geek and retested my modification of Yvan's script, and they all completed in about 0.31 seconds. The second script in your post was fastest but only by a few milliseconds.

When testing your scripts, I did have to preface the variables f and path with file. Otherwise they wouldn't run. I also removed the two lines that wrote to the source file, just to compare like with like. With these changes, the textContent variable did return the expected results in Script Editor.

The second script in your post is of greatest interest, as it's new to me and will give me something to study.


2018 Mac mini - macOS Catalina

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)