Enter a "1" into Cell A1 from a switch outside my computer?

Discuss the spreadsheet application
Post Reply
newbie99
Posts: 5
Joined: Sun Dec 29, 2019 6:51 pm

Enter a "1" into Cell A1 from a switch outside my computer?

Post by newbie99 »

How can I do it?

I know almost nothing about electrical things, but I've been reading some things about Arduino, and think that's maybe the way I want to accomplish this. I thought I might ask a few questions here and hopefully you all could give me some good direction, so here goes.

1) Assuming I did this with Arduino, can anyone recommend what parts I'd need. I'd prefer getting just those parts, unless the cost of them begins to come close to, or exceed, the cost of a "beginners kit".

2) I've looked at some beginners kits, and it seems like a common complaint is they don't give either very good, hard to follow, or non-existent user instructions. But, in order to do what I want to do here, it looks to me like watching enough youtube videos, etc., should pretty much show me what I need to know. What do you think?

3) In your opinion, is there a better, cheaper, or more importantly, "easier-for-a-newby" way to accomplish this? If so, how?

Thanks for any help you can offer. I don't want to just to go out and buy a bunch of stuff I eventually find I won't use.
Open Office 4.1.7/Windows 10
John_Ha
Volunteer
Posts: 9583
Joined: Fri Sep 18, 2009 5:51 pm
Location: UK

Re: Enter a "1" into Cell A1 from a switch outside my comput

Post by John_Ha »

I don't think it can be done as I don't think there is any way to interface with Calc other than by the keyboard or mouse.

When a spreadsheet is opened the value held in A1 is stored in PC memory and not in a file (until you save) so you need a way to change the PC memory. The OS will only allow AOO to write to that part of memory as AOO owns it.

So you need to find a way to send Calc the keystrokes and or mouse movements you would type to enter a 1 in A1; or to run a macro which enters the value. If I create a new spreadsheet or open an existing where I had A1 selected when I saved it, A1 is selected and typing 1 Enter does what you want. Multiple Left arrows and Up arrows will get the cursor to A1 if A1 is not selected so thousands? of both will always get the cursor to A1.

A really clunky and very unreliable way would be to set things so the mouse was located over a macro which set A1 when it ran. Use the switch to simulate a left click from the mouse. This runs the macro and sets the cell.

Tools > Customise ..., gives access to defining keyboard shortcuts and events which trigger things.

Another way would be to edit content.xml in an unzipped .ods file to insert the value and open the file with AOO.

Take a step back. What exactly are you trying to do?

I ask because this sounds like a classic XY problem. You want to do X but you cannot. You come up with half a solution, Y, which you find does not quite work and is probably not a good idea. You then ask for help to fix Y.

It is far better to say "I want to do X ..." and ask for help on X. That way we can consider all your options without getting drawn down the possible dead end of Y.

A thought. Look at AutoHotKey as it can be used to automate much on a PC and can send keystrokes.
AutoHotkey is a free, open-source scripting language for Windows that allows users to easily create small to complex scripts for all kinds of tasks such as: form fillers, auto-clicking, macros, etc.
You are trying to do something in "real time" and a "real time spreadsheet" would do it. Googling it shows Excel and Google Spreadsheet have some real time capability - eg Possibility of Real Time Processes In a Cell on Spreadsheet using Google Apps Script
LO 6.4.4.2, Windows 10 Home 64 bit

See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.

Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
User avatar
RoryOF
Moderator
Posts: 34586
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: Enter a "1" into Cell A1 from a switch outside my comput

Post by RoryOF »

This should be simple using an Arduino or a Raspberry Pi; I'd suggest looking on a support site for one or other of these. The Arduino/Pi could then interface to the PC running Calc by network or USB. Some low level macro code may be needed.
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
newbie99
Posts: 5
Joined: Sun Dec 29, 2019 6:51 pm

Re: Enter a "1" into Cell A1 from a switch outside my comput

Post by newbie99 »

RoryOF wrote:This should be simple using an Arduino or a Raspberry Pi; I'd suggest looking on a support site for one or other of these. The Arduino/Pi could then interface to the PC running Calc by network or USB. Some low level macro code may be needed.
Yes that's what I'm hoping for, that should solve the problem of not knowing if there is anything other than a keyboard that can get info into a Open Office spreadsheet.

It may be difficult to get it to actually enter a "1" but if its possible for the switch to be used like a hotkey that triggers a macro that enters a "1" in a cell than that would work.

What I'm trying to do is make a "scoreboard" of sorts, where different switches will enter different numbers in different cells. You might be thinking "well, that's what a keyboard is for" and you'd have a point, but the switches are in different locations and would not have a person there pressing buttons.
Open Office 4.1.7/Windows 10
User avatar
RoryOF
Moderator
Posts: 34586
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: Enter a "1" into Cell A1 from a switch outside my comput

Post by RoryOF »

Then some board such as an Arduino or a Raspberry Pi, which permits easy low level access to input/output ports is the way to go. Interfacing an Arduino or a Pi to the PC, if indeed that is necessary, should be a trivial task. Look for an Arduino or Pi support site - indeed, I think some of the starter kits for these come with booklets of proposed low level projects. 40+ years ago this was trivial to do using a z80 setup.
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
newbie99
Posts: 5
Joined: Sun Dec 29, 2019 6:51 pm

Re: Enter a "1" into Cell A1 from a switch outside my comput

Post by newbie99 »

Thank you El Mucho. I've read a number of things but not these and they look helpful.
Open Office 4.1.7/Windows 10
John_Ha
Volunteer
Posts: 9583
Joined: Fri Sep 18, 2009 5:51 pm
Location: UK

Re: Enter a "1" into Cell A1 from a switch outside my comput

Post by John_Ha »

newbie99 wrote:What I'm trying to do is make a "scoreboard" of sorts, where different switches will enter different numbers ...
It is using Calc which makes it difficult. If you do not need to use Calc then it is trivially simple. Connect the switches or Arduino to the PC port. Write a very simple application using PsycoPy which reads the switches and displays the results. All done.
John_Ha wrote:I don't think it can be done as I don't think there is any way to interface with Calc other than by the keyboard or mouse.
I did a bit of digging and it appears that you can communicate with an open Calc or Writer document via the AOO API. See Open Office API/UNO Writer which links to OpenOffice which gives the following well documented example code which uses AutoHotKey to do the access. Note that it creates the Writer document which it then accesses because it owns it. I don't know if it would work accessing a file which was already open in AOO as that file would presumably be owned by someone else and access would be denied.

Code: Select all

; ===============================================================================================================================
; Title .........: OpenOffice from AHK
; AHK Version ...: 1.1.15.01 x64 Unicode
; Win Version ...: Windows 7 home x64 SP1
; Description ...: Example of accessing OpenOffice from AHK
; Version .......: v1.00
; Modified ......: 2014.07.25
; Author(s) .....: BlackHolyMan
; ===============================================================================================================================

#SingleInstance, force

FileSelectFile, Path,,, Please select an openoffice file, *.odt; *.ods
if (path = "")
ExitApp
StringReplace, Path, Path, \, /, ALL

;~ Dim oSM 'Root object for accessing OpenOffice from VB
;~ Dim oDesk, oDoc As Object 'First objects from the API
;~ Dim arg() 'Ignore it for the moment !

;~ 'Instanciate OOo : this line is mandatory with VB for OOo API
;~ Set oSM = CreateObject("com.sun.star.ServiceManager")
oSM := ComObjCreate("com.sun.star.ServiceManager")
;~ 'Create the first and most important service
;~ Set oDesk = oSM.createInstance("com.sun.star.frame.Desktop")
oDesk := oSM.createInstance("com.sun.star.frame.Desktop")

array := ComObjArray(VT_VARIANT:=12, 2)

;~ 'We use/call the MakePropertyValue function, defined below, to access the structure

;~ Set OpenPar(0) = MakePropertyValue("ReadOnly", True)
Array[0] := MakePropertyValue("ReadOnly", True)
;~ Set OpenPar(2) = MakePropertyValue("Hidden", False)
Array[1] := MakePropertyValue("Hidden", False)

;~ 'Create a new doc
;~ Set oDoc = oDesk.loadComponentFromURL("private:factory/swriter", "_blank", 0, arg())
oDoc := oDesk.loadComponentFromURL("file:///" path, "_blank", 0, Array)

;~ oDoc.getCurrentController().getFrame().getContainerWindow().setVisible(True)

MsgBox okay now its open, lets Close it!

;~ 'Save the doc
;~ Call oDoc.storeToURL("file:///c:/dev/ooo/test2.sxw", arg())

;~ 'Close the doc
;~ oDoc.Close (True)
oDoc.Close(True)
oDoc := ""

;~ End Sub
return

;~ Function MakePropertyValue(cName, uValue) As Object
MakePropertyValue(cName, uValue)
{
;~ Dim oPropertyValue As Object
oPropertyValue := Object()

;~ Dim oSM As Object
oSM := Object()

;~ Set oSM = CreateObject("com.sun.star.ServiceManager")
oSM := ComObjCreate("com.sun.star.ServiceManager")

;~ Set oPropertyValue = oSM.Bridge_GetStruct("com.sun.star.beans.PropertyValue")
oPropertyValue := oSM.Bridge_GetStruct("com.sun.star.beans.PropertyValue")

;~ oPropertyValue.Name = cName
oPropertyValue.Name := cName

;~ oPropertyValue.Value = uValue
oPropertyValue.Value := uValue

;~ Set MakePropertyValue = oPropertyValue
return oPropertyValue

;~ End Function
}
Showing that a problem has been solved helps others searching so, if your problem is now solved, please view your first post in this thread and click the Edit button (top right in the post) and add [Solved] in front of the subject.
LO 6.4.4.2, Windows 10 Home 64 bit

See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.

Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
User avatar
RoryOF
Moderator
Posts: 34586
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: Enter a "1" into Cell A1 from a switch outside my comput

Post by RoryOF »

Overnight I recollected that many years ago (25?) I was able to purchase extension cards for a PC which had multiple input/output; these plugged into standard PC bus slots. These were drivable by BASIC and were supplied for computer control purposes.
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
John_Ha
Volunteer
Posts: 9583
Joined: Fri Sep 18, 2009 5:51 pm
Location: UK

Re: Enter a "1" into Cell A1 from a switch outside my comput

Post by John_Ha »

Rory

I don't think that addresses the central issue.

It is very easy to get the data onto the PC port and hence available to the PC where many applications can read it.

The problem is that AOO cannot read data on the port. AOO does not connect to the port, AOO does not listen to the port and AOO's API does not communicate with the port. So how does AOO see the data?

The PsychoPs API is designed to communicate with the port so PsycoPs can get the data.

Let me rephrase the question taking the port out of consideration.

I have a file Fred.txt which contains a single digit number as its first character which keeps changing.

How do I get that number put into cell A1 of an open spreadsheet Bill.ods without making Bill.ods the active window and using the keyboard or mouse to interact with Bill.ods?

Of course, if the AOO API does communicate with the port it becomes easy (assuming you can code).
LO 6.4.4.2, Windows 10 Home 64 bit

See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.

Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
User avatar
Lupp
Volunteer
Posts: 3542
Joined: Sat May 31, 2014 7:05 pm
Location: München, Germany

Re: Enter a "1" into Cell A1 from a switch outside my comput

Post by Lupp »

Did somebody already consider the topic viewtopic.php?f=20&t=682 in this context?
(I didn't study it thoroughly myself, but it might be helpful.)
On Windows 10: LibreOffice 24.2 (new numbering) and older versions, PortableOpenOffice 4.1.7 and older, StarOffice 5.2
---
Lupp from München
User avatar
RoryOF
Moderator
Posts: 34586
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: Enter a "1" into Cell A1 from a switch outside my comput

Post by RoryOF »

On startup, the application (Calc, let us say) starts a continuously running - or running on timed intervals - macro to check for presence of file fred.txt or change in it (date/time); if no change it returns until next time tick. If change, reads first char of fred.txt and transfers it to a specified Calc or other application.

If only one input line the change in the file time is sufficient to indicate a change; if more than one input lines, the first char(s) need to be read.

Possibly very easy in Python, slightly more difficult in BASIC.

There have been some Calc data-logging queries on Forum.

To actually read the port, a small assembly language or C++ piece of code may be needed; the link Lupp gives may be helpful about that. I haven't delved into the OO API to see if there are direct port I/O addressing routines.
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
John_Ha
Volunteer
Posts: 9583
Joined: Fri Sep 18, 2009 5:51 pm
Location: UK

Re: Enter a "1" into Cell A1 from a switch outside my comput

Post by John_Ha »

Rory

So the sequence would be

1. An application like PsychoPs reads the port and writes fred.txt
2. A macro in AOO runs continuously and every few seconds checks fred.txt and reads the value. It is a "pseudo real time" kludge.

Pitoynak has an example of AOO calling Internet Explorer; and of AOO reading or writing text in a file.

Code: Select all

[b]5.11. Calling an external program (Internet Explorer) using OLE[/b]
Use the Shell command or the OleObjectFactory (for Windows only).

Listing 5.34: Use the OleObjectFactory to start an application.

Sub using_IE( )
Dim oleService
Dim IE
Dim s$
s = "com.sun.star.bridge.OleObjectFactory"
oleService = createUnoService(s)
IE = oleService.createInstance("InternetExplorer.Application.1")
IE.Visible = 1
IE.Navigate("http://www.openoffice.org")
End Sub

[b]5.13. Read And Write Number In File[/b]
This shows how to read and write a string from a text file. The string is converted to a
number and incremented. The number is then written back out to the file as a string.

Listing 5.36: Read and write a number in a file.
'Author: Andrew Pitonyak
'email: andrew@pitonyak.org

Sub Read_Write_Number_In_File
Dim CountFileName As String, NumberString As String
Dim LongNumber As Long, iNum As Integer
CountFileName = "C:\Andy\My Documents\oo\NUMBER.TXT"
NumberString = "00000000"
LongNumber = 0
If FileExists(CountFileName) Then
ON ERROR GOTO NoFile
iNum = FreeFile
OPEN CountFileName for input as #iNum
LINE INPUT #iNum ,NumberString
CLOSE #iNum
MsgBox("Read " & NumberString, 64, "Read")
NoFile: 'in case an error occured go here..
If Err <> 0 Then
Msgbox("Can not read " & CountFileName, 64, "Error")
NumberString = "00000001"
End If
On Local Error Goto 0
Else
Msgbox(CountFileName & " does NOT exists", 64, "Warning")
NumberString = "00000001"
End If
ON ERROR GOTO BadNumber
LongNumber = Int(NumberString) 'a single digit number is returned
LongNumber = LongNumber + 1
BadNumber:
If Err <> 0 Then
Msgbox(NumberString & " is not a number", 64, "Error")
52
LongNumber = 1
End If
On Local Error Goto 0
NumberString=Trim(Str(LongNumber))
While LEN(NumberString) < 8
NumberString="0"&NumberString
Wend
MsgBox("Number is (" & NumberString & ")", 64, "Information")
iNum = FreeFile
OPEN CountFileName for output as #iNum
PRINT #iNum,NumberString
CLOSE #iNum
End Sub
LO 6.4.4.2, Windows 10 Home 64 bit

See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.

Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
John_Ha
Volunteer
Posts: 9583
Joined: Fri Sep 18, 2009 5:51 pm
Location: UK

Re: Enter a "1" into Cell A1 from a switch outside my comput

Post by John_Ha »

RoryOF wrote:There have been some Calc data-logging queries on Forum.
I found Data logging where davejay321 claims
i have external data that is refreshed into the same cell on my spreadsheet every 60 seconds ....
and villeroy asks
How do you do that?
but does not get an answer. Presumably it is something like a macro which runs every 60 seconds as you suggest.

Windmill Software seems to use DDE as it says
Route Data from Transducers and Laboratory Instruments into OpenOffice or LibreOffice

Windmill software reads data from instruments and devices connected to your PC.

OpenOffice and LibreOffice are both open-source office suites and therefore free! From now on we'll just refer to OpenOffice, but unless stated the comments refer to both programs' Calc spreadsheets.

You can collect data with the Windmill Logger application, and after collection has finished, import it into your OpenOffice spreadsheet. Alternatively you can transfer data as it arrives, using dynamic data exchange. To do this use the Windmill DDE Panel as a gateway to transfer data values between your instruments and OpenOffice.
It uses While ... Wait in this example code. It says, with a split infinitive, :

To continually read data and write it into OpenOffice:

- Format the first column to show Time (Format menu > Cells > Time).
- Create an OpenOffice macro and copy the example macro below into it.
- Change the channel name (in our example 00001) to match yours.

Code: Select all

REM  *****  BASIC  *****
Sub SampleData()

dim TimeCol as integer
dim DatCol as integer
dim NoOfRows as integer
dim FirstRow as string
dim NoOfSamples as integer
dim SamplePeriod as integer
Dim myData as string
Dim ddeChan as string

'When the number of rows is equal to the number
'of sets of samples requested, the macro will stop.
'If NoOfRows = 3, the first reading will be placed in row 4.
'If TimeCol = 0, the date and time will be placed in column A
'If DataCol = 1, the readings will be placed in column B.

TimeCol = 0
DataCol = 1
NoOfRows = 3

'Ask for number of sets of samples and sample interval (ms).
NoOfSamples = Val(InputBox("Enter number of samples", "Samples"))
SamplePeriod = InputBox("Enter sample interval in ms", "Sample Interval")

' Opens a DDE conversation with the Windmill DDE 
' Panel using the Service Name "Windmill" and the  
' Topic Name "Data"
ddeChan = DDEInitiate("WINDMILL", "Data")

'Keeps conversation open until the required number of samples
'have been collected.
While NoOfRows < NoOfSamples 

'Requests data from a channel called "00001" and stores it in 
'memory as mydata.
mydata = DDERequest(ddeChan, "00001")

'Selects first sheet in workbook.
Sheet = thisComponent.Sheets("Sheet1")

	'Writes the time and date
	Cell = Sheet.getCellByPosition(TimeCol, NoOfRows)
	Cell.Value = Now
	
	'Writes the data reading
	Cell = Sheet.getCellByPosition(DataCol, NoOfRows)
	Cell.Value = mydata

'Waits for the specified sample interval in milliseconds
Wait (SamplePeriod)

'Increments number of rows, 
'so next set of samples is inserted in the next row down.
NoOfRows = NoOfRows + 1

'Stops loop when required sets of samples collected.
Wend
DDETerminate (ddeChan)

End Sub
LO 6.4.4.2, Windows 10 Home 64 bit

See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.

Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
John_Ha
Volunteer
Posts: 9583
Joined: Fri Sep 18, 2009 5:51 pm
Location: UK

Re: Enter a "1" into Cell A1 from a switch outside my comput

Post by John_Ha »

I had a look at Help and have been playing around with DDE links.

1. Create file C:\Users\John\Desktop\fred.odt with a section called value. Put zebra in that section. Leave the file open.

2. Create a spreadsheet called reads data in file.ods where cell A1 has

Code: Select all

=DDE("soffice";"C:\Users\John\Desktop\fred.odt";"value")

3. add lion after zebra in fred.odt. Note you do not need to save fred.odt.

4. After a slight delay Cell A1 now shows zebra lion without my doing anything - it was dynamically updated.

This was interesting (to me) as it meant that Calc must be asking Writer to give Calc a value which was stored in Writer's allocated memory as lion was only stored in Writer's memory and no other place. Presumably this is what Writer's DDE server does - on request it serves up data it owns.

Note that if I do it the other way round and I open spreadsheet reads data in file.ods and then open fred.odt, fred.odt is opened in Read Only mode and I cannot edit it.

This should give you some ideas. For a start you need to find out how to change the server value to the server value of code which writes the port data to the file. Even though both the AOO and LO servers are called soffice opening one file in AOO and the other in LO did not work - both needed to be opened with AOO or both with LO. This suggests a fuller description of server is required. You will need to check the application documentation.

DDE has been superseded by ODE so ODE may be better. DDE (and ODE?) only work on Windows.

While playing around and stopping and rapidly restarting AOO I also got the classic "two copies of soffice.bin problem" and AOO hanged.
Clipboard01.gif
Attachments
reads data in file.ods
(8.25 KiB) Downloaded 105 times
fred.odt
(9.38 KiB) Downloaded 101 times
LO 6.4.4.2, Windows 10 Home 64 bit

See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.

Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
newbie99
Posts: 5
Joined: Sun Dec 29, 2019 6:51 pm

Re: Enter a "1" into Cell A1 from a switch outside my comput

Post by newbie99 »

Thanks everybody for all your help on this.

The "solution" (if it actually works out to be one) I'm settling on is this:

An emulated keyboard as shown on this video:
https://www.youtube.com/watch?v=AgTzw0yeMvU

The spreadsheet opens, the curser goes automatically to cell A1 and a switch outside a keyboard types a "1" (or another letter or number) into cell A1.

Then I don't have to buy Arduino stuff (but, unfortunately I already have!) and don't have to learn Arduino (which, for me would begin at looking up "Arduino" in a dictionary).

But it does bring up another unforeseen problem that I will have to ask in another thread.
Open Office 4.1.7/Windows 10
John_Ha
Volunteer
Posts: 9583
Joined: Fri Sep 18, 2009 5:51 pm
Location: UK

Re: Enter a "1" into Cell A1 from a switch outside my comput

Post by John_Ha »

newbie99 wrote:But it does bring up another unforeseen problem that I will have to ask in another thread.
Please read my comment above about The XY Problem. You want to do X but you cannot. You come up with half a solution, Y, which you find does not quite work and is probably not a good idea. You then ask for help to fix Y. We fix Y and you promptly find problem Z and ask for help on it. And so it goes on ...

Please tell us EXACTLY what you are trying to achieve WITHOUT SAYING HOW YOU THINK IT SHOULD BE DONE or what software you think you need. Please give us something like "I want to create a display on a PC screen of a score-sheet for a game of ?? I want to enter scores by four switches, one for each contestant. The display should look like a histogram? a pie chart? a list of numbers?".

Calc may not be the correct software to do this. You can drive a screw with a hammer but it is much better to use a screwdriver.

You have already wasted money buying an Arduino because you did not state your problem properly.
LO 6.4.4.2, Windows 10 Home 64 bit

See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.

Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
User avatar
Lupp
Volunteer
Posts: 3542
Joined: Sat May 31, 2014 7:05 pm
Location: München, Germany

Re: Enter a "1" into Cell A1 from a switch outside my comput

Post by Lupp »

newbie99 wrote:An emulated keyboard ...
What you got described there I would rather call a (very) rotten keyboard, not an emulated one.

If a keyboard is plugged into a hardware port, the information about pressed keys goes to the object currently having the keyboard focus. Barcode readers e.g. depend on this fact. They are just another kind of keyboard in a sense therefore. If It's not your spreradsheet (accepting arrow keys e.g.) or a cell of it (accepting the 1-key e.g.) having the focus you don't get anywhere. If you want to act in a different way on a hardware-interface event, you first of all need to listen to such events on the OS level. Decades ago we did things of that kind with single-task "computers", but I wouldn't know how to do it nowadays.

If you find a way to get your "key pressed" signal from the switch into the computer and listzened to by any software, you can use a software interface to now actually simulate a keyboard event that will be passed by the OS to the object having the focus. This is what drivers of keyboard-like input devices actually do, imo. (Think of a bluetooth-keyboard e.g.)

Well, my terminology may not be up to date. It's probably not much better with https://download.cnet.com/Keyboard-Emul ... 80555.html, but nonetheless you may get an idditional impression of what I was keyboarding about.
On Windows 10: LibreOffice 24.2 (new numbering) and older versions, PortableOpenOffice 4.1.7 and older, StarOffice 5.2
---
Lupp from München
newbie99
Posts: 5
Joined: Sun Dec 29, 2019 6:51 pm

Re: Enter a "1" into Cell A1 from a switch outside my comput

Post by newbie99 »

To Lupp:

"Rotten" keyboard is all I need. You mentioned the "focus", and correct me if I'm wrong but to me that means Cell A1. And since that's where the program opens to, thats all I need, its the only place I need to go, so I don't need to enter spaces, returns, tabs or anything else. I only have to type numbers and/or letters into this cell, and that's ALL (BOOM-boom :).

The part about simulating a keyboard event I'm not quite really understanding. I want to type a number with the click of a switch. If my project were a lot more complex maybe that would be good to have, but anyway, thanks for mentioning it. My goal is to keep this as simple as it can possibly be.

And to John Ha:
My other goal is to keep it as CHEAP as it can possibly be, and yes I know, I wasted money on the Arduino. But actually, I'm not counting it as a total waste, because once I got it I realized that just maybe there might be a far easier and cheaper way, and that the CALC spreadsheet would be the perfect way for me to do it. Getting the Arduino actually turned out to be a really serrendipidous (sp?) thing that happened. But thanks for the explanation, I really appreciate you trying to help, and I see what you mean by the XY problem.

One last thing, I mentioned I've run into another problem in my last post that said I'd have to ask about in another thread. Cancel that, I've figured it out. And now all the roadblocks are out of the way. I just have to make that (rotten) keyboard and hope it works!
Open Office 4.1.7/Windows 10
User avatar
Villeroy
Volunteer
Posts: 31269
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Enter a "1" into Cell A1 from a switch outside my comput

Post by Villeroy »

Download http://forum.openoffice.org/en/forum/do ... hp?id=3048
Open the "Form1" therein.
Focus the upper input box.
In order to enter a 1, hit the upper arrow on your wireless keyboard and enter.
In order to enter a 2, push the upper arrow twice and enter.
Open the report in order to see all entered values with timestamps.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Post Reply