ExecWith and AutoIT weirdness

sbmk
Beiträge: 21
Registriert: 08 Jun 2016, 09:59

ExecWith and AutoIT weirdness

Beitragvon sbmk » 05 Sep 2018, 18:12

Hello,

I am facing a very strange problem when I try to use AutoIT : the temporary scripts generated with AutoIT directives contain Winst directives in fact, and therefore I get an error on executing it, ruining my installation.

My code is looking like this :

Code: Alles auswählen

KillTask "AutoIt3.exe"
comment "Start autoit setup GENERIC"
ChangeDirectory "%SCRIPTPATH%\sources\Installation_generic"
ExecWith_autoit_install_generic "%SCRIPTPATH%\AutoIt3.exe" WINST /letThemGo /EscapeStrings
DosInAnIcon_install_generic
Sub_check_exitcode
KillTask "AutoIt3.exe"
includelog $AutoitLog$ "500"

KillTask "taskhost.exe"

KillTask "AutoIt3.exe"
comment "Start autoit setup ADDON"
ChangeDirectory "%SCRIPTPATH%\sources\Add_Ons\ADD_ONs\DEA288"
ExecWith_autoit_install_addon "%SCRIPTPATH%\AutoIt3.exe" WINST /letThemGo /EscapeStrings
DosInAnIcon_install_addon
Sub_check_exitcode
KillTask "AutoIt3.exe"
includelog $AutoitLog$ "500"

KillTask "AutoIt3.exe"
comment "Start autoit setup UPDATE"
ChangeDirectory "%SCRIPTPATH%\sources\Upgrade_telecharge"
ExecWith_autoit_install_update "%SCRIPTPATH%\AutoIt3.exe" WINST /letThemGo /EscapeStrings
DosInAnIcon_install_update
Sub_check_exitcode
KillTask "AutoIt3.exe"
includelog $AutoitLog$ "500"

KillTask "taskhost.exe"

Winbatch_set_rights /64Bit
comment "Set file rights"

comment "Create shortcuts"
Files_shortcutsinstall /64Bit
LinkFolder_clean

ExitWindows /Reboot

[DosInAnIcon_install_generic]
install.exe

[DosInAnIcon_install_addon]
NetzschSetup.exe

[DosInAnIcon_install_update]
setup.exe


If I run the whole installation process, I got a popup error from AutoIT like :

Code: Alles auswählen

Line 1 (File "c:\opsi.org\tmp\_opsiscript_Mc12Zt61.cmd")
setup.exe
^ERROR

Error : unknown function name


And indeed, this script contains only one line with "setup.exe"

But sometimes it fails with the first "ExecWith", sometimes with the second.

All I can say is that the wrong script content is the related "DosInAnIcon" content.

"/EscapeStrings" was tried by despair, but the result is the same with or without it.

"AutoIT.Exe" is really in the script directory, I put the latest exe available but the behavior is the same.

is it a parsing problem or am I writing it wrong ?

PS : I assumed "winst32.exe" is guilty so I decided to replace the "opsi-winst" directory on the client machine by the latest stable available on your repository, but the result is the same.

Benutzeravatar
n.wenselowski
Beiträge: 3005
Registriert: 04 Apr 2013, 12:15

Re: ExecWith and AutoIT weirdness

Beitragvon n.wenselowski » 11 Sep 2018, 15:12

Hi,

please show the complete code!

If this is your complete code you are missing the sections Actions (this is important!), ExecWith_autoit_install_generic, ExecWith_autoit_install_addon and ExecWith_autoit_install_update.


Bye

Niko
opsi support - uib gmbh
For productive opsi installations we recommend support contracts.

sbmk
Beiträge: 21
Registriert: 08 Jun 2016, 09:59

Re: ExecWith and AutoIT weirdness

Beitragvon sbmk » 17 Sep 2018, 15:02

It is a very long code, with tons of clicks and inputs to automate with AutoIt, so I only focused of the important parts. Of course the setup file contains the required directives to make everything work :P

The stange thing is that it is working perfectly when I run it manually with Winst GUI and logged as admin.
Is is only faulty when running "for real" with the agent. But I tried the same uninstall/reinstall process on the very same machines without changing anything in the product, and I had one success after a few tries. So the same scripts and directives were translated correctly into AutoIt script and everything was fine.

larsg
Beiträge: 204
Registriert: 16 Dez 2014, 18:06

Re: ExecWith and AutoIT weirdness

Beitragvon larsg » 19 Sep 2018, 13:21

Though, without seeing the whole script it is very difficult to comprehend a part of it.