LabVIEW - can you use a numeric control as an indicator - labview

I've written LabView code for a locking system.
The lock has a motion timer that relies on input from a numeric control. I've added a script file reader that needs to be able to change that timer value. Using a selector, I can switch between values, but I'd like it to update the value in the control, rather than override it, so that I can see it on the screen.
How can this be accomplished?
This is currently how I switch between the scripted version and the direct numeric input from the control:
So how can I get the script value to update the control box or is that not possible...?

Do you mean something like this? I created a little vi to demonstrate how the control is updated.
In most cases "property nodes" are the way to go. Every control has a lot of different options to chose from and usually if you look through the properties you will find what you're looking for :)
A little hint:
If you want to add "code" to your question so that other users can test it, you can create a .png file. To do this, you need to select the parts of the vi that you want to share, and click on "Edit > Create VI Snippet from Selection". Then you save that generated .png and upload it here as a picture. Then others can drag&drop it into their block diagram.
Important: Check the .png before uploading and make sure that you're not accidentally posting sensitive data of your company.

Related

Strategy for quick icon generation for labview?

Labview programs become difficult to maintain when block diagrams get too big.
Usage of subvis is recommended to avoid this.
By default, every subvi's icon looks the same, except for a number.
I find that the time needed to creating meaningful icons for most subvis exceeds the coding time by far. Even if using existing images instead of that integrated icon editor - first find a suitable one, then I usually have to scale and adapt it.
Even when settling on using just text in the end, the time needed for icon creation still exceeds the time for programming the vi.
I can see the following strategies to avoid wasting time with icon design:
All in one large vi
Not creating relatively simple subvis with less than approx 20 blocks (adjust number with experience)
Just have the default icon everywhere
I do not like any of these. They do not help with maintainability.
It seems there is a trade-off between maintainability and time required for icon design.
How do people with labview experience solve this?
The right way to create VIs anyway.
I would suggest adding all VIs into a single library then change the icon of the lib to one you like and click the Apply Icon To VIs. This will add the Library Icon to all library functions like a template.
Then you can use VI scripting to programmatically add text on VI icon (For ex. VI Name): http://sine.ni.com/nips/cds/view/p/lang/en/nid/209110
I suggest you take a look on this: https://lavag.org/files/file/100-mark-ballas-icon-editor-v24-lv2010/
It will show you how you can write text on a VI's icon programmatically.
Install GOOP Development suite:
In the menu, click:
Tools->GOOP->Create VI Icon...
Then click 'accept'. 95% of the time, this is appropriate.
The other 5% of the time is used to set up headers based on
library/class/folder
Then GDS offers to update the headers for the other member VI's.
The LabVIEW help includes some simple instructions for creating an icon template and then using that template to create an icon for each new VI you create. I really don't see why either of those steps should take you more than about fifteen seconds!
There's certainly no need to be an artist, or take too much trouble over it, to create a VI icon: all that really matters is that each VI icon is:
identifiable as part of your application - this is why to use a template; and
distinguishable from the other VI icons in your application - you can easily do this with a couple of words of text or a glyph from the included set, even if you choose the latter at random.

What is the most efficient way to quickly understand how a complex LabView VI works?

What is the best way to understand a complex LabView VI that controls a motor?
My goal is to control the motor from a joystick.
The wiring diagram shown below allows a LabView user to control the motor from the LabView GUI: move a slider up and down either increasing or decreasing the desired velocity. As the slider's value changes, it is fed into a bunch of math controls and eventually gets converted into a command string for the motor to interpret. This command string, if I understand correctly, is bunch of bytes that get written to the serial port.
Instead of using the LabView GUI to control the motor, I would like to use the joystick.
What is the best way to approach this?
The joystick has pitch,yaw,roll,and throttle. Which one relates best to the velocity of a motor?
The answer to your title "What is the most efficient way to quickly understand how a complex LabView VI works?" is probably to do some combination of the following:
Look at the VI's inputs and outputs to try and understand what they are there for. The label and caption of controls and indicators may be helpful, also right-click to check the description and tip.
As well as controls and indicators, look for other I/O: queues, notifiers, global variables, file read/writes, instrument communications, and for any data storage that persists between calls such as an uninitialised shift register.
Look at the overall structure of the VI to see how it executes, e.g. is it a one-off operation, does it execute different cases depending on some input, does it loop until a certain condition happens, does it use a state machine structure, etc
Break down the VI's structure into smaller pieces that you can understand. You could print the diagram out and annotate it by hand, or add frame decorations and text comments to the diagram to record what you deduce. If the diagram is cluttered or poorly laid out, rearrange it as you go along (use Ctrl-click and drag on the diagram background to add blank space where you need it).
Set probes on key wires and watch them while the VI runs to see what happens
If possible, manually set the VI's controls to example values and run it to see what happens (this may not work if the VI depends on other parts of a program running at the same time)
Write a test wrapper VI that calls the complex VI and supplies it with example data or inputs to see what happens.
To address your specific question about the VI diagram you've posted, I can see various controls for quantities such as Velocity, Position, Amplitude, Max A (amplitude?), Frequency and so on. You need to decide which of these quantities should be controlled by which axis or output of your joystick. Then you need to add code that reads those values from your joystick, and modify the existing code so that the parameters you want to control are supplied by the joystick values instead of the front panel controls. You could probably just put the joystick reading code inside the existing loop, wire the joystick outputs to join up with the wires from the front panel controls you want to replace, and then change the relevant front panel controls to indicators from the right-click menu so that they will show the values you are getting from the joystick.
The best way is to write one from scratch. But you could analyse the code by clicking the Highlight Execution button to display an animation of the block diagram execution when you run the VI, and use probes to check intermediate values. And you probably should also do an on-line course, e.g. LabVIEW Training: Learn LabVIEW in Three or Six Hours
My answer to your third question is "throttle.".

Copy text to an external program, click somewhere on the screen, then save a screenshot

I picked vb.net for this question since it's the only prgramming language I am fairly familair with, but if C++ or something else is more suited for this, I am willing to learn something new.
What I am trying to do is:
Retrieve text from database (this already works in vb.net) and copy it to clipboard
Switch primary screen to the external application I want to work with (example: word or open office)
Emulate key-press Enter
Paste text and hit Enter again
Emulate key-press Ctrl and then emulate a click on a pre-defined spot on the screen (like 500pixels from left, 740pixels from top).
Save screenshot, using a second value from the database as the filename (the naming part should be easy)
Emulate another click on another pre-defined spot
Repeat for next text in database.
I wouldn't know where to start, though. I guess the most important part of what I'm trying to achieve is; switching focus to an external application and emulate keypresses and mouse clicks on it.
use http://www.autohotkey.com/
write a console app to get the value from the database
1 - get autohotkey to run the console app and put the return into the clipboard
then continue as described in your list.

Conditionally control the visibility of a background image in a .NET report (rdlc)

Quick Summary: How can I conditionally control (at run-time) the visibility of a background image in a report using the built in .rdlc report capabilities in .NET (I am using VB).
The Story:
I have a system that creates "certificates". The certificates are created based on a report definition (.rdlc) and displayed as PDF's to the user, they never see the report viewer control. This system has a public test site as well as the live production site. We want to place a water mark image on any of the certificates that are created by the test system. Basically because we don't want someone creating a test certificate and passing it off as a real one. There is a system level flag that is true when the site runs in test mode, I would like to trigger the visibility of the background image that is a watermark ONLY when that variable is TRUE. At this time I am able to pass a report parameter with this test mode variable, but can't find a way to trigger the visibility of the background image.
Please let me know if any more information is need or further clarification.
Thanks.
Well, I figured it out quicker than I expected. The trick in this case was to use an Expression for the BackgroundImage property's value (the source is set to Embedded). In my case it looked something like this:
=iif(Parameters!ShowTestWaterMark.Value, "WatermarkVoid1", nothing)
Where Parameters!ShowTestWaterMark.Value is the parameter of True or False, and the "WatermarkVoid1" was the name of the embedded image.
While this doesn't directly toggle the visibility of the image, it does meet my requirements to only have the image shown in a specific case.

OS X Get highlighted text

I'm interested in writing a plugin for OS X to support multiple operations on highlighted text in the right click context menu. The operations are simple enough that I could write them by myself. I've looked at automator's "Copy to Clipboard" action, but it requires some text input first. The "Get contents of Clipboard" action will make my operations require the highlighted text to first be copied to the clipboard.
So the question is simple: how do I access the system wide highlighted text buffer? Or is this strictly off limits?
Thanks!
There's no such thing as "the system wide highlighted text buffer"; just selecting text doesn't move it to a central location like the clipboard. And since you can have text selected in multiple windows at once, it's not really clear what that would even do.
Have you considered using the services menu? It's specifically designed to allow third party apps to provide operations for users to perform on selected text.