phedlund Posted Friday at 09:27 PM Posted Friday at 09:27 PM 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
water Posted Friday at 09:32 PM Posted Friday at 09:32 PM 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
phedlund Posted Saturday at 06:19 PM Author Posted Saturday at 06:19 PM 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.
argumentum Posted Saturday at 06:58 PM Posted Saturday at 06:58 PM 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.
Nine Posted Saturday at 07:29 PM Posted Saturday at 07:29 PM (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 Saturday at 07:37 PM by Nine “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
donnyh13 Posted Sunday at 01:17 PM Posted Sunday at 01:17 PM (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 Sunday at 01:42 PM by donnyh13 Nine 1 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."
phedlund Posted 12 hours ago Author Posted 12 hours ago Thank you so much donnyh13, That did the trick. I guess i never though of the suggestion filling the cell since it was only one of the entries creating the problem. donnyh13 and argumentum 2
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now