LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to open a vi at particular x,y position

Hi,
Is it possible to open a vi exe at a particular location on desktop? I also want to store the x,y position when vi is closed so that when the vi is opened again, it opens at last saved location. Please help
0 Kudos
Message 1 of 10
(4,653 Views)
There's a vi property called fp:winbounds that allows you to either read where the vi's window is located on the screen, or set the position. You could save this position to a default location (like a key in an *.ini file) just before the vi closes, and then recall it first thing when the vi starts up. That could do what you want.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
Message 2 of 10
(4,653 Views)
See attached code picture...write the left and top position to a file when quitting, then read it and feed it to the shown code to move the window to the correct position. In this case the code will fit any VI as it finds out the size of the window automatically, but you could put the size in as constants instead. You could also make this a VI with a VI path or name as input to make it work on other windows than that of the VI itself (isntead of using the current VIs path constant).
Message 3 of 10
(4,653 Views)
Hi there,

This might be a hijack, in which case I apologise profusely, especially as
it's my first post here...

Mads wrote in news:5065000000050000003A110100-1042324653000
@exchange.ni.com:

> See attached code picture...

Referring to the little box on the very left, wired in to "Open VI
Reference": What is it?

Thanks!

Andrew
0 Kudos
Message 4 of 10
(4,653 Views)
It a "Current VI's path constant", you can find it on the file palette under constants. It'n not really constant as it will always give the path of the VI it's in...a useful reference. I most often use it to get the path of the directory in which the application that contains the VI is..., if it's in a built application or .llb file you'll need to strip the path twice to get that directory, if it's in a stand alone VI only once...you can find VIs that will do that automatically by detecting whether the VI is in an application or not.

Mads
0 Kudos
Message 5 of 10
(4,653 Views)
Hi again,

Thanks for the reply...

Mads wrote in news:506500000005000000A6110100-1042324653000
@exchange.ni.com:

> It a "Current VI's path constant", you can find it on the file palette
> under constants. It'n not really constant as it will always give the
> path of the VI it's in...a useful reference.

Oh, it's not what I'm looking for then 😞 I've got a complex script parser
which is fully multitasking and re-entrant so I can run multiple scripts in
parallel. (The scripting languauge is just a high level access to some
functions of my program so that non-LVers can still have a degree of
programmability)

Currently every time I call my re-entrant SubVI I have to pass it its own
VI Reference from the Open VI Refere
nce with "prepare for re-entrant" bit
set.

Is there an equivalent constant anywhere "Current VI's VI Reference"? Of
course I can't reference by path, as I can have 20 of the same VI running,
all with their own Reference and execution space. It gets very messy when
my VI calls itself, or I have to pass the reference to other places.

Thanks again,

Andrew
0 Kudos
Message 6 of 10
(4,653 Views)
OpenG Toolkit has a "Current VI's reference" constant...but it's really just a V that use the call chain to get the name of the VI and then feed that into the open reference function (it acceps VI names as well). From how you'r system works that does not seem to be a solution(? post c opy of the relevant parts if possible). How about using VI cloning to get multiple instances of parallell running VIs? Some make the VI clones open references to themselves to allow them to keep running in the background, but in many cases you can just set the autodispose reference property to true when you run them using an invoke node.
0 Kudos
Message 7 of 10
(4,653 Views)
Thanks to all of you for your suggestions.
I am a beginner in LabVIEW. Can anyone provide me link to an example implementing such behaviour.
Thanks in advance,

Gaurav
0 Kudos
Message 8 of 10
(4,653 Views)
> Is there an equivalent constant anywhere "Current VI's VI Reference"? Of
> course I can't reference by path, as I can have 20 of the same VI running,
> all with their own Reference and execution space. It gets very messy when
> my VI calls itself, or I have to pass the reference to other places.
>

Yes there is. The constant is really small, in fact you just don't wire
anything to the property node that has the VI class selected, and it
uses the current VI's refnum.

Greg McKaskle
0 Kudos
Message 9 of 10
(4,653 Views)
Greg,

Greg McKaskle wrote in
news:XbtWa.124157$TJ.7644228@twister.austin.rr.com:

>> Is there an equivalent constant anywhere "Current VI's VI Reference"?

> Yes there is. The constant is really small, in fact you just don't
> wire anything to the property node that has the VI class selected, and
> it uses the current VI's refnum.

That's amazing! It strikes me as a very non-LabView feeling way of doing
things, as I have to create a Property Node then select 'something' to read
from it which I leave unwired, just to wire the "Duplicate VI Reference"
from the Property Node to something else. Shouldn't complain, eh?

Thanks for that. It cleans up my re-entrant VIs no end, and doesn't lo
ok
anywhere near as mind-bending as it did before either.

Cheers,

Andrew
0 Kudos
Message 10 of 10
(4,653 Views)