Why position of mouse always take absolute position and colour at position command always return relative colour of window? - automation

I want to take the colour of the window at some position, I had tried to use both absolute position and relative position of the mouse(when the question dialogue box pops up) and with both the arguments of colour position relative true and false but with every condition it always takes the absolute position of mouse and return the colour of the relative window.
color position 762⫽485 relative false
dialog ♥result
As g1ant window is white it returns FFFFFF but my desktop is red.

As you have noticed, the robot is getting the colour of the G1ANT.Robot window and not the desktop. According to the manual:
The color command retrieves the red, green and blue (RGB) color values of the pixel at the specified coordinates
And about the relative argument:
position needs a value representing pixel coordinates and
relative defines if these coordinates are relative to the upper left
corner of the active window (by default) or absolute on the screen
(also measured from its upper left corner).
So absolute position means that wherever the window is, the colour will be get relative to the top left corner of the screen. relative position means that the colour will be get relative to the top left corner of the active window.
In your example it doesn't matter if your desktop is red because, I assume, G1ANT.Robot is focused when you launch your script.
You can either:
Use the WIN+D shortcut which will minimize all opened windows (show desktop):
color position 762⫽485 relative false
keyboard ⋘WIN+D⋙
dialog ♥result
Leave the script as it is but move the G1ANT.Robot window to some position where it doesn't cover the 762⫽485 position that you want to get the colour from.

Related

Colors[4] not showing color selection on Front Panel

I am trying to set the color of an indicator to different colors based on different values, like 1 = red, 2 = blue etc. Using guidance from a Youtube video (accessible using this link: https://www.youtube.com/watch?v=czUmPQmKmGU), I have created a Colors[4] control for the indicator I have after changing it to the "write" function.
The Problem on the front panel is that I am getting a control with numbers instead of a color box where I can select the colors to show based on the value. This was the control I got instead.
This is the control I am trying to achieve (below):
Is there any way that I can get the color box on my control instead of the number controls? I am not sure if it can be changed through a control on the front panel or something but what I have tried so far keeps leading me back to this problem.
Any advice is much appreciated
A color box control is just a U32 number (three bytes for RGB and one which is always 0), which is why that's what you get.
There is a right click plugin which adds a replace with color box option directly to the right click menu of unsigned 32 bit numbers, but I don't remember if it ships with LV or not.
If you don't have that, you can always just right click the indicator inside the cluster, select replace and navigate the palettes to find the color box. You can also copy a color box and then select the indicator and paste, which replaces the selected control.
The color[4] is actually an array of 4 colors (UInt32 as Yair said), that define 2 color gradients, one for the 'Off' state, and the other for the 'On' State of the control.
If you want to set the control's color, you will have to define all 4 of them.

Where does image.expected command search image?

I have downloaded some image from the web and later I am opening that particular image using my robot but when I use image.expected command it gives false always doesn't matter whether I am searching on an absolute window or relative window.
In this robot, at an absolute window would be that particular image when I am using image.expected command i.e. on "relative true" argument it should return true but its giving me false.
♥image = ♥environment⟦USERPROFILE⟧\Desktop\image.png
file.download https://jeremykun.files.wordpress.com/2012/01/img49.png filename ♥image
program ♥image
image.expected ♥image result ♥isPresent relative false
dialog ♥isPresent
By default, it searches in a region equal to the current screen area. You can also specify the coordinates to search in with the screensearcharea argument. Quoting from the manual:
Narrows the search area to a rectangle specified by coordinates in the x0⫽y0⫽x1⫽y1 format, where x0⫽y0 and x1⫽y1 are the pixel coordinates in the top left corner and the bottom right corner of the rectangle, respectively.
Maybe set a few seconds of delay before you image.expected command, it could be that image software is slow to start up.

EaselJS way to change default pivot?

Pivot of stage is set to Left Top corner of canvas but I want Left Bottom corner.
So then up is +y and right is +x
Is this possible?
It is not advisable to transform the stage -- there are some issues with how mouse coordinates are transformed.
Put your contents in a Container instead
Set the coordinates of the container to the stage width/height
Move your contents into negative x/y
If you absolutely must transform your stage, you can set the regX and regY to the stage width/height. It will move the contents, so you will have to counter-position the contents so they display properly.
Hope that helps!

ClickTag banner issues in Flash CS5

I've created some animated as well as static banners in Flash CS5 and I'd like to apply clickTag ActionScript 2.0 code to them. However, I only found tutorials where over all the existing layers, you create a rectangle using the Rectangle Primitive Tool, set the border, fill, and opacity to 0 and then apply the code and export the movie. When I create the rectangle, there is no setting for opacity, and when I set no border and no fill, the rectangle disappears and the dark dot in the timeline becomes empty so I can't click on the rectangle in order to convert it into a symbol.
I would really appreciate any advice on this!
Create your rectangle using 'Rectangle Primitive' tool shapes menu instead of the regular Rectangle tool.
select your rectangle by a single click.
From the properties panel select the bucket symbol (the one used to control the fill color) and you will find a setting 'alpha' for setting the transparency.
change the alpha value to 0. after that remove the stroke.
select your rectangle, from the top menu : Modify > Convert to symbol. give it a name and select 'button' from the dropdown. press ok.
now select the button you just created, open the actions panel and paste the following code :
on (release) {
if (clickTAG.substr(0, 5) == "http:")
{
getURL(clickTAG, "_blank");
}
}

Dynamically set maximum scale of horizontal pointer slide in labview?

I want to make a primitive movie player in Labview. I want the user to be able to load in a movie and have a slider to select frames. As such, I want the range of the slider to go from zero to N where N is the number of frames in the movie.
How do I set the scale of the slider programmatically?
I don't see any inputs to the slider, only one output.
Here is an example of a "Horizontal Pointer Slide" bar taken from the NI Website. The slide bar is in the upper right hand corner of the image.
Right click on the slider:
Create -> Property Node-> Data Entry Limits -> Maximum
Create -> Property Node-> Scale -> Range -> Maximum
This creates property nodes you can wire up to set the maximum limit of the slider.