how to run and control an excel instance from java - java

My java application has a button which should open a user selected Excel file when clicked. On this file the user has to select a diagram. Finally they should click a button which triggers a process (macro, java method?) which changes the size of the diagram to values read from an object of the java application etc.
When searching on the internet I found things like COM bridges for java like JACOB, but this seem to run on windows32 only; is there anything that works cross-plattform?
I would be very happy if somebody could help me to find a good approach, a fitting library or any other helpful hint, because I am a bit confused at the moment and don't know how to start at all ;)
Thank you very much and have a nice day!
edda

Check out http://j-interop.org/ . This can be used to call dcom applicaitons in a platform independent manner.

Related

How do I turn my chess engine into an executable file

I have this chess engine i wrote in java. Thing is, I need to make a exe application that can take commands following a certain protocol (UCI). Ive had many problems trying to get this to work, but ill keep this brief and share the most important ones.
Other engines pop up cmd when you click on them, mine is just a basic java CLI (Dont know if this is a problem).
My anti virus keeps stopping me from opening the exe. Launch4j gives me a warning telling me I should sign it to prevent this sort of thing, but I dont know what that means.
So heres the deal, I know this post is word vomit, but Im truly at a loss right now. Id like general order advice on how I should approach the problem and maybe some advice on wether i should be using launch4j in the first place.
UPDATE: The reason i wanted to make an exe in the first place is because thats the format that was suggested in the lichess documentation (I wanted to upload my bot to lichess). I wrote a bat file that executes the jar file and it worked fine. Thanks to everyone for the suggestions.

Java - Open the console or terminal a game is running in

I am creating a complex game, because of this I use System.out.println(); a lot to test to see if something works or to see if something went wrong. To see these messages I have been going to the CMD or terminal and running it from there but I was wondering if there was an easier way. I thought of a couple ways and came up with running with a batch, but I have no idea how to make one, and another way was to put a button in game that opens the console that the game is running in. I don't even know if the second one is possible but I was wondering if there was a way! Thanks in advanced!
This is what logging frameworks are for.
Use sfl4j - http://www.slf4j.org/ - in your code to generate the log events, and choose a suitable backend for your purpose. I would suggest using slf4j-simple which is easy to get started with and which easily can be sent to a file you can view in your favorite file viewer.
http://www.slf4j.org/api/org/slf4j/impl/SimpleLogger.html

How to write a Icon Handlers for explorer.exe in Java

First of all, I'm a java developer and I am currently working on a small application for Windows only.
In my application, I wish to do as dropbox or tortoise do : add an overlay icon in windows explorer to show the user some state of files managed by my application. (I want the icon of the file change depending on some data stored in the file)
Is it possible to do so in Java ? Do you have examples ?
If it is doable but not efficient, how would you do instead ?
Thanks in advance
Fluminis
It would be possible to do this via JNI - you would need to hook into the Windows registry and from there into the Explorer shell, probably into the various file classes held there.
However, unless you have at least some familiarity with C++ and the windows API, you are unlikely to be able to achieve this.
Java is not the ideal language for what you want to do.

how can i make UI automation in java by which i can capture button or menu of any external application dynamically

I want to automate an external application, but I have several problems:
How can I recognize a button or other field of an external application in Java?
I use the Robot class in Java for making notepad automation where I open notepad, select file menu, and save or exit, etc.
The problem is, it needs X,Y coordinates for the mouse pointer to go to the proper location.
I want to make it more dynamic, i.e. it should recognize the file menu of a running notepad anywhere on the desktop.
How can this be done in Java? Is there any class in Java I can use to do this?
Thanks everyone to give me response, I want to be more specific i want to know how can i make ui automation by using any tool if it is not possible in java or using any api of java.automation tool must be freeware.....i am searching net for that i found AutoIt is like that.But if any one do this type of things please share his/her experiance means is it possible to do that in AutoIt or not possible if not then which tool do that kind of things.
It is easy to integrate Sikuli into a Java-application since it is written in Java. Sikuli uses image recognition to find elements visible on the screen like buttons and such. It is very easy to use and provides an alternative for tasks that are difficult to handle with static positioning, like finding moving windows and such.
Take a look at this: http://sikuli.org/docx/faq/030-java-dev.html
Hope this helps!
You should have a look at Sikuli. It takes as inputs images of the ui elements to select an area in the targeted app. It's a UI Automation Application
That's a bit difficult to install (at least on Debian/Ubuntu, where I tested it), as you'll need a recent version of OpenCV, a particular version of JXGrabKey but the quality of the program worth the trip. Good Luck
Java doesn't have an API to examine the UI of another application; that would be a very big security risk.
Which is why the Robot class can only record events (key presses, mouse movements and clicks) but not which UI element was involved in most cases.
It would be possible to do more if the external application was written in Java because then, you could analyze the objects in memory but for obvious reasons, this isn't possible for C++ or .NET applications.

Java invoke com.apple.loginitems

I'm trying to add my Java Application to the "Login Items" preferences pane that appears in OSX. This pane is visible if you go to System Preferences --> Accounts, and click on your account name. You should then see a "Login Items" of programs that will automatically open when you log in.
I know I can add my program using launchd, or LaunchServices, but I had a few users ask if it could display inside the "Login Items" window. In order to do this, I believe I need to modify com.apple.loginitems.plist, but the file is written in binary so it can't be readily accessed. I've looked at it using
defaults read com.apple.loginitems
and I've tried writing to it using
defaults write com.apple.loginitems key value
but it looks like the loginitems plist is quite complex and has a weird structure. I'm wondering if there's any proper way to do this using Java. I believe there used to be a Cocoa Java extension that let you do this, but I don't think that's possible anymore in Snow Leopard.
Hopefully someone can give me a hand here :-)
I actually just ended up writing a (very) short Cocoa console application in XCode using http://github.com/carpeaqua/Shared-File-List-Example/blob/master/Controller.m as an example

Categories

Resources