Developers Jos Posted July 21 Developers Posted July 21 It are basically 2 simple questions: 1. What is the relationship of your question about cmd file and AutoIt3? 2. Why post your question in this unrelated thread? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
DReffects Posted July 21 Posted July 21 I apologize for this misunderstanding. I probably was not clear enough. I've created a "compiled" .cmd file with the help of the script from page one. It runs perfectly on the machine I've created it with, but does not on different machines. I was hoping for a way to troubleshoot this. I am really new to AutoIT (about 10 hours in) and probably am missing something very basic
Developers Jos Posted July 22 Developers Posted July 22 Thanks for the clarification. Please provide more details about the script that you compiled to cmd, or else we'll only be guessing what could be wrong! SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
DReffects Posted July 22 Posted July 22 Of course! here's the script: expandcollapse popup#Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Icon=..\..\Windows\System32\shell32.dll #AutoIt3Wrapper_Outfile=Markt Altdorf Launchpad - 20270721.exe #AutoIt3Wrapper_UseX64=y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### $Launchpad = GUICreate("Launchpad", 268, 358, -1, -1) GUISetCursor (2) GUISetBkColor(0xFFFFFF) $Citrix = GUICtrlCreateButton("Desktop", 64, 144, 187, 57) GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif") GUICtrlSetCursor (-1, 0) $Pic1 = GUICtrlCreatePic("\\SERVER\Deployment$\Launchpad\logo.jpg", 8, 8, 252, 100) $Version = GUICtrlCreateLabel("Launchpad - Version 0.01 - 2025-07-21", 8, 112, 252, 17) $Rustdesk = GUICtrlCreateButton("Fernwartung", 65, 202, 187, 57) GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif") GUICtrlSetCursor (-1, 0) $Shutdown = GUICtrlCreateButton("Herunterfahren", 65, 261, 187, 57) GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif") GUICtrlSetCursor (-1, 0) $Icon1 = GUICtrlCreateIcon("C:\Windows\System32\shell32.dll", -26, 16, 152, 32, 32) $Icon2 = GUICtrlCreateIcon("C:\Windows\System32\shell32.dll", -136, 16, 215, 32, 32) $Icon3 = GUICtrlCreateIcon("C:\Windows\System32\shell32.dll", -28, 16, 275, 32, 32) $Copyright = GUICtrlCreateLabel("horray", 80, 328, 171, 17) GUICtrlSetFont(-1, 6, 400, 0, "MS Sans Serif") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE ShutdownPC() Exit Case $Citrix Citrix() Case $Rustdesk Rustdesk() Case $Shutdown ShutdownPC() Exit EndSwitch WEnd Func Citrix() Run('C:\Program Files (x86)\Citrix\ICA Client\SelfServicePlugin\SelfService.exe -showAppPicker') EndFunc ;==>Citrix Func Rustdesk() Run('C:\Program Files\RustDesk\RustDesk.exe') EndFunc ;==>Rustdesk Func ShutdownPC() Run('shutdown /s /f /t 0') EndFunc ;==>Shutdown I've then opened the Au3toCmd.au3 file in SciTE 32-bit Version 4.4.6 Mar 16 2021 13:51:55 (the latest one from the download page from autoit) and ran the script by pressing F5. A window pops up and i select my script to be compiled to .cmd The output is being created and then works just fine on the machine i've compiled it with. When I copy it to another device it does not. You can see a black cmd window for a split second and then it closes.
Developers Jos Posted July 22 Developers Posted July 22 Did you install Autoit3 on the other computer? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
DReffects Posted July 22 Posted July 22 44 minutes ago, Jos said: Did you install Autoit3 on the other computer? No. I am under the impression that the Au3toCmd method substitutes the compiled exe, no further dependencies. Is this a misunderstanding on my part?
Developers Jos Posted July 22 Developers Posted July 22 Yes you are right. SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
DReffects Posted July 22 Posted July 22 ohhh Is there an established way on how to install AutoIT via Group Policy or is it possible to specify the path to autoit.exe with it's include-folder within the new cmd file created by Au3toCmd?
Joe22 Posted 13 hours ago Posted 13 hours ago .cmd files created with Au3toCmd.au3 fail to launch if the PC being run on has changed the "Short date" format in Windows. In Windows 10, the setting is found at Settings -> Date & Time -> Date, Time and Regional Formatting -> Change date formats -> Short date. I looked at the source, but don't understand it enough to fix it. It surely has something to do with %date%. Is this an easy fix? Why does it need the date anyway? Temp file?
argumentum Posted 5 hours ago Posted 5 hours ago (edited) expandcollapse popup; this should solve the problem. If you need fancier stuff, you code it. I rather use Inno Setup ( https://jrsoftware.org/isinfo.php ) ; I don't use any of these ( https://www.autoitscript.com/forum/index.php?showtopic=201562&view=findpost&p=1529222 ) Exit example() Func example() Local $sWorkingDir = @ScriptDir & "\Lets Build It Here" DirCreate($sWorkingDir) Local $sBatchFileToMake = "mySelfRunner.cmd" Local $sMyScript = "MyScript.au3" Local $sAutoItExe = StringTrimLeft(@AutoItExe, StringInStr(@AutoItExe, "\", 0, -1)) ; Lets start with a new file FileDelete($sWorkingDir & "\" & $sBatchFileToMake) ; tell the file to goto the start or just runThem if they exist FileWriteLine($sWorkingDir & "\" & $sBatchFileToMake, "@Echo OFF" & @CRLF & _ 'IF EXIST "' & $sAutoItExe & '" ( IF EXIST "' & $sMyScript & '" ( goto runThem ))' & _ @CRLF & 'goto :theStart' & @CRLF & @CRLF) ; this will make a base64 file autoit certutil_Make_b64(@AutoItExe, $sWorkingDir) If @error Then Exit ConsoleWrite(@CRLF & '@@ (' & @ScriptLineNumber & ') : this failed, bye.' & @CRLF & @CRLF) ; this will make a base64 file of your script certutil_Make_b64(@ScriptDir & "\" & $sMyScript, $sWorkingDir) If @error Then Exit ConsoleWrite(@CRLF & '@@ (' & @ScriptLineNumber & ') : this failed, bye.' & @CRLF & @CRLF) ; the 1st file was $sAutoItExe so, lets add it to the *.cmd file FileWriteLine($sWorkingDir & "\" & $sBatchFileToMake, "::filename:" & $sAutoItExe & ".b64" & @CRLF) RunWait(@ComSpec & ' /c type "' & $sWorkingDir & '\' & $sAutoItExe & '.b64" >>"' & $sWorkingDir & '\' & $sBatchFileToMake & '"', $sWorkingDir, @SW_HIDE) FileWriteLine($sWorkingDir & "\" & $sBatchFileToMake, @CRLF) ; add a separator for, the heck of it ; we do the same for the other file(s) FileWriteLine($sWorkingDir & "\" & $sBatchFileToMake, "::filename:" & $sMyScript & ".b64" & @CRLF) RunWait(@ComSpec & ' /c type "' & $sWorkingDir & '\' & $sMyScript & '.b64" >>"' & $sWorkingDir & '\' & $sBatchFileToMake & '"', $sWorkingDir, @SW_HIDE) FileWriteLine($sWorkingDir & "\" & $sBatchFileToMake, @CRLF) ; again, add a separator for, the heck of it ; then we add the chunk of batch that will do the extraction FileWriteLine($sWorkingDir & "\" & $sBatchFileToMake, _extract_b64_batch_chunk() & @CRLF) ; then we add the run/start command, in this case autoit3.exe Au3toCmd(MyPOC).au3 FileWriteLine($sWorkingDir & "\" & $sBatchFileToMake, @CRLF & ':runThem' & @CRLF & _ 'start ' & $sAutoItExe & ' "' & $sMyScript & '"' & @CRLF) ; remove the temp files used to make our *.cmd file FileDelete($sWorkingDir & "\*.b64") ; have fun EndFunc ;==>example Func certutil_Make_b64($sFileIn, $sWorkingDir = "", $iShowFlag = @SW_HIDE) If Not FileGetSize($sFileIn) Then Return SetError(101, 0, 101) Local $sFileOut = StringTrimLeft($sFileIn, StringInStr($sFileIn, "\", 0, -1)) & '.b64' Local $iRet = RunWait(@ComSpec & ' /c certutil -encode -f "' & $sFileIn & '" "' & $sFileOut & '"', $sWorkingDir, $iShowFlag) Return SetError($iRet, 0, $iRet) EndFunc ;==>certutil_Make_b64 Func _extract_b64_batch_chunk() Local $sReturn = "" ; https://www.autoitscript.com/forum/index.php?showtopic=201562&view=findpost&p=1544803 $sReturn &= ':theStart' & @CRLF $sReturn &= 'setlocal EnableDelayedExpansion' & @CRLF $sReturn &= 'set "inputFile=%~dpnx0"' & @CRLF $sReturn &= 'set "inCertBlock=0"' & @CRLF $sReturn &= 'set "outputFile="' & @CRLF $sReturn &= 'set "nextFilename="' & @CRLF $sReturn &= 'set "fileCount=0" REM Initialize fileCount for fallback naming' & @CRLF $sReturn &= '' & @CRLF $sReturn &= 'for /f "usebackq tokens=*" %%a in ("%inputFile%") do (' & @CRLF $sReturn &= ' set "line=%%a"' & @CRLF $sReturn &= ' if "!line:~0,11!"=="::filename:" (' & @CRLF $sReturn &= ' set "nextFilename=!line:~11!"' & @CRLF $sReturn &= ' ) else if "!line!"=="-----BEGIN CERTIFICATE-----" (' & @CRLF $sReturn &= ' if defined nextFilename (' & @CRLF $sReturn &= ' set "outputFile=!nextFilename!"' & @CRLF $sReturn &= ' ) else (' & @CRLF $sReturn &= ' REM Fallback if no filename marker found' & @CRLF $sReturn &= ' set /a fileCount+=1' & @CRLF $sReturn &= ' set "outputFile=file!fileCount!.txt.b64"' & @CRLF $sReturn &= ' echo Warning: No custom filename found for a certificate. Using "!outputFile!" Add this line to display a warning if no custom filename is provided' & @CRLF $sReturn &= ' )' & @CRLF $sReturn &= ' echo -----BEGIN CERTIFICATE----- >> "!outputFile!"' & @CRLF $sReturn &= ' set "inCertBlock=1"' & @CRLF $sReturn &= ' set "nextFilename=" REM Reset for the next certificate' & @CRLF $sReturn &= ' ) else if "!line!"=="-----END CERTIFICATE-----" (' & @CRLF $sReturn &= ' if defined outputFile (' & @CRLF $sReturn &= ' echo -----END CERTIFICATE----- >> "!outputFile!"' & @CRLF $sReturn &= ' set "newFilename=!outputFile:~0,-4%!"' & @CRLF $sReturn &= ' certutil -decode -f "!outputFile!" "!newFilename!"' & @CRLF $sReturn &= ' del "!outputFile!"' & @CRLF $sReturn &= ' )' & @CRLF $sReturn &= ' set "inCertBlock=0"' & @CRLF $sReturn &= ' set "outputFile=" REM Reset output file for next block' & @CRLF $sReturn &= ' ) else (' & @CRLF $sReturn &= ' if !inCertBlock! equ 1 (' & @CRLF $sReturn &= ' if defined outputFile (' & @CRLF $sReturn &= ' echo !line! >> "!outputFile!"' & @CRLF $sReturn &= ' )' & @CRLF $sReturn &= ' )' & @CRLF $sReturn &= ' )' & @CRLF $sReturn &= ')' & @CRLF $sReturn &= '' & @CRLF $sReturn &= 'echo Extraction complete.' & @CRLF $sReturn &= '' & @CRLF $sReturn &= 'endlocal' & @CRLF $sReturn &= '' & @CRLF Return $sReturn EndFunc ;==>batch_rebuilder_chunk And this is my MyScript.au3: MsgBox(262144, @ScriptName, "Am an AutoIt script", 300) Edited 7 minutes ago by argumentum better Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now