Sign in to follow this  
Followers 0
dutCh

AutoIt Installer Core

4 posts in this topic

I proudly present my AutoIt Installer Core for netlogon scripts.

The main goals are ease of use, flexibility and extensibility. And a cool looking, perfect styled source.

Tips for further enhancements are welcome!

Core.au3


[font="Courier New"]C rulez![/font]

Share this post


Link to post
Share on other sites



This really should be in the Example Scripts section. Perhaps a mod/admin will move it. You do have enough posts to post it there yourself however.

Share this post


Link to post
Share on other sites

First off, thanks for taking the time to write this and for sharing it with the community.

Your code isn't documented, so my interpretation of its intended function might be way off:

It appears to be a script "template" in which one must edit the $a &= ', , , , ,' sections with a shortened command structure and syntax.

As a software engineer that uses AutoIt extensively, I can say that templates should be simplified as much as possible to facilitate edits and troubleshooting. The best way to accomplish this would be to restrict the amount of visible code that can be inadvertently altered.

One way to do this would be to declare all of your functions in a separate source file that's included, and keep the editable parts separated.

For example:

#include "Au3InstallerCore.au3"
_A3IC_Startup()

#cs Script commands go here

pc application.exe
dr "C:\Temp\DirToRemove"
x1 whatever
...

#ce

_A3IC_Shutdown()
In this case, you would fill out the comment section, and your _A3IC_Startup() function would read itself (@ScriptFullPath) and parse the commented section to execute your commands. _A3IC_Shutdown() would contain any cleanup routines.

Another way would be to write an interpreter that receives its commands from a separate text file.

The advantage here is that the "script" file would contain nothing but shorthand commands, and all of the logic to parse and process the file is safely contained in a compiled exe.

Other Suggestions:

- Document every function and provide usage instructions.

- Declare every variable at the beginning of the script and use Opt("MustDeclareVars", 1).

- The script will crash if no arguments are used because $CmdLine[1] wouldn't be defined. Check $CmdLine[0] before using $CmdLine[1]. Also, $CmdLine[1] is being used to set $sInstDir, but this variable isn't used anywhere in the code.

Good luck!


[font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font]

Share this post


Link to post
Share on other sites

>>First off, thanks for taking the time to write this and for sharing it with the community.

And thanks to the coders of AutoIt for their powerful tool.

>>Your code isn't documented, so my interpretation of its intended function might be way off:

I think its self explanatory for one how cares.

Features:

- avoid massive redundancy in command list

- variables are evaluated at runtime versus stick in an static array read on program start

- can react on version differences with an offset to WinWait

- simple extensible for special cases

- Debug mode

- Logging

>>It appears to be a script "template" in which one must edit the $a &= ', , , , ,' sections with a shortened command structure and syntax.

Yes. And thats the only lines which must be edited.

>>As a software engineer that uses AutoIt extensively, I can say that templates should be simplified as much as possible to facilitate edits and troubleshooting.

Totaly agree.

>>The best way to accomplish this would be to restrict the amount of visible code that can be inadvertently altered.

The only things must be supplied are clear marked between the dashed lines.

And it's for the AutoIt aware admin. I'd like to think that they know what they do.

>>One way to do this would be to declare all of your functions in a separate source file that's included, and keep the editable parts separated.

Thats seems to me exaggerated. I want the full script on my hand to react on peculiarities. But in most cases simply fill the cmd lines will do it.

>>Another way would be to write an interpreter that receives its commands from a separate text file.

I think thats make things not simpler too.

>>The advantage here is that the "script" file would contain nothing but shorthand commands, and all of the logic to parse and process the file is safely contained in a compiled exe.

I like to have all in one place. Clearly structured in one sole file.

>>Other Suggestions:

>>- Document every function and provide usage instructions.

AutoIt'er grab this instantly. The functions itself are in the docus.

>>- Declare every variable at the beginning of the script and use Opt("MustDeclareVars", 1).

I like this terse coding. And the script is already completed.

>>- The script will crash if no arguments are used because $CmdLine[1] wouldn't be defined. Check $CmdLine[0] before using $CmdLine[1].

Yeep, a real flaw!

If Not $CmdLine[1] Then _Log('No command line param!', 1)  ;won't work

==>

If Not $CmdLine[0] Then _Log('No command line param!', 1)  ;change this

>>Good luck!

Thanks and also for your detailed feedback!


[font="Courier New"]C rulez![/font]

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