Sign in to follow this  
Followers 0
schlitzy

Include file at every startup

8 posts in this topic

I am working on a programm which will be checking an internal database. It is supposed to be started every day with some actions differing slightly.

I would like to leave the programm on the different computers as it is and simply update a seperate file, which the .Exe file is supposed to be reading from (it would contain some variables and user defined functions). That way, the users do not have to have administrative privileges to get the new update.

I was thinking about using the #include, but with that, once the file is in, it is in. So:

1.) How do I include a file at every startup of the .exe?

2.) Is there a way to auto-update this file at every startup of the programm? The file would ideally be on a server and replaces itself on the local pc if there is an update available.

Thanks a lot

s

Share this post


Link to post
Share on other sites



#include should work fine, as long as you don't change the external file's name when you update it. Just add #include <UPDATE FILE HERE> and whenver you update the included file it will use the new stuff in it. As for auto-updating the other file when the exe is started just have some function BEFORE the #include, and it will update before it is included. Shouldn't be too awfully hard? Hopefully this helped?


- Dan [Website]

Share this post


Link to post
Share on other sites

#include should work fine, as long as you don't change the external file's name when you update it. Just add #include <UPDATE FILE HERE> and whenver you update the included file it will use the new stuff in it. As for auto-updating the other file when the exe is started just have some function BEFORE the #include, and it will update before it is included. Shouldn't be too awfully hard? Hopefully this helped?

#include will grab the stuff upon compile, so if he compiles it the thing wont work.

As for downloading, use something like Updates.ini, Use InetGet to download it then check to see if the version in Updates.ini is the same as the version of the client. If the Updates.ini is newer, you would then read the filename from the ini the use another INetGet to grab it.

Share this post


Link to post
Share on other sites

FileInstall() + InetGet() (as Chip suggested) or even FTP.au3 functions may be an option.


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Why do you have to run it compiled? Something I've done before is have the au3 files with the code in them in a folder, but then have a compiled executable with one line in it:

RunWait(@AutoItExe & " /AutoIt3ExecuteScript " & ScriptDir & "\src\myFile.au3")

With judicious use of this technique, registry calls, and some shrewd choices in terms of Run() vs RunWait(), I've been able to set up a subsystem that starts to look a lot like multithreading (as long as nobody opens Task Manager) :)

Edited by sohfeyr

Share this post


Link to post
Share on other sites

For the update. FileInstall () and InetGet() really should work fine. Thanks a lot for that idea. Should have thought of that...

However, to include the file at every startup of the programm, I am not quite convinced by sohfeyr's solution, since I would have more files floating around, a greater CPU usage, an additional process and a whole lot of room for error. Also, the users could possibly retrieve passwords from the uncompiled files.

I had another idea: Is it possible to read from a file (.ini, .dat, .txt, whatever) without having to open it in a seperate window? The Programm would start several times a day. Therefore, I cannot have open windows with code floating around...

Thanks for your help and sorry for my late replies, I am currently travelling and not constantly hooked up to the internet.

s

Share this post


Link to post
Share on other sites

as far as I know when you read ini or such, the file is not actually "opened" in a separate window that you can see. Maybe it's opened in a hidden window, I'm not sure, but I think it just reads the information from the file. Just the simple functions IniRead() and IniWrite() should do the job. The information stored in them is easy to view by whom ever may be using the computer though, so watch out what you store in them.


- Dan [Website]

Share this post


Link to post
Share on other sites

Works great. Thanks.

I am updating the .ini from the server now and read data directly from the file.

Thanks a bunch, guys!

s

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