El Tipo Posted December 21, 2008 Report Share Posted December 21, 2008 Hello all... I am new to labview I was thinking about adding a password feature to one of my aplications. I build a subVI which I called password, and I tested on a simple VI to see if it worked. I went to the file>VI property of my password subVI and I changed to windows apearence, as well as costomized it. but if i save it, and re-open it again all the costomization i did goes away and i have to re-costomized it. what i want is that if the password is not right the first 2 times it closes the main program, as well as the subvi (i dont like it on top of the main VI) and if the password is right then close the subVI or take it from the top of the main VI and be able to run the main normally. I would like to know if my aproach is the correct one. otherwise give me some advice on how can I do this. thaks for any help. regards : Pedro E. Quote Link to comment
jcarmody Posted December 21, 2008 Report Share Posted December 21, 2008 QUOTE (El Tipo @ Dec 20 2008, 02:41 PM) I went to the file>VI property of my password subVI and I changed to windows apearence, as well as costomized it. but if i save it, and re-open it again all the costomization i did goes away and i have to re-costomized it. I don't know about this...QUOTE what i want is that if the password is not right the first 2 times it closes the main program, as well as the subvi (i dont like it on top of the main VI) and if the password is right then close the subVI or take it from the top of the main VI and be able to run the main normally. I would like to know if my aproach is the correct one. thaks for any help. regards : Pedro E. There are many ways to crack a nut. There's probably not a correct way, only a better way. QUOTE otherwise give me some advice on how can I do this. My way may not be better, FWIW... Let me know if I misunderstood what you were going for. I've never used the Stop function, perhaps someone else could tell us why to use it. I didn't use it in my solution. You made your subVI a little more complicated than it needs to be. Take a look at the attached VI. You didn't need any code in the False case of your main VI; it would have closed anyway. I don't love local variables, but they're easy when you need to do what you did. I didn't like your subVI icon. There's a better way. :thumbup: You may have already planned to get the real password from an external source. It's better than hard-coding it. I'll wait for others to chime in with a BETTER way. LAVA is a good place to be. Here's what I did. Download File:post-7534-1229821372.vi Regards, Jim Quote Link to comment
El Tipo Posted December 22, 2008 Author Report Share Posted December 22, 2008 QUOTE (jcarmody @ Dec 20 2008, 08:09 PM) I don't know about this...There are many ways to crack a nut. There's probably not a correct way, only a better way. My way may not be better, FWIW... Let me know if I misunderstood what you were going for. I've never used the Stop function, perhaps someone else could tell us why to use it. I didn't use it in my solution. You made your subVI a little more complicated than it needs to be. Take a look at the attached VI. You didn't need any code in the False case of your main VI; it would have closed anyway. I don't love local variables, but they're easy when you need to do what you did. I didn't like your subVI icon. There's a http://forums.lavag.org/Mark-Balla-s-Icon-Editor-file56.html' target="_blank">better way. :thumbup: You may have already planned to get the real password from an external source. It's better than hard-coding it. I'll wait for others to chime in with a BETTER way. LAVA is a good place to be. thanks for the reply Jim Those were pretty nice pints you metioned, if it is not too much to ask could you please upload the password VI you made in labview version 8.0 or newer so I can take a look at it. (THIRD BULLET) The reson why I used the stop function was because on the main VI i have an outer while loop that stops only with a stop botton. i tried to OR the false coming of the subVI (either exeded tries, of cancel by user) and the stop button, but since the main couldnt start it would hang. thats why I decided to place a "stop" as soon as i would get a false out of subVI. Also i wanted the subvi to pop as soon as I try to run the main (that I was able to achieve); now in the case of either cancel by user or exeding the tries i wanted both the subvi and main to stop (BUT I WANT THE subvi TO CLOSE i dont want to see it on top of the main). In the case where the password in inputed correctly i want the subvi to desapear and leave the main running (that I was able to achieve). (SEVENTH BULLET) when you said u didnt like the subicon u meant that it could have been done for example pasting a picture instead of actually write something on it? or u meant something else? (EIGHT BULLET) I did not fully understand when you stated that I was planning to get the password from an external source. Am planning to make a final program and make an executable and have some sort of security on it. Again please I am just trying to gain some knowlege and I would really apreciate any help. I am sorry I didnt upload the actual main VI i wanted the password for the first time. regards Pedro E. Quote Link to comment
jcarmody Posted December 22, 2008 Report Share Posted December 22, 2008 QUOTE (El Tipo @ Dec 21 2008, 02:00 AM) thanks for the reply Jim Those were pretty nice pints you metioned, if it is not too much to ask could you please upload the password VI you made in labview version 8.0 or newer so I can take a look at it. version 8.0 Download File:post-7534-1229864301.viQUOTE when you said u didnt like the subicon u meant that it could have been done for example pasting a picture instead of actually write something on it? or u meant something else? I included a link to an icon editor written by one of the LAVA contributors. It's a really neat way to identify your VIs by using colors, categories and text. A bit like you did, but on steroids. QUOTE I did not fully understand when you stated that I was planning to get the password from an external source. Am planning to make a final program and make an executable and have some sort of security on it. I was just suggesting that hard-coding the password into your program means that you'd need to build a new executable in order to change the password. That's fine if you're working on your desktop, but some folks need to release software through their Quality department and can't be modifying software every time a password is compromised (like when a user writes it on the monitor...). QUOTE The reson why I used the stop function was because I've never used that function and I can't recall ever seeing it used. LabVIEW help says this about it: "Before you call this function with a TRUE input, be sure to complete all final tasks for the VI first, such as closing files, setting safe values for devices being controlled, and so on." I brought this up because you probably don't need it. Are you familiar with State Machines? They have advantages over the stacked sequence structure; they're worth learning. (I like the , myself.) Jim Quote Link to comment
El Tipo Posted December 23, 2008 Author Report Share Posted December 23, 2008 thank you very much for your help Jim, the vi you made was far better than mine. Iam looking foward (if you dont mind) to ask you in case I come across any other problem. about the state machines, I do not know much about them, I though the sequence structures were good enough. I have to admit there are many things I need to learn, sometimes I see a piece of code (VI) from one of you guys here in the forum, and there are cases where i keep finding new things, which make me spend so much energy even trying to figure out what they are. I followed you advise and downloaded the JKI State Machine software and installed, the video on it looks good. Once again thanks for the help regards Pedro E. Quote Link to comment
jcarmody Posted December 23, 2008 Report Share Posted December 23, 2008 QUOTE (El Tipo @ Dec 22 2008, 12:35 AM) Iam looking foward (if you dont mind) to ask you in case I come across any other problem.Ask any time. Have fun learning LabVIEW; this forum is full of folks that will help. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.