Sign in to follow this  
Followers 0
Sublime

Functions

24 posts in this topic

Ok I now have come across yet another problem I do now know how to conquer :D

How do pause the execution of following calls to functions untill the current one is finished.

If $status1 = 1 Then Call("APP_1")
If $status2 = 1 Then Call("APP_2")
If $status3 = 1 Then Call("APP_3")
If $status4 = 1 Then Call("APP_4")

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

If $status1 = 1 then 
      $rval = APP_1()
            while $rval == ""
             sleep(10)
      wend
endif

not tested...

That should work, just put the, while $rval == "", inbetween each function call.

Edited by CHRIS95219

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Well c the thing is the time it takes is an unknown since it is based on how fast the system is and since its calling the applications installer it cant start the next one untill the previous one is finished. I should of mentioned this in my first post.

Edit: I Actually Had A Idea That Could Work :D

O_o Since my app installers are made in autoit I could have it write an ini that says say section app1 with a value of 1 than use the inireadsection function in my main script on a do untill loop. Would that halt the execution of further calls untill the first one is finished.

Edited by Sublime

Share this post


Link to post
Share on other sites

it does that.. as long as your functions return a value...

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Functions Returning Values... That makes about as much sense to me as well I cant think of a metaphore at this time.

When you go to post code how do you make it so it scrolls.

Edited by Sublime

Share this post


Link to post
Share on other sites

Use AutoIt tags without spacing in tags. It will scroll if is larger then a certain amount of lines.

[ AUTOIT ] [ /AUTOIT ]

or use a CodeBoxwithout spacing in tags, which will always scroll for large amount of lines

[ CODEBOX ] [ /CODEBOX ]

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Functions Returning Values... That makes about as much sense to me as well I cant think of a metaphore at this time.

When you go to post code how do you make it so it scrolls.

are u being serious or sarcastic??

depending on how u used my code, it should work..

those functions.. say this is how the function is..

if $selection = 1 then 
   $rval = APP_1()
      while $rval = ""
         sleep(10)
      wend
EndIf

Func APP_1()
For $i = 1 to 100
 If $i = 50 then Return $i
Next
Return $i
EndFunc
Edited by CHRIS95219

Share this post


Link to post
Share on other sites

Ok I now have come across yet another problem I do now know how to conquer :D

How do pause the execution of following calls to functions untill the current one is finished.

If $status1 = 1 Then Call("APP_1")
If $status2 = 1 Then Call("APP_2")
If $status3 = 1 Then Call("APP_3")
If $status4 = 1 Then Call("APP_4")
Your problem must be elsewhere other then the use of Call(). AutoIt does wait until a function is complete as shown below.

$status1 = 1
$status2 = 1
$status3 = 1
$status4 = 1

If $status1 = 1 Then Call("APP_1")
If $status2 = 1 Then Call("APP_2")
If $status3 = 1 Then Call("APP_3")
If $status4 = 1 Then Call("APP_4")

Func APP_1()
    MsgBox(0, '', 'APP_1')
EndFunc

Func APP_2()
    MsgBox(0, '', 'APP_2')
EndFunc

Func APP_3()
    MsgBox(0, '', 'APP_3')
EndFunc

Func APP_4()
    MsgBox(0, '', 'APP_4')
EndFunc

Share this post


Link to post
Share on other sites

...its calling the applications installer it cant start the next one untill the previous one is finished...

You have no reason to use Call based on the code you have shown. Your problem is probably in your functions. Post one or more of those.

RunWait?


[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

:D it would probably just be easier to post the entire thing

EDIT:

I am perfectionist who doesnt like to share unless it works the way intended so I have removed this untill than :D

Its farely long as you can tell.

Edit:

The reason for having 18 19 and 20 commentd off in all sections is simply for the purpse of adding more later and the templates for adding them are allrdy added.

Edited by Sublime

Share this post


Link to post
Share on other sites

$PID = Run(......
If WinExists( 'Information', 'Thank you for choosing Acrobat Reader!') Then SplashOff()
ProcessWaitClose($PID)


[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

The functions are continuing with delay as you are use Run() with no real blocking method to pause until finished, on some of the functions. It looks like you could use silent install switches perhaps or automate the installs to fullfil your script?

Edit:

Your Gui loop is working hard also for nothing as it is doing all those GuiCtrlReads while idle. You could set a condition on a button press that do it when time to process checkbox states and do the installing routine.

Edited by MHz

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

Yes I understand this its still in a pretty much skeleton like structure. I am just getting the basics for it to work than I will build it up and make it more efficient but at the moment its more of a just get it to work correctly than worry about how it is working.

Also another thing to note about that do until loop is it makes it so I cant play music O_O So that is a deffinate first thing to get fixd when I get around to fixing the codes efficiency. Unless sumone here wants to do it for me O_o

The if thing was just what I was playing with and hasnt work so far didnt mean to post that in there but whatever.

I relize that it is running with no real pauses thats the whole problem O_o it needs to pause b4 on the completion of the function b4 continuing to the next wrather than just doing them all 1 right after another with no wait.

If you copy and paste that into SCITE and run it and make fake little msgboxs for one or 2 of the functions than run it you might c what I am talking about if you cant visualize it.

Anywho this is where I am stuck at.

EDIT:

I AM NO LONGER STUCK WOOHOO :D

It just hit me like a brick wall :P instead of Run(... to use RunWait(...

:D I feal like a dork

Edited by Sublime

Share this post


Link to post
Share on other sites

...It just hit me like a brick wall :D instead of Run(... to use RunWait(...

That is what I mentioned in this post:

http://www.autoitscript.com/forum/index.ph...ndpost&p=192007

until I saw your splash screens in your code - so I posted this:

http://www.autoitscript.com/forum/index.ph...ndpost&p=192020

with ProcessWaitClose you can keep your splash screens

If you just use RunWait, your splash screens will stay up until the install has completed...


[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites

#15 ·  Posted (edited)

Ya they are suppost to :D thats why the run cmds had the @SWHIDE :D its so it gives the effect of a silent install

later on in the developement when I start enhancing things and improving efficiency those splash screens will become guis with progress bars

Edited by Sublime

Share this post


Link to post
Share on other sites

In the code that I saw... A human will have to click Next > Next > ....

Unless you plan on adding switches to the commandline for a silent install - but then there will be no screen to trigger the If win... then splash off.

...happy coding...


[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites

In the code that I saw... A human will have to click Next > Next > ....

Unless you plan on adding switches to the commandline for a silent install - but then there will be no screen to trigger the If win... then splash off.

...happy coding...

ProcessWaitClose() will do it. So long as a spawned process can be an issue, then you can just grab on that spawned one also. The right switches normally make it easy though for silent install.

Share this post


Link to post
Share on other sites

#18 ·  Posted (edited)

lol no no see I dont think you read my previous posts those files that were being run where the auto install scripts for the programs such as below is the autoit script for installing Adobe Acrobat Reader 5.1:

CODE

__init()

Run('AdobeSetup.exe')

WinWaitActive('WinRAR self-extracting archive', '&Destination folder')

Send('{ENTER}')

WinWaitClose('WinRAR self-extracting archive', '&Destination folder')

WinWaitActive('Acrobat Reader 5.1 Setup', 'Welcome to the Reader 5.1 Setup program.')

Send('!n')

WinWaitActive('Choose Destination Location', 'Destination Folder')

Send('!r')

WinWaitActive('Choose Folder', '&Directories:')

Send('C:\Program Files\Adobe\Acrobat 5.0')

Send('{ENTER}')

WinWaitClose('Choose Folder', '&Directories:')

WinWaitActive('Choose Folder', '&Directories:')

Send('!n')

WinWaitActive('Information', 'Thank you for choosing Acrobat Reader!')

Send('{ENTER}')

Func __init()

EndFunc ;==>__init

The If When statement was when I was playing around with code trying to get it to pause leave my splash up than finish stop the splash and go to the next selected function.

It nvr was an official part of the code I had SCITE open and I just CTRL+A than CTRL+C it into here not paying attention that I still had the toy code in there.

I have a script like this for all my app installs :D

That previous script is what is responsible for managing the installs per say and allowing a easy way to check which ones will be installed.

All in all when I am done it will have progress bars auto installs with the options for sound on/off registry tweaks to improve system speed and performance and many other things. And its all automated I also have scripts taht run after this main script finishes installing that restarts the system but before doing so adds the starter for the configuration scripts to run on startup to the registry than wrights what programs are installed in sections in a inifile which than upon system login ( debating whether or not to add autologin system ) it will than launch configure and run the applications.

I am currently the head technician of a small IT company and automating the tasks in which I fix computers that come into our shop would make my job extremely easy. As all our programs would be installed and configured run and have cleaned up the system than there are always the few little things no program can do that I can do in 15mins making my 3hrs of dedicated time to a machine less than 30mins which is well worth the time it is taking to make this script. So far I have been working on it only a day and have made great progress and plan to be finished with it by the end of next week.

When it is all finished and completly done I will than setup cvs repositories for the script to update off of.

Edited by Sublime

Share this post


Link to post
Share on other sites

#19 ·  Posted (edited)

why did you not explain that earlier, doh. :D

you could then run all your Au3 script from your main script. An idea like this may suit, but needs the latest AutoIt beta to execute for the switch usage.

_Install('PathTo\_Adobe.au3')
_Install('PathTo\_Foxit.au3')

Func _Install($script_au3)
    SplashTextOn('Installing', StringLeft($script_au3, 4))
    RunWait(@AutoItExe & ' /AutoIt3ExecuteScript "' & $script_au3 & '"')
    SplashOff()
EndFunc

Only 1 function for all...

:D

Edit:

The StringLeft might be bad to use when using a path to the file as it would look out of place with missing the extension.

Edited by MHz

Share this post


Link to post
Share on other sites

#20 ·  Posted (edited)

I could have but chose not to for 3 reasons

1. for future expandability

2. and for ease of removal in the event we choose to no longer use a specific app

3. It helps me keep track of what is what in the code of the main app. And it is alrdy quite long and having to scroll from the bottom back to the top gets kinda annoying.

And than you gota realize there are 17 app installers I have made and will probably be more l8r on. Also there are several registry tweak scripts and appearance tweak scripts taht I will be puttin into the main.

Edited by Sublime

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0