Entering Text in Textbox of a jar File using Shell Script - jar

I have a graphical interface in jar file. There is a text box in there and a button in the window. I manually enter the text into it and then click the button to get the required output.
Now I want to make this thing automatic using a shell script. I wish to pass my input file using redirection. The shell script should open the jar file copy the text in the text box and click the button automatically so that I get the result instantaneously. Could anyone suggest something?

I don't think there's a out of the box solution for this, what I can think about is :
Create a simple java class which is the launcher of your GUI java app and to perform operations like typing and button click like
Using java Robot class. Refer this post or
Using a GUI testing utility like fest to do those user operations automatically

Related

How to prevent VSCode to apply a keybinding

I encounter an issue while using the Notebook preview on VSCode (MacOS; VSCode 1.71.2 (Universal)).
Step to reproduce:
Create a .iypnb document
In a code cell, enter
%%html
<input>
Run the cell and focus on the input field
Press M key
Current behavior:
VSCode catches the key press and dispatches an event that turns the cell to a Markdown cell. This is the correct key binding in my VSCode configuration.
How it is a problem:
I cannot properly type in custom components (either mines, or the ones from other libraries that render text as HTML). Rendering as HTML is a key feature of the IPython Kernel; VSCode catches too many key bindings. I have similar issue for all my bindings.
How to workaround (undesirable solution):
The only solution I've found for now is to remove the bindings of VSCode for the notebook preview. This is undesirable, as it affects my workflow.
Question: Is there a way to prevent VSCode to apply its binding when the focus in somewhere in the output of a cell?

How to make Jupyterlab or Jupyter show source code in a popup window?

Writing in the below
sqlContext.sql?
or pressing Shift+TAB while cursor is in the 'sql' of sqlContext.sql will make it popup the docstring of it. Writing in the below will show the source code and the docstring.
sqlContext.sql??
Is there any hotkey for this? I dont wanna keep writing in 'something??' every time I want to see the sourcecode.

Set value of a file input in JavaFX web view via java

I have a WebView node in my JavaFX and the page loaded in it has a <input type=file>. I want to set this input's value to a file on disk. I know this is not possible by injecting javascript into the web view. But I'm wondering if I can get access to JavaFX internals in how these input fields are handled and set the value through there. There appears to be no mention of file input controls' handling in the docs so I'm lost on this.
When I click on the file input. JavaFX gives me a native file selector. So, I'm expecting there's some form of handler that is invoked when clicking on a file input, that asks the user to select a file and then fills the file input with this value. That's what I want to do.
I tried just getting the element and setting it's value, but of course, it didn't work.
webEngine.getDocument().getElementById("FileInput")
.setNodeValue("C:\\attachment.pdf");
This piece of code does nothing. No error, no result either.
So, any ideas?
JavaFX internally uses WebKit for the WebView node, thus it have the same security restrictions. It's not possible to set the value of <input type="file"/> programmatically, neither over JavaScript or Java.
I suggest you to use FileChooser without using the WebView node. What the WebView node shows is a select button, which calls a FileChooser, and a label with the selected file name. This can be easily implemented in Java source code using JavaFX.

Select only files with QFileDialog [PyQT]

I'm trying to use the QFileDialog widget in PyQT in order to get the name of a file to save results. I'm using the method QFileDialog.getSaveFileName() and, as is expected, if I select an existing file a warning box appears saying that the file exists and offering the possibility to overwrite it. But the problem is that if I select a directory instead of a regular file the same warning box as if it was a normal file appears. I don't like this behavior and I would like a warning box informing there is a directory and it can't be selected, or maybe the OK button disabled until a regular file is selected. Is possible to do? How can I do this, if it is possible?
Thanks
The static functions will open a native dialog, unless you set DontUseNativeDialog with the options parameter, in which case you will get the built-in Qt file-dialog:
path = QFileDialog.getSaveFileName(options=QFileDialog.DontUseNativeDialog)
The built-in dialog is often faster, and generally has more sensible behaviour than the native dialogs. In particular, if you single-click a directory, the Save button changes to an Open button, so a directory can never be selected.
If you absolutely must have an native dialog, you could try setting the DontConfirmOverwrite option. This will allow you to handle any potential overwriting yourself after the dialog has closed.

How to I create a button in shiny to launch an R script?

I would like my HTML page to have a text field where the user can enter the path to his R script and next to it I would like to have a button that actually executes the script. I have not seen any similar examples. How would I go about doing this?

Resources