overdrive Posted July 31, 2023 Share Posted July 31, 2023 Hi, I am having difficulty compiling a bat file with autowrapper. I am using this bat file to invoke autowrapper: @echo off set "AutoIt3Wrapper=..\autoit-v3\install\SciTe\AutoIt3Wrapper\AutoIt3Wrapper.exe" set "input=tools_admin.au3" set "output=tools_admin_compiled.exe" "%AutoIt3Wrapper%" /in "%input%" /out "%output%" /unicode /x64 /nopack pause&exit The 'tools_admin.au3' script has this content: #RequireAdmin #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Icon=..\tools.ico #AutoIt3Wrapper_Res_Language=1034 #AutoIt3Wrapper_OutFile_Type=exe #AutoIt3Wrapper_UseUpx=n #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** ;#AutoIt3Wrapper_Res_requestedExecutionLevel=requireAdministrator Local $sBatFile = "..\tools.bat" Run($sBatFile) The process runs fine, it creates the .exe file and when I run it it looks correct. However, the problem arises if I remove the bat file from its location because it does not run anymore, it is as if it behaves as a caller and the code of the bat file is not compiled inside. I have read the forum and I have asked chatgpt but I can't get the result I am looking for. It is possible that this is a recurring question so I apologize in advance, but I do not know how AutoIt works. If someone could help me I would appreciate it. Link to comment Share on other sites More sharing options...
Developers Jos Posted August 1, 2023 Developers Share Posted August 1, 2023 9 hours ago, overdrive said: However, the problem arises if I remove the bat file from its location because it does not run anymore, it is as if it behaves as a caller and the code of the bat file is not compiled inside. Pl ase give exact details what you change in the batchfile when moving the batchfile, which files you move where and what this output is shown & doesn't work. 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. Link to comment Share on other sites More sharing options...
overdrive Posted August 1, 2023 Author Share Posted August 1, 2023 Thanks for your answer. My goal is to create a standalone executable file, with the code from the bat file embedded. With the method followed in the example I posted, the exe file runs correctly but if I move or rename the bat file configured as source, then the console does not open as it would when running the bat. This makes me think that the bat code is not included in the compiled exe. Link to comment Share on other sites More sharing options...
Developers Jos Posted August 1, 2023 Developers Share Posted August 1, 2023 (edited) I must say I am totally lost now... the shown batch file is used to compile an au3 source file into a au3.exe file, and you state you want to incorporate this in a exe? As stated... give me the specifics what you actually change/move as you can't simply move that batchfile and expect it to work. Edited August 1, 2023 by Jos Andreik 1 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. Link to comment Share on other sites More sharing options...
overdrive Posted August 1, 2023 Author Share Posted August 1, 2023 Surely the lack of understanding arises from my lack of knowledge of how AutoIt works. As they say: a picture is worth 1000 words, so I have made a short video. With AutoIt I am looking for the functionality implemented by software like: bat to exe converter, slimm bat to exe, etc... That is to say to transform a bat file to a compiled exe. As you can see in the video, the exe created by autoit must point to the original bat file included in the au3 file, because when renaming it after having obtained the exe, the console with the menu is no longer displayed. Maybe I am wrong and AutoIt does not offer me what I was looking for, which was to have more configuration flexibility when compiling a bat file to exe. Thank you and sorry if I am confusing you. example.zip Link to comment Share on other sites More sharing options...
Andreik Posted August 1, 2023 Share Posted August 1, 2023 (edited) You definitely don't understand how things works. Why it should run the code from your .bat file if you remove it from the location specified in your AutoIt script? Your .bat file is not included in your executable. All your script make it's to try to run tool.bat from one level up directory. Edited August 1, 2023 by Andreik When the words fail... music speaks. Link to comment Share on other sites More sharing options...
overdrive Posted August 1, 2023 Author Share Posted August 1, 2023 1 hour ago, Andreik said: You definitely don't understand how things works. Why it should run the code from your .bat file if you remove it from the location specified in your AutoIt script? Your .bat file is not included in your executable. All your script make it's to try to run tool.bat from one level up directory. Nor has he said anything that I have not said. So, my initial question is whether it is possible to create an exe file with the bat file included, as a standalone file. At least I think I have been clear on that. Link to comment Share on other sites More sharing options...
Andreik Posted August 1, 2023 Share Posted August 1, 2023 You can use FileInstall() to get the bat inside the exe and put it on the disk (at your desired location) and run at your discretion. Depending on your bat complexity you can parse your file and run it line by line with _RunDos() or Run(). When the words fail... music speaks. Link to comment Share on other sites More sharing options...
Developers Jos Posted August 1, 2023 Developers Share Posted August 1, 2023 Indeed an batch file could be included, like any other file, but its purpose still fails me. 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. Link to comment Share on other sites More sharing options...
overdrive Posted August 1, 2023 Author Share Posted August 1, 2023 33 minutes ago, Jos said: Indeed an batch file could be included, like any other file, but its purpose still fails me. If that's why you don't see the point, I'll explain the reasons why: - Not giving access to the source code - This is a corporate tool to facilitate IT work. - There is nothing malicious in it, I can give you access to the github repo so you can analyse it. The only purpose is to build an administrative tool for a windows corporate image. I understand that they do not trust and may think it is to inject malware but it is not like that at all. If that is a reason not to guide me I understand and you can close the thread. Thank you for your time. Link to comment Share on other sites More sharing options...
Andreik Posted August 1, 2023 Share Posted August 1, 2023 I don't think Jos had in mind that you are working on something malicious but why not do all the work in AutoIt. When the words fail... music speaks. Link to comment Share on other sites More sharing options...
overdrive Posted August 1, 2023 Author Share Posted August 1, 2023 37 minutes ago, Andreik said: I don't think Jos had in mind that you are working on something malicious but why not do all the work in AutoIt. Well, one of the reasons is that I didn't know that I could develop code to work on the windows shell with autoit. Now that I know that, I might consider learning this scripting language, but it's a long-term goal. What he wanted now was immediacy to be able to take the tool to production. In fact, I had already thought about migrating the code to python or java, but this project came up two weeks ago and I haven't even been able to refactor the code. Thank you for your comment. Link to comment Share on other sites More sharing options...
Developers Jos Posted August 1, 2023 Developers Share Posted August 1, 2023 Well let me speak for myself here: I simply do not understand why a build script needs to be incorporated in the end-result compiled au3script as to me its purpose is only to build that exe for distribution. As to the "not wanting to give the source" ... there is much written on that and the bottom line is that the source is not save in a standard compiled script. 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. Link to comment Share on other sites More sharing options...
Solution overdrive Posted August 1, 2023 Author Solution Share Posted August 1, 2023 You may not be using AutoIt for what it was created for...just wanted to know if it could emulate what other software does to create a binary as a distribution tool. This is one of the reasons I asked the question, because I didn't know if I was doing it right, both programmatically and pragmatically. Anyway, this is already underground in a debate outside the origin of the thread. If it's not possible or you don't want it to be, then I'll look for another language to distribute the tool, even if it takes me a little more time. I reiterate it, thanks for your time, at least I can stop hitting myself with AutoIt looking for the solution. All the best. Link to comment Share on other sites More sharing options...
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