Jump to content

AutoIt Beginners Area


Recommended Posts

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)

Link to comment
Share on other sites

  • Developers

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)

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

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]

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...