Jump to content

Can a Compiled script car still use #Include Files


Go to solution Solved by Jos,

Recommended Posts

Hello, 

I have a problem using Auto IT.

I use Auto IT to make monitoring screens. Then I start my scripts using Windows Task Scheduler

To easily modify my scripts, I tried to put my variables in another file. So even if the script is complied (in .exe) I can still change some behavior.

I have this line in my auto it file : 

#include  "C:\temp\AutoIt\ConfigVariablesFile.au3"

This Config File is updated automatically after every change I make in a network share.

But the problem is the following

As I read here "https://www.autoitscript.com/autoit3/docs/intro/compiler.htm", the #includes are tokenised,  compressed and encrypted so we don't need them after compiled the file in .exe.

So after I compiled my script, it will not take the data in the config file anymore.

I need my script to still do it.

Do you have an idea ?

Sorry for my awfull english and thank you for reading my post 🙏

 

Link to comment
Share on other sites

  • Developers
  • Solution

Use an INI file and read the info from it when you need to be able to update config variables.
#include is for static code.

Jos

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

Hi @Camille_Feuvrais,

as far as I understand you correct, you want to parameterize your program execution, am I right? I mean, you store values of variables in a separate *.au3 file. When you compile your script, this *.au3 file is already included in the executable and will not be read again. That's your problem, I think.

There are multiple ways/solutions to handle your requirement. One easy way could be, depending on the amount of your variables, to use a simple *.ini file. In this file you store your values of your variables and read it within the runtime of your program. So you can change the *.ini file content every time, like you described by a network share, also in script mode or as compiled program 👍 .

Best regards
Sven

Stay innovative!

Spoiler

🌍 Au3Forums

🎲 AutoIt (en) Cheat Sheet

📊 AutoIt limits/defaults

💎 Code Katas: [...] (comming soon)

🎭 Collection of GitHub users with AutoIt projects

🐞 False-Positives

🔮 Me on GitHub

💬 Opinion about new forum sub category

📑 UDF wiki list

✂ VSCode-AutoItSnippets

📑 WebDriver FAQs

👨‍🏫 WebDriver Tutorial (coming soon)

Link to comment
Share on other sites

Oh, now I saw your post @Jos 😅 . Same idea, nice!

Best regards
Sven

Stay innovative!

Spoiler

🌍 Au3Forums

🎲 AutoIt (en) Cheat Sheet

📊 AutoIt limits/defaults

💎 Code Katas: [...] (comming soon)

🎭 Collection of GitHub users with AutoIt projects

🐞 False-Positives

🔮 Me on GitHub

💬 Opinion about new forum sub category

📑 UDF wiki list

✂ VSCode-AutoItSnippets

📑 WebDriver FAQs

👨‍🏫 WebDriver Tutorial (coming soon)

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