Control name in dialog box of class SunAwtDialog - java

Usually, my AHK program reads the content of the "Filename:" text zone in file dialog boxes (Open, Save As, etc.) using the following info: read the content of control "Edit1" in dialog box of class "#32770". It can also read the list of controls using this piece of code:
; in Notepad, open the "Open" dialog box
WinGet, strControlsList1, ControlList, ahk_class #32770
WinGetTitle, strTitle1, ahk_class #32770
MsgBox, , %strTitle1% controls, %strControlsList1%
I'm trying to do the same in Java programs implemented for Windows (PDF Split and Merge and Geogebra) using Java Access Bridge, I guess. I know that these programs use the class name "SunAwtDialog" instead of the usual "#32770" for their dialog boxes. But I can't get access to the "Filename" control name. "Edit1" does not work. And I can't get the list of controls in this dialog box using this code:
; in a Java app like PDF Split and Merge, open the "Save As" dialog box
WinGet, strControlsList2, ControlList, ahk_class SunAwtDialog
WinGetTitle, strTitle2, ahk_class SunAwtDialog
MsgBox, , %strTitle2% controls, %strControlsList2%
Any idea how an AHK script could get info from these Java apps dialog boxes?

Related

Eclipse : Is it possible to open one resource in two different editors as per requirement?

In my current project, there is a situation where we have one file let's say "File1.cfg" in project explorer. There is a default editor "Editor 1" registered using "*.editors" extension.
Requirement Function:
When a user double click on the File1.cfg, it should be opened with an "Editor 1" by default and all the time.
There is one more option provided in Toolbar which will be used to open "Editor 2". And this editor should use the resource "File1.cfg" and display the contents as per the UI.
How can this be achieved in the Eclipse?
A plug-in can specify the editor id to be used when opening an editor. See IWorkbenchPage.openEditor and IDE.openEditor.
Normally these APIs check for an editor (of any id) already being open on the file. If you want to force the editor with the given id to open regardless you need to use the IWorkbenchPage method:
IEditorPart openEditor(IEditorInput input, String editorId, boolean activate,
int matchFlags)
with the matchFlags value set to:
IWorkbenchPage.MATCH_ID | IWorkbenchPage.MATCH_INPUT
to only match an existing editor with the same id and input.

create and open a pdf on a click of link and show print button with react-pdf

In my project, I have requirement of creating a pdf with the data , I am getting from Java backend API.
Is it possible to create and open the pdf on click of a button with react-pdf and also show print button on pdf?
I am new to UI development, so if it is possible please let me know any references also.
Thank you
On the click button, you will get data and you can pass that data to your pdf component and open pdf viewer
import React from 'react';
import { PDFViewer } from '#react-pdf/renderer';
import MyDocument from './MyDocument';
const ViewPDF = () => (
<PDFViewer>
<MyDocument />//Component which create pdf
</PDFViewer>
);
you can use ViewPDF component in your component in which you are having a button and you can render it conditionally

PathMustExists and FileMustExists in SWT FileDialog

To date I only used Swing to build graphical user interfaces but now I also want to make myself familiar with the Standard Widget Toolkit.
I already read the documentation and built a simple app.
My problem is now to use the FileDialog component.
I did the following code:
FileDialog openFileDialog = new FileDialog(shell, SWT.OPEN);
openFileDialog.setFilterExtensions(new String[] { "*.txt" });
openFileDialog.setFilterNames(new String[] { "Text files (*.txt)" });
openFileDialog.setText("Open file");
openFileDialog.open();
But I found no methods to set flags like "PathMustExists" or "FileMustExists".
Is this not possible with FileDialog?
Do I have to extend the class to implement that functionality? If so, how I have to proceed?
Or this there a better OpenFileDialog component (maybe in JFace) from which I don't know?
There are no options for this.
Since you are specifying SWT.OPEN you will get a file dialog specialized for opening existing files. Depending on which platform you are running on this dialog may not allow non-existent files to be selected at all (certainly true on Mac OS X). Still you should check the file after the dialog returns.

How to display Messagebox with Retry option in JAVA?

Scenario:
Pickup some data from an Excel file.
Search for it in a Text file.
If the data is not found, display a popup message box with a 'Retry' option.
User opens the Excel file and changes the value.
Click the 'Retry' button.
The Line which threw the error earlier should get executed again.
I need to know, how to display a message box with a 'Retry' option, clicking on which shall execute the line of code again.
Just place the code that pops up the box in a loop and continue the loop if the retry button was clicked. The response code from the jOptionPane tells you what button was popped.
this will give you an option pane with 4 buttons java C++ VB COBOL
String[] choices = {"Java", "C++", "<acronym title="vBulletin">VB</acronym>", "COBOL"};
int response = JOptionPane.showOptionDialog(
null
, "Which is your favourite programming language?"
, "Language Poll"
, JOptionPane.YES_NO_OPTION
, JOptionPane.PLAIN_MESSAGE
, null
, choices
, "None of your business"
);

Create an HTML link or button to add an event to a Lotus Notes user's calendar

My client uses Lotus Notes for calendering. We have a need to serve event information on SharePoint. I'm trying to create an HTML link or button I can use in a custom display form on SharePoint (HTML) that users can click to add the event to their Notes calendars. So far, I've found no way to do this.
An app exists on my client's Domino deployment(?) that creates buttons for use in Notes email messages that also can collect response information. The action of this button is handled by what looks like Java to me. I've included a sample in case it's relevant, and I can include all of it if it looks like it would be helpful, but it's quite long:
Set CurDb=Session.CurrentDatabase
'Get mail file information from Location document using Notes.ini
MailServer$ = session.GetEnvironmentString( "MailServer",True)
MailFile$ = session.GetEnvironmentString( "MailFile",True)
'Set MailDB = session.CurrentDatabase
If CurDb.Server = "" Then
'Attempt to open local mail file
Set MailDB = session.GetDatabase("", MailFile$)
If Not MailDB.IsOpen Then
Set MailDB = New NotesDatabase(MailServer$, MailFile$)
If Not MailDB.IsOpen Then
Msgbox "Unable to add event to your calendar because your local and server mail file cannot be located.",16, "Notice"
Exit Sub
End If
End If
Else
'Attempt to open server replica of mail file
Set MailDB = New NotesDatabase(MailServer$, MailFile$)
If Not MailDB.IsOpen Then
Msgbox "Unable to add event to your calendar because your server mail file cannot be located.",16, "Notice"
Exit Sub
End If
End If
The same app can create a "web" version that can be added to our current intranet platform, but it uses what looks to me like a custom "hook" to interact with the button application and the user's calendar, and it has no function if not placed within an object on that platform. I include the snippet here in case it offers a clue:
<input type="button" onclick="SendEmailNotification('PTHN-132512')"
value="Send me a Notes Calendar Invitation" id="HTMLWebBtn">
I'm wondering if using the snippet elsewhere is as easy as linking to a .js file in my source, and am waiting to hear back from people managing the platform internally, but experience says this is a dead end.
Searching on the Googlybox has so far been basically fruitless. I know you can have a link open Lotus Notes by replacing the http:// with Notes:// followed by the server's name and the application/database/document address (usually a sometimes-really-long string of alphanumeric characters). And I found an article containing strings you can place after the Notes:// to open a new document in a given application, i.e., the email editor. But that's as close as I've come.
Any help, folks?
You can leverage the fact that Notes supports the .ics file format. When a ICS file is opened, Notes can respond by creating a new calendar entry. The best thing is that this works in other mail platforms too, in case your environment is mixed.
Here is some info on setting up Notes: http://www.ibm.com/developerworks/lotus/library/notes85-icalendar/
You can programmatically generate that ICS file, or if you're looking to just play around there are sites online that will generate one for you:
http://www.pratie.com/lab/icalendar/

Categories