Jump to content

Linking Scripts/.exe's?


YaBoy
 Share

Recommended Posts

I have 3 scripts. I dont want to put them together, because then things will get sloppy.

I want it so When I click on the first script.. it will do its code then later on it will need the other script to continue. How would I make it say like goto script 2 after script 1 is finished?

Link to comment
Share on other sites

The easiest way would be to compile all three as executables, then simply run the second script just before the first one exits. Then just before the second script exits, tell it to run the third exe script.

You could also look at my External Execute UDF in my signature that allows you to run separate scripts with only one executable. It is a bit more complicated, but you can get a cleaner result. There are many other ways you can do this as well.

-The Kandie Man

"So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire

Link to comment
Share on other sites

By putting your scripts as separate functions?

Main()

;Main
Func Main()
    ;This is the program's entry function
    For $i = 1 to 10
        MsgBox(0, "Within first script", $i)
    Next
    return 0
EndFunc
;Once this function is done lets call the next one
NextScript()
    
Func NextScript()
    For $i = 10 to 1 step-1
        MsgBox(0, "Within second script", $i)
    Next
EndFunc

Im not sure if that is what your asking..

Link to comment
Share on other sites

I just want it so.. I run Script1... it goes down to certain amount of code then it will Run Script2.. some more code.. maybe I want to go back to Script1? Ok.. Script1 goes farther past where I want Script2 to activate.. so I need Script3, it opens Script3.. keeps going and now I need Script1.. opens that at that spot.

Understand?

Link to comment
Share on other sites

Yup, use my External Execute UDF in my signature. Use this function:

_FileAU3Ex($v_filename, $i_startline = 1, $i_endline = 0)

That will run a whole script if you leave the last two parameters blank and then will return to the main script.

"So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire

Link to comment
Share on other sites

Chris I dont think thats what Im looking for.. I have code in the other scripts.. there all in a Folder named Macro

but KandiMan.. how would I use that?

If I have the file name with spaces.. it doesnt work or whatever.. think you could help?

Edited by YaBoy
Link to comment
Share on other sites

Like this:

#include "ExternalExecute.au3";ExternalExecute.au3 has to be in the same directory as this script.

;your stuff here

;do stuff here

;now you want the second script done

_FileAU3Ex("Second Script.au3");the second script has to be in the same directory

;now that the second script has run, it continues here

;now you want to run the third script

_FileAU3Ex("Third Script.au3");this is the third script

;now the third script is done

;the first one now finishes up and exits

"So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire

Link to comment
Share on other sites

Why do I need the External Execute?

If you run the above code without the External Execute UDF library, you will experience great failure. The reason, _FileAU3Ex() is not a function that is built into autoit, i wrote it, therefore you need the included file so that autoit will know what to do when you use that function.

-The Kandie Man

"So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...