Saturday, January 19, 2019

#1 2018-12-10 06:49:43 pm

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

Applescript File Size

I've noticed that scripts saved in script file format become progressively larger after multiple saves. The size increase is often many times what would be expected by the edits alone.

I thought this might be a result of previous versions of the script that are accessible through the "Revert to" command but I deleted all prior versions of the script and that did not reduce the size of the script.

I was successful in reducing a script's file size by saving it in text file format and then immediately in script file format. By way of example, I had a 1-line  script which had a file size of 112KB and had a file size of 1KB after text-then-script files saves.

Anyone know why this is happening.

Thanks.

Last edited by peavine (2018-12-10 07:26:21 pm)

Offline

 

#2 2018-12-11 05:34:17 am

Nigel Garvey
Moderator
From:: Warwickshire, England
Registered: 2002-11-20
Posts: 4761

Re: Applescript File Size

Hi.

The "versions" system does tend to make script files grow while you're editing them, even if you don't actively save the changes. It's both annoying and a life saver. Mostly annoying.

Another thing is that if you run a script before saving it, the values of any persistent variables (properties, globals, or variables used in the run handler and not declared local) will be saved with it. If these values are long lists, they can add to the size fo the file. It can help to recompile scripts immediately before saving them. But I do that anyway and still the file sizes increase disproportionately, so presumably versions are the main culprit.


NG

Offline

 

#3 2018-12-11 09:26:24 am

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

Re: Applescript File Size

Thanks Nigel for the response. I had thought perhaps I was doing something incorrectly and its good to know that's not the case. I will recompile my scripts before saving them to see if that helps.

EDIT (12/20/18):
FWIW, I've found that using the "File > Save As" command while retaining the existing file name and Script file format will often significantly reduce file size. For example, a script I use for testing purposes was reduced from 132KB to 4KB.

Last edited by peavine (2018-12-20 10:15:35 am)

Offline

 

#4 2018-12-11 04:01:02 pm

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

Re: Applescript File Size

Nigel Garvey wrote:

The "versions" system does tend to make script files grow



It shouldn't -- it just saves copies elsewhere.


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

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)