Populating cells via script crashes Calc

Discuss the spreadsheet application
Post Reply
highrise955
Posts: 3
Joined: Mon Jan 26, 2015 12:27 am

Populating cells via script crashes Calc

Post by highrise955 »

I created a script in AutoHotkey to populate a series of cells. Here is the snippet of code that does the actual inputting...

Code: Select all

...

Loop, %LabelAmount%
{
    if LabelColumn <= 10
    {
        SendInput, +^{F2}
        SendInput, =TODAY()
        SendInput, {Enter}
        SendInput, {Right}
        ++LabelsPopulated 
        ++LabelColumn 
    }
The issue I am having is after about 30 or so cells being populated there is a noticeable slow down. Calc will usually crash all together by the time it populates 120 or so cells. I've tried using this code in Writer and other word processing apps and it works just fine and very fast. I have disabled 'AutoCalculate' and 'AutoInput' and made sure my formatting is set to 'Default'. I have renamed/deleted my profile so it would create a new one. None of these changes made a difference.

Anyone have any ideas why this is happening and/or suggestions on resolving it?
Openoffice 4.1.1 on Windows 8.1
User avatar
MTP
Volunteer
Posts: 1620
Joined: Mon Sep 10, 2012 7:31 pm
Location: Midwest USA

Re: Populating cells via script crashes Calc

Post by MTP »

No cause or solution ideas, just throwing a couple of potential additional tests out there:

If you insert a pause in the AutoHotkey script, does Calc catch up and accept another 30 or so cells before slowing down again?
Does the slow down and crash happen if you enter text into the cells or only formulas? Could you potentially format all the cells as text (to prevent the formula from being evaluated), run the script, and then do a Data->Text To Columns to convert back to formulas?
OpenOffice 4.1.1 on Windows 10, HSQLDB 1.8 split database
highrise955
Posts: 3
Joined: Mon Jan 26, 2015 12:27 am

Re: Populating cells via script crashes Calc

Post by highrise955 »

MTP wrote:No cause or solution ideas, just throwing a couple of potential additional tests out there:

If you insert a pause in the AutoHotkey script, does Calc catch up and accept another 30 or so cells before slowing down again?
Does the slow down and crash happen if you enter text into the cells or only formulas? Could you potentially format all the cells as text (to prevent the formula from being evaluated), run the script, and then do a Data->Text To Columns to convert back to formulas?

Thanks for the reply. :D

Adding a pause, even a five second pause, does not increase the speed during the next round of 30. I even had it pause at every 30 cells and tried to run 120 cells and it took the same amount of time (minus the pauses).

The slow down occurs regardless if I use the "=TODAY()" formula or set the script to cut and paste the date in text format.

I tried formatting all the cells as "text" and then ran the script pasting the date as text instead of the formula and there was no difference.

By the time you get to about 80 cells it is taking approximately one second for each cell. The PC I am running the script on is an intel-i7 with more than enough RAM. I am not encountering any other issues with the machine. Also, the script runs at lightning speed if I direct it to OO Writer or another word processor.
Openoffice 4.1.1 on Windows 8.1
User avatar
RoryOF
Moderator
Posts: 34618
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: Populating cells via script crashes Calc

Post by RoryOF »

I'm thinking Memory Leak or resource shortage; can you run some form of resource monitoring program to look at what OpenOffice is using?
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
User avatar
MTP
Volunteer
Posts: 1620
Joined: Mon Sep 10, 2012 7:31 pm
Location: Midwest USA

Re: Populating cells via script crashes Calc

Post by MTP »

A workaround might be to use the API call .setDataArray to enter the data. I'm not sure if AutoHotKey could create the array of values and an object for the range they go into; it might require a different scripting language.
OpenOffice 4.1.1 on Windows 10, HSQLDB 1.8 split database
Post Reply