Jump to content

Recommended Posts

Posted

I am working with a spreadsheet (libreoffice) Windows 11 (or windows 10). When i am filling out data to cells (read from a file) using a loop, the script runs correctly for the first 5 entries then fails to move right 1 cell, moves to next line as expected, then fails to move right 1 cell and enters the rest of the data correctly. 

INI FIle

[Bills]
Aqua Il=100
Com Ed=100
Farm & Fleet=0
Frontier=191.90
Meijers=0
Nicor=60
Sears=0
State Farm=103.73
Verizon=171.84

Code Snippit

Func Data2($v1, $v2)
    Send($v1 & "{RIGHT}" & $v2 & "{RIGHT}{Down}{Left 2}")
    Sleep($iTimeOut)
EndFunc

Func Create_Bills()
    Local $ary
    $ary = IniReadSection($INI_FILE, "SAVINGS")
    For $i = 1 to $ary[0][0] Step 2
        Data3($ary[$i][1], $ary[$i+1][0], $ary[$i+1][1])
    Next    
    Send("{RIGHT}")
    $ary = IniReadSection($INI_FILE, "Bills")
    For $i = 1 to $ary[0][0]
        Data2($ary[$i][0], $ary[$i][1])
    Next

EndFunc

Spreadsheet outpupt

  Aqua Il 100
  Com Ed 100
  Farm & Fleet 0
  Frontier 191.9
  Meijers0  
Nicor 60  
Sears 0  
State Farm 103.73  
Verizon 171.84  

 

   

As you can see the meijers entry ignores the {right} command and the following line has the same issue.

I have used a function that brute forces the entry into the cells with the same effect.

I am currently at a loss and could use a new set of eyes on this. 

Thanks

Posted

There is an UDF available for LibreOffice. This way you can easily write data to a spreadsheet.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Posted

I think your missing my point. I am trying to debug a script. I am trying to figure out if there is some buffer limit on the send command or if

i need to do something else. 

Is there a wait till done type command that would finish a group of send commands before proceeding.

I would like to get this working properly.

This script is meant to help my wife to do our bills if i am unable to.

Posted
21 hours ago, phedlund said:

...working with a spreadsheet (libreoffice) Windows 11 (or windows 10). When i am filling out data to cells (read from a file) using a loop, the script runs correctly for the first 5 entries then fails to move right 1 cell, moves to next line as expected,...

35 minutes ago, phedlund said:

I think your missing my point. I am trying to debug a script. I am trying to figure out if there is some buffer limit on the send command or ...

The help that was given was good for the question you had.

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

Posted (edited)

When you post code, please use the method provided in the link.  You should always post runnable code, not just part of it.  That way you are helping us helping you.  Understandable, that you just want to send keys to your spreadsheet.  Although, using a UDF is much more robust.  Anyway I tried to use your code with OnlyOffice, and it works well with an empty spreadsheet.  Here the code that I used (notice that I had to make it runnable).

Opt("WinTitleMatchMode", -2)

WinActivate ("Livre1.xlsx - ONLYOFFICE")
WinWaitActive("Livre1.xlsx - ONLYOFFICE")

Global $INI_FILE = "Test.ini", $iTimeOut = 125
Send("{RIGHT}")

Create_Bills()

Func Data2($v1, $v2)
    Send($v1 & "{RIGHT}" & $v2 & "{RIGHT}{Down}{Left 2}")
    Sleep($iTimeOut)
EndFunc

Func Create_Bills()
    $ary = IniReadSection($INI_FILE, "Bills")
    For $i = 1 to $ary[0][0]
        Data2($ary[$i][0], $ary[$i][1])
    Next
EndFunc

My guess is that maybe something is interfering with your send keys.  Try with a blank sheet.  You could also try adding some sleep after $v1 and $v2.

ps. take a look at SendKeepActive in help file, that could also remove some interferences. 

Edited by Nine
Posted (edited)

@phedlund, I have a hunch I was wanting to pass by you. In LibreOffice Calc, when you enter the same (string?) value several times, it sometimes offers a "suggestion", where it has a black background suggested text. If you push the "right" key, this will accept the suggestion, but not move to the next cell, which may be what you are encountering? You could confirm this by manually typing Meijers, and see if it offers a suggested text? If so, I'm thinking it's your problem.

I could offer one suggestion, if you modify your entry method to send the Delete key once, then press tab once, instead of just "right", this will ensure no suggestion is accepted, and tab will move right once.

Edited by donnyh13

LibreOffice UDF  

Scite4AutoIt Spell-Checker Using LibreOffice

WPS Office adapter — Use MS Word UDFs with WPS Office!

Spoiler

"Life is chiefly made up, not of great sacrifices and wonderful achievements, but of little things. It is oftenest through the little things which seem so unworthy of notice that great good or evil is brought into our lives. It is through our failure to endure the tests that come to us in little things, that the habits are molded, the character misshaped; and when the greater tests come, they find us unready. Only by acting upon principle in the tests of daily life can we acquire power to stand firm and faithful in the most dangerous and most difficult positions."

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...