Why's Marathon not properly selecting in comboboxes? - java

I'm using Marthon to run tests on a Java Swing application. I build the base tests by recording, then just make small modifications to the resulting Ruby tests to tweak it to fit what I need. I've run into an interesting problem where comboboxes selections do not work. For example, it'll record...
select("Value", "0.25")
...for the Value combobox, which has a valid option of 0.25 in it. However, during playback, the script pauses execution at that point. If I manually click on the combobox (just to drop it down, not actually selecting anything), then the script will select the right number and continue on.
The problem exists for ALL (so far tested) comboboxes in my application, but none of the other control types. Is there a way to select a value in the combobox that works? I don't mind tweaking the recorded script, I just want to not have to manually click on all my comboboxes each time they're in the script!

Have a look at the object map files for the window and change the recognition properties. That should make this consistent.
The _2 basically means that Marathon is unable to find unique properties to identify the components.

Well, I figured it out already... Apparently the recorder just does a poor job at figuring out the correct label for comboboxes. I was able to get some to work by removing the "_2" or whatever at the end. Others, it took incrementing that number. So, apparently the way the recorder sees the screen layout is different from what the player sees.
edit
The newest version of Marathon appears to have fixed whatever was ailing it before. I'm now unable to duplicate the problem.

Related

how can three cells work in parallel the incoming workpiece carriers in Analogic?

I want to create a conveyor line where three cells do the same work in parallel to reduce the cycle time.
Workflow:
Workpiece carrier = WT: 12 pieces
3x cells
The WT should always be directed to the cell that is free or the work process is most likely to finish.
Since I have just started to get to learn about Anylogic, I am having a hard time setting the correct commands.
If someone has an idea of how to reach my goal I would be very grateful!
Review the implementation in the Solar Panel Production Line Example model inside the AnyLogic help, or download the source form the AnyLogic Cloud
https://cloud.anylogic.com/model/29d54a61-aaac-4c47-8e50-941c0f5bb36e?mode=SETTINGS
Easiest would be to use a select output and base the selection of the exit from the select output on the condition of whether one of the cells are busy or not
In your example, you need to replace the code of randomFrom(collection) with a function to check if a cell is busy or not. Since you don't have the cells in your example I cant give you the code. But try it yourself and if you cant manage after reviewing the example model then post a new question

how to record keystrokes in background using java?

I am going to research on which key typed most in which hour in a 24-hour-day?
Later, I would research on which word used most in which hour in a 24-hour-day?
Say in the evening you would find most used word good or bye as people usually ends up their meeting in the evening.
So, I need to record keystrokes on the background using a java application with a time-stamp.
My questions are:
How to run a java program on the background?(Obviously informing the user).
How to record keystrokes which are used in other applications and counted in the java application without affecting its original application?
Note that:
This question does not serve my problem. Though it has an accepted answer, but the answer is not helpful for me because it could not distinguish between uppercase and lowercase letter, it returns same ASCII character. It just gave some sources and some other files. I expect more readable answer and a clear view how the java program launch on the start up and run on the background.
Just a little information to get you moving in the right direction. What you are looking to implement to listen for the keystrokes is KeyListener. I believe the actual function is keyTyped(ActionEvent e) but am not sure.
Other then that to run a program silently in the background will probably require some manipulation of the window + windows properties. You could just have the program run without a UI, or create a very lightweight UI that posts data. If you are looking for an actual "out of sight out of mind" background process, I am not sure how to do this with Java. However I imagine just an un-intrusive GUI would be sufficient for your purposes.

How to make my robot use an URL response time

I'm a java beginner and I'm trying to program a robot that will fill a very annoying form for me.
Why is this form annoyin? Imagine I have to insert a thousand different values into this form but it only lets me insert one value at a time. Everytime time I insert each value I have to press an "OK" button and wait for the URL to update (this takes from 1 to 50s) and only so I'm able to insert another one.
To solve the problem I made a robot that uses a 1min delay between each "OK", but this is far from optimal, since when the URL updates in 1s the robot stays useless for a minute. Even worst, if the url takes more than 1min to update my robot is going to fill the form wrongly.
Is there anything I can do to detect when the url has updated and then use this information as the delay to my robot?
Thanks a lot!
One thing you could try is
Robot.getPixelColor(x,y)
which returns the color of a pixel on the screen. You can tell the robot to wait until the pixel is colored "correctly" (which would happen when the page is completely loaded).
You can use Selenium. It provides a good API and lots of tools for you to automate browser work. Some people might argue that this is not the purpose of the library, but I think that in your case it should work. Link: http://www.seleniumhq.org/download/
Why I think this is the solution:
Selenium is a suite of tools specifically for automating web browsers.
Which seems to be just what you are requesting.
P.S. There are third party drivers as well. For instance, you can download a driver for the Chrome browser.

Is it possible to modify the time OSCeleton sends a lost_user event/message?

I'm playing around with OSCeleton and Processing and succesfully got to track skeletons and do stuff.
What I'm wondering is if there's any way to change the delay time a "lost_user" message is sent to Processing.
This is taking so long for what I'm trying to achive, since i need to stop tracking a user as soon as he goes away from the screen, so I can accept another user's interaction. (imagine an installation where a lot of people wants to play with).
any help/tips would be really appreciated.
Jon
As far as I can tell from the OSCeleton's source and with my minimal experience with the kinect(I never used OSCeleton), there is no way to modify that code to do that. It seems to be a thing handled even lower, by the driver or by the kinect its self(?).
Yet you need not bind yourself with that, and I would suggest a couple of ways to bypass the problem if I understand properly.
First, the latest drivers and examples should have multi-user support, meaning you can just arrange who is your main user. From what I can tell from the source you do get an osc message in Processing when a new user is detected as well as an ID number. You can put each new user that arrives, into an arrayList and figure out a way to do things without depending on the latest user.
If you are still going for the user-after-user thing though, or I was mistaken about the multi-user support(which is mentioned nowhere in the README), you can check yourself whether a user has left the area. Although you can not get a definitive answer like that you can check for example, whether a specific joint or all joints of a user have moved in the last 10-20 osc messages received. That probably means storing the position of this joint in an 10-20 item array and continuously updating while also doing a check on whether the items are different. If all items in the array are the same, your user has not moved a bit and thus probably should not be taken to account.
Last but not least you can switch to other solutions. The one I used about a year ago was "Synapse for Kinect" which also seems stale now. The latest you can use is a Processing library called SimpleOpenNI which definitively have multi-user tracking and you won't need any intermediary programs running to give you the joints.
I hope this helps

Java Swing save and load workspace/settings

I have a Java Swing application that contains a bunch of frames which in turn predominantly contains tables that display large amounts of data. Since it is always a hassle and its time consuming to arrange all windows and tables on startup, I would like to implement 'workspace'-functionality so that the user can save a setup of preference and on startup choose to automatically load the stored workspace to have all windows and tables appear as previously saved. Specifically, the settings that I wish to store in a workspace are:
Active windows (JFrame) and their sizes and positions on screen
Table settings, incl selected columns, column order, column width, sorting, filtering
Does anyone know of a smart and easy way to accomplish this without the obvious, and what seems like a very complex and cumbersome, solution of iterating over all open windows and saving each piece of information with the Preferences api? Thanks
In this case, the obvious solution, java.util.prefs.Preferences, is probably the correct one. RCPrefs from this game is a simple example that demonstrates saving a variety of data types, including enum. The exact implementation is highly dependent on the application. While tedious, it needn't be especially complex. For expedience, the example uses static methods; frame and table preferences are probably worth a class each.

Categories