Jump to content
genius257

AutoIt Package Manager?

Recommended Posts

genius257

Hello.

So for some time now, I've been thinking about the possibilities with a package manager for AutoIt, like npm for UDF's and such.

I am curious if anyone else would be interested in such a thing, or if it would be useless/problematic in practice?

My personal problem with the idea so far, is the hurdle of legality and hosting options.

Your thought(s) on this matter would be greatly appreciated.

Share this post


Link to post
Share on other sites
Deye

Hi genius257.

I say give it a go if you are ready & willing,  it will surely be interesting to see what you can come up with for this
I was starting it about over here  and then got caught up doing other stuff
personally it can help with the house keeping .. 

There can be 2 versions or ways to go about it :

1. - Doing as I described at the  previous Topic  @ coping the files to @scriptDir

2. - would be to edit the paths for the includes pointing to 1 folder that will be holding all the extras ..

Deye

Share this post


Link to post
Share on other sites
genius257

Hi @Deye.

Thanks for the nice feedback :)

I guess I’ll get started today when I get home from work :)

About the files themselves I considered the "global" installation would download the module to the "Standard library" folder, in most cases that would be the /Include folder in the installation directory. The local installed modules would be in a folder maybe called au3_modules, and would work by adding a relative path to the registry key "Include" in the path "HKEY_CURRENT_USER\Software\AutoIt v3\AutoIt\".

With conflicting versions I see 2 possibilities:

  • Report error and do nothing with the conflict.
  • Parse the package and rename all functions with a version prefix.

I also plan on using this "guide" to get me started on the basic workings of the version management and structure.

Share this post


Link to post
Share on other sites
Deye
Posted (edited)

Hi genius257,

I think the idea of grouping some modules into 7z packages can just make it easy to pull out single specific files as needed
* having something that makes a listing of files of @Scriptdir into an ini - listing all production modules and versions

* Anything that cannot be retrieved by this pack system remains siding the UDF along with its file versions stored in the ini .. 
Then maybe  if there can be some kind of switch for instance #AutoIt3Wrapper_module_Override = y : causing anything in @ScriptDir to gain priority over the installed autoit's lib file modules including the autoit.exe version ..  then it ca make thins even easier ..

One example of what this can be good for : For instance someone posts a UDF with its in_production ini file and you need to quickly test the examples attached without going through the hurdle of inspecting all its script breaking changes future-wise ..
another example is @ offering quick fixes or ways to update older UDFs for instance: https://www.autoitscript.com/forum/topic/167184-winapivhd-udf-winapiex-udf-extension/ ..

btw 
your StringRegExp() doesn't do:

#AutoIt3Wrapper_Res_File_Add=C:\Users\me\Desktop\88x31.jpg, RT_ICON ..


@ what i got so far:

#NoTrayIcon
;Place it inside any module dir you want, Update its path from any other module dir paths by executing it stand alone ..
#pragma compile(Out, Get_au3_modules_Cmd.exe)
#AutoIt3Wrapper_Change2CUI=y
#include <File.au3>
If Not @Compiled Then Exit

If $CmdLine[0] = 0 Then
    $address = 'HKEY_LOCAL_MACHINE\SOFTWARE\Classes\AutoIt3Script\Shell\__Get_module_Copies\Command'
    If Not StringInStr(RegRead($address, ""), @ScriptFullPath) Then
        If Not IsAdmin() Then Exit ShellExecute(@ScriptFullPath, "", @ScriptDir, "runas")
        RegWrite($address, '', 'REG_SZ', '"' & @ScriptFullPath & '" "%1"')
        ConsoleWrite(' a new option called: "__Get_module_Copies)" has been added to the explorer *.au3 RC Context Menu ..' & @CRLF)
        Sleep(5000)
    EndIf
    Exit
EndIf

#include <WinAPIShPath.au3>
$sFile = FileRead($CmdLine[1])
$pattern = '(?(DEFINE) (?<string>(["''''])((?!\2).)*\2))(?:#include ((?&string))|FileInstall\(((?&string))|#AutoIt3Wrapper_Res_[a-zA-Z]+_Add=([^\n]+))'
$aResults = StringRegExp($sFile, $pattern, 3)
For $i = 0 To UBound($aResults) - 1
    If StringLen($aResults[$i]) > 0 Then
        $s = StringRegExpReplace($aResults[$i], '^(["''''])(.*)\1', "$2")
        $sPath = @WorkingDir & "\" & $s
        $sCopyDest = @ScriptDir & "\" & $s
        If FileExists($sCopyDest) Then
            FileCopy($sCopyDest, $sPath, 8)
            If Not @error Then
                ConsoleWrite(_WinAPI_PathCompactPathEx($sPath, 65) & "   -Copied" & @CRLF)
                $sFile = FileRead($sPath)
                $aResults1 = StringRegExp($sFile, $pattern, 3)
                For $j = 0 To UBound($aResults1) - 1
                    If StringLen($aResults1[$j]) > 0 Then
                        $s = StringRegExpReplace($aResults1[$j], '^(["''''])(.*)\1', "$2")
                        $sPath1 = StringLeft($sPath, StringInStr($sPath, "\", "", -1))
                        $sCopyDest = @ScriptDir & StringRight($sPath1, StringInStr($sPath1, "\", "", -2))
                        If FileExists($sCopyDest) Then
                            FileCopy($sCopyDest & $s, $sPath1 & $s, 8)
                            If Not @error Then
                                ConsoleWrite(_WinAPI_PathCompactPathEx($sPath1 & $s, 65) & "   -Copied" & @CRLF)
                            Else
                                ConsoleWrite($sFile & "   not found" & @CRLF)
                            EndIf
                        EndIf
                    EndIf
                Next
            Else
                ConsoleWrite($sFile & "   not found" & @CRLF)
            EndIf
        EndIf
    EndIf
Next

Sleep(2500)

Deye

Edited by Deye

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

×