Jump to content

Problem using #include


bouzzi
 Share

Recommended Posts

We have built a little script that installs requested network printers with full configuration...

Have an autoIt able to create an autoIt file for each printer:

ex.: PRNT_LEX-T632-0100A.au3

Those files are use in an other autoIt for complete installation...

This AutoIt is the main program in witch I need to find a way to include those printer files...

ex.:

- - - - - - - - - - - - - - - - -

(...)

Dim $IprinterNDPS[2]

Dim $FicInf[2]

Dim $FicInfNmImp[2]

$i = 1

Pro = ProFicDat

$Dest = "Pro"

#include "PRNT_LEX-T632-0100A.au3"

#include "_Make1Dat.au3"

-+-+-+-+-+-+-+-+-

How could I replace "PRNT_LEX-T632-0100A" by a variable?

I have try a lot but did not find the way...

Can you help me..... ? PLZ

_______________________________________[font="Arial"] Bouzzi[/font]Bouzzi@yahoo.comLive From Quebec

Link to comment
Share on other sites

When an AutoIt script is run, one of the very first things is that the #include statements are replaced with the corresponding code. This is before AutoIt looks up any variables.....

What you might be able to do is put the #include inside an IF or SELECT CASE block. This has no benefit performance-wise, but it makes code organization better.

Select
Case $var = "one"
  #include <PRNT_LEX-T632-0100A.au3>
Case $var = "two"
  #include <ANOTHER.au3>
Case $var = "whatever"
  #include <And_so_on.au3>
End Select
Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
Link to comment
Share on other sites

When an AutoIt script is run, one of the very first things is that the #include statements are replaced with the corresponding code.  This is before AutoIt looks up any variables.....

What you might be able to do is put the #include inside an IF or SELECT CASE block.  This has no benefit performance-wise, but it makes code organization better.

Select
Case $var = "one"
  #include <PRNT_LEX-T632-0100A.au3>
Case $var = "two"
  #include <ANOTHER.au3>
Case $var = "whatever"
  #include <And_so_on.au3>
End Select

<{POST_SNAPBACK}>

A line '#include' within a loop? :)

This could show an error, if the included file contains some loop too. :)

Link to comment
Share on other sites

A line '#include' within a loop?  :)

This could show an error, if the included file contains some loop too.  :)

<{POST_SNAPBACK}>

Just make sure two files do not "include" each other ;)

I'd put #include-once at the top of each file just in case....

But you can #include the same file all you want, of course.

Edited by CyberSlug
Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
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...