Page 1 of 1

Scripting

Posted: Sun Jun 14, 2015 11:16 pm
by Charger440
I stated that I was thinking about a very ambitious script project and I think I have run into a road block. The GUI works just fine but I wanted the buttons to start UVK functions. When I add the function names to the button code I get an error message saying there is no Wend statement then the function in the button code actually runs without ever loading the GUI.

I am gonna keep looking but is this even doable Fred?

Re: Scripting

Posted: Mon Jun 15, 2015 1:02 am
by wmmiller
It is not "Can it be done?" but rather, "How can we do it?"

I saw this somewhere. 8-)

Re: Scripting

Posted: Mon Jun 15, 2015 1:34 am
by Charger440
LOL your on a roll today Bill :)
It can be done if it was coded to actually interpret different codes inline.

Re: Scripting

Posted: Mon Jun 15, 2015 1:41 am
by wmmiller
Sorry Jim. I just couldn’t help myself. :lol: I wish I could help you but I can’t.

Re: Scripting

Posted: Mon Jun 15, 2015 10:11 am
by Fred
Jim, I'm actually glad you are putting your script skills into good use.

I can't say for sure without seeing the code but I would guess that either you are not closing the While loop with a WEnd statement, or there's something wrong after While that prevents the script from reaching WEnd.

Re: Scripting

Posted: Mon Jun 15, 2015 10:19 am
by Fred
Just so you know, I moved this topic to the Help and support forum because it is not a tutorial.

Re: Scripting

Posted: Mon Jun 15, 2015 4:58 pm
by Xander
Jim, do you want to post your code (or at least its skeleton) so we can help troubleshoot it? AutoIt GUI isn't my forté but I've done plenty of While/Wend's

Re: Scripting

Posted: Mon Jun 15, 2015 5:15 pm
by Charger440
Xander

While/Wend isn't too bad. What I was trying to do was put "<UpdateJava>" in the while/Wend. If I took that out it worked just fine but if I added it then AutoIT would give an error but Java would update with no interaction....

That should sorta answer Fred's question as well

Re: Scripting

Posted: Mon Jun 15, 2015 5:27 pm
by Fred
Jim, You can't mix AutoIt and UVK script code. You can only add UVK scripting code after the end of your AutoIt script.

Re: Scripting

Posted: Mon Jun 15, 2015 5:33 pm
by Xander
That'll do it. Think of using Autoit scripts within UVK as a Call command. Once you're out, you're out...until you're back in to UVK.

Why have the UpdateJava within the loop anyway? You can only update a single PC once so might as well do it either before or after your loop.

Re: Scripting

Posted: Mon Jun 15, 2015 5:52 pm
by Charger440
Xander I have a feeling Fred knows what I was wanting to, atleast to a limited degree.

I don't want to loop the <UpdateJava>, there would not be much sense in that as you would have just done and it most likely would not have changed. Think outside the box :)

AutoIT from what I can tell is not object oriented so make it wait and see function you want to perform you have to include a While/Wend in it. You also have to put a "Sleep" in there (VB calls it "DoEvents") so that it does not site there grinding resources while it's waiting on you to make a decision. Because I am not sure of Freds feelings on such a thing a thing I am not going to state what my ultimate goal was with that idea. But that should give you better idea of why I was using a while/Wend :)

Re: Scripting

Posted: Mon Jun 15, 2015 5:55 pm
by Xander
Charger440 wrote:Xander I have a feeling Fred knows what I was wanting to, atleast to a limited degree.
I'll just keep my mouth shut then.

Re: Scripting

Posted: Mon Jun 15, 2015 6:00 pm
by Fred
Jim, please do not use Sleep() in the while loop. whoever told you that does not know how it works. AutoIt is already optimized to idle the CPU in message loops.

Re: Scripting

Posted: Mon Jun 15, 2015 6:17 pm
by Charger440
Xander wrote:
Charger440 wrote:Xander I have a feeling Fred knows what I was wanting to, atleast to a limited degree.
I'll just keep my mouth shut then.
Well, I wouldn't quite put it that way. I just meant that I bet Fred knew what I was wanting to do or at least had an idea.

Re: Scripting

Posted: Mon Jun 15, 2015 6:24 pm
by Charger440
Fred wrote:Just so you know, I moved this topic to the Help and support forum because it is not a tutorial.
Fred I can use all the help I can get :)
:lol: