Jump to content

DanielRossinsky

Members
  • Posts

    7
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

DanielRossinsky's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. @NIne and @Musashi thanks for pointing this out! I thought that FileInstall should extracts the archives from its help page.
  2. What i'm trying to achieve is to bundle a few folders within the executable script and from what I've read it can be done with: #include <FileConstants.au3> FileInstall(src, dest, $FC_OVERWRITE) I know that src must be a literal string and cant be a variable or macro. However, I also learned that I cant just install a folder but there is a workaround that uses 7zip or winrar so that FileInstall extracts the folder to the desired location (e.g. to dest) so I wend and tried both variants: I zipped a single folder just for testing. I winrared a single folder just for testing. Keep in mind that both the .zip and .rar are the same folder with the same content. The problem I ran into is that FileInstall simply moves the .rar or .zip folder to the desired location but it doesn't extract it! #RequreAdmin #include <FileConstants.au3> Func installESPLibraries() Local Const $sLibrariesPath = @LocalAppDataDir & "\Arduino15\packages\esp32\hardware\esp32\1.0.4\libraries" FileInstall("esp-libraries\ESP32-ADXL345.rar", $sLibrariesPath & "\", $FC_OVERWRITE) EndFunc installESPLibraries() The result I'm left with is that ESP32-ADXL345.rar just gets moved to $sLibrariesPath (so it does kinda work). The result I want is to have ESP32-ADXL345.rar extracted to the same location so that I have only a folder with the name ESP32-ADXL345 without any winrar files. Is there a way to achieve such a thing ? (because i'm sure there is). NOTE: I already did search the forum for such a solution: how to use fileinstall want to bundle my exe foldersfiles embedding images folders in exe However, They all show practical examples with files and none with folders (the third link mentions folders but has no examples) so I am at a loss as to how it should be done. EDIT: Thanks to @Musashi and @Nine for pointing out what I was missing! Also, I would like to add my solution: #RequreAdmin #include <FileConstants.au3> ; Create a local constant string to hold a path to the folder where we will be installing the libraries Local Const $sLibrariesPath = @LocalAppDataDir & "\Arduino15\packages\esp32\hardware\esp32\1.0.4\libraries\" ; Unpack libraries.rar to the path we defined FileInstall("libraries.rar", $sLibrariesPath, $FC_OVERWRITE) ; Run the batch script to extract libraries.rar at the path we defined RunWait("unrar.bat " & $sLibrariesPath & " libraries.rar", "", @SW_HIDE) ; Deletes libraries.rar FileDelete($sLibrariesPath & "libraries.rar") I attached the .bat file I wrote to make it work. The reasoning for this solution is to show how its done cleanly with .rar files as I didn't see anyone do it this way. Hope it helps people in the future! unrar.bat
  3. I can't currently test it. However, its strange because the python installer should use "add to path" making it available on execution because esptool is installed later. I will try your solution. The only problem is its not portable for all users as some may choose a different install directory which is why I wanted to make use of the "add to path" feature in the execution which should work as its done with the python installer making it available in cmd straight after with pip.
  4. I did use RequireAdmin sorry for not adding it in the code above. Also if you look at the unattend.xml I added it does add python to path so there is no need to specify the path and I can simply call "pip install esptool" from cmd with no additional path so it does work.
  5. I've been working for quite a while on an automated installer for python3.8.3 and Thonny3.2.7 and encountered a pretty strange problem - automated python install work perfectly. However using pip to install esptool returns error code 1. The strange thing is if i manually install it after running the python installer it does indeed install correctly (returns 0 instead). The code i was using: Local Const $sInstallerPath = @ScriptDir & "\python-3.8.3.exe" Local $PythonResult = RunWait($sInstallerPath & " /quiet") Local $ESPToolResult = RunWait(@ComSpec & " /c " & "pip install esptool") MsgBox(0, "Installer returns", "Python result: " & $PythonResult & @CRLF & "esptool result: " & $ESPToolResult) Than I thought that maybe python installer fires off multiple processes during installation and tried : Local Const $sInstallerPath = @ScriptDir & "\python-3.8.3.exe" Local $iPID = Run($sInstallerPath & " /quiet") Local $PythonResult = ProcessWaitClose($iPID) Local $ESPToolResult = RunWait(@ComSpec & " /c " & "pip install esptool") MsgBox(0, "Installer returns", "Python result: " & $PythonResult & @CRLF & "esptool result: " & $ESPToolResult) However, The problem still remains. some-why esptool install refuses to be automated with python but if i comment out the python install part it does work ?! (note that i comment it out after the script already installed python and did not manually install it myself). Any idea why this happens ? NOTE: I added the unattend.xml file im using but python.exe was too big - I'm using python3.8.3 for compatibility with thonny and the unattend files makes a minimal install just for thonny to work (target platform esp32 with micopython) unattend.xml
  6. Wow I cant believe i missed that! I feel so dumb for it... I'd like to ask you 2 questions if you have the time: Does this apply to any function with a text parameter ? (From what I understood it does but just want to make sure) Is there a more elegant way to achieve the same result ? like a silent install which closes the installer automatically upon finish ?
  7. Hello! I'm a new member on the forum and pretty new to AutoIt. As a part of my learning i decided to implement an automated installer for python and ran into quite an odd problem - The script tries to close the installer before its finished! #RequireAdmin Func InstallPython() Local Const $sInstallerPath = @ScriptDir & "\python.exe" Run($sInstallerPath) Local $hWnd = WinWait("Python 3.8.3 (32-bit) Setup") ControlCommand($hWnd, "Add &Python 3.8 to PATH", 266, "Check") ControlClick($hWnd, "&Install Now", 1026) WinWait($hWnd, "Setup was successful") WinClose($hWnd) ;For some odd reason this gets called before WinWait finishes EndFunc ;==>InstallPython InstallPython() I've tried other functions like ControlClick on the close button however i get the same result prompting me if i want to cancel the installation behaving as if WinWait is not even there. Heck, I even tried text other than "Setup was successful" using the AutoIt tool and still same result. However, what i did notice is if i remove WinClose than it fixes it partly because we are still stuck with a window we need to close by hand when the goal is to automate the process... Any ideas as to what the problem can be ?
×
×
  • Create New...