Sign in to follow this  
Followers 0
Timothy J. Suhr

AutoIt Beginners Area

4 posts in this topic

As I am new to AutoIt and am using version 3 I would like to ask if consideration for creating a beginners area on the forum where questions could be asked like:

I have created several scripts and would like to change them together in a single script. If the file names are TS1a.au3, TS1b.au3, TS2.au3, TS3.au3, TS4.au3, TS5.au3, TS6.au3, TS7a.au3, and TS2.au3 how would the code look?

Thank you for your help! B)

Share this post


Link to post
Share on other sites



Like use functions from them in another script? or turn all the files into one big file?

If you just needed functions from them, just use #include <filename.au3> in the top of your script.

If you want to combine them all, you'd have to post the code


---Sparkes.

Share this post


Link to post
Share on other sites

As I am new to AutoIt and am using version 3 I would like to ask if consideration for creating a beginners area on the forum where questions could be asked like:

You are in it ..... B)


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

It is kind of hard to give a specific answer without seeing at least some of the code in each of the files that you wish to combine, but here are some ways to do it.

At the risk of drawing a comment about "driving nails with cars"

http://www.autoitscript.com/forum/index.ph...09entry101509

I'll mention this option to follow:

(Only Im going to assume for the sake of this post - that there are no user defined functions within these TS scripts.)

#include <TS1a.au3>
#include <TS1b.au3>
#include <TS2.au3>
#include <TS3.au3>
#include <TS4.au3>
....
#include <TS7a.au3>
#include <TS2.au3>
The method shown above is not the preferred method, but it will execute the code in each of the files --- in the order listed in your combined file. However, there are problems with using that method it just depends what is in those other scripts. You know, the stuff that I cannot see and must now guess about :-)

To illustrate one simple way that this might not work as desired...

Lets say that TS1a.au3 contained just these few lines of code:

Run("Notepad")
WinWait("Untitled - Notepad")
WinActivate("Untitled - Notepad")
WinWaitActive("Untitled - Notepad")
Send("This is line a.")

Lets say that TS1b.au3 contained just these few lines of code:

Run("Notepad")
WinWait("Untitled - Notepad")
WinActivate("Untitled - Notepad")
WinWaitActive("Untitled - Notepad")
Send("LINE B is now typed.")

Assuming that you wanted both lines...

This is line a.

LINE B is now typed.

typed into one notepad window then code like this:

#include <TS1a.au3>
#include <TS1b.au3>
would result in two copies of notepad running and might not type what you wanted (besides, there is no return or enter to make a new line).

So, another option for combining the scripts into one big script would be to copy/paste the code from each script into one new/big file... then clean it up as needed:

Turn this:

Run("Notepad")
WinWait("Untitled - Notepad")
WinActivate("Untitled - Notepad")
WinWaitActive("Untitled - Notepad")
Send("This is line a.")

Run("Notepad")
WinWait("Untitled - Notepad")
WinActivate("Untitled - Notepad")
WinWaitActive("Untitled - Notepad")
Send("LINE B is now typed.")

Into this:

Run("Notepad")
WinWait("Untitled - Notepad")
WinActivate("Untitled - Notepad")
WinWaitActive("Untitled - Notepad")
Send("This is line a.")
Send("{ENTER}")
Send("LINE B is now typed.")

Clear as mud?

@Valik I really liked the "driving nails with cars" comment. It makes the point and makes me laugh :-)

Edited link several times... :-(

Edited by herewasplato

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

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