Jump to content

How to compile Autoit Script which uses "#include autoit.au3"


Recommended Posts

Hi there guys,

I am trying to write an autoit script for pinning shortcuts on the taskbar, as I am unable to pin shortcut on taskbar by <taskbarlinks> <taskbarlinks> in autounattend.xml. Even if I succeed I still wish to know how can I compile an autoit script into exe which uses #include scriptname.au3" function. As it would require "scriptname.au3" and autoit installed as well.

For example, here is my script:

#include <PinToMenu.au3>


;Pin To Taskbar & Start Menu
_PinToMenu(@ProgramFilesDir & "\Internet Explorer\iexplore.exe", 'Task')

When I run this script it actually calls for "pintomenu.au3" if it won't get the file, my script is useless, now I just want to include the commands of pintomenu.au3 in my script itself so that it won't look for pintomenu.au3 file. As I want this for pinning shortcut on the task bar in my unattended installation obviously it won't be having Autoit installed. "pintomenu.au3" is actually comes by default with autoit.

Please guys help me.

Link to comment
Share on other sites


if you have pintomenu.au3 (because that UDF does not come stock with autoit), just copy the contents of that file and paste it to the bottom of yours, then delete the include line.

Unless that was the longest way ever to ask where to find This?

Edited by iamtheky
Link to comment
Share on other sites

if you have pintomenu.au3 (because that UDF does not come stock with autoit), just copy the contents of that file and paste it to the bottom of yours, then delete the include line.

Unless that was the longest way ever to ask where to find This?

Yes I do have that file with me, but what if that file again have some #include functions, do I have to paste contents of those files as well in the bottom of the my script, means below content of pintomenu.au3?

Currently, I am at work place and that file "pintomenu.au3" is in my lappy which is at home. I just want to know if that file again has some #include function so can I do the same with them as well?

Link to comment
Share on other sites

Yes.

Thanks mate, though I didn't use your method but still you really helped me alot. Actually we just have put the au3 file with our script and then compile it (our script) into exe, compiler itself include the commands of au3 file in the exe and it can be executed standalone.

Link to comment
Share on other sites

When you use #include, the compiler looks for the file specified in c:\program files\autoit3\include. So if it isn't there when you compile, it won't be able to include that code. Although, you may find that the compiler gives you an error.

Yeah you are absolutely right, I have experienced that error but when I put that #include au3 file with my file it compiled into exe without any problem and did work standalone as well, even without having installed autoit.

Link to comment
Share on other sites

You can either copy all the functions from the include files into your script manually or let the compiler do it for you, thats all the magic that is happening.

Include files work without path either from the include folder or relative to the script (though keeping them relative is not good practice if you plan to write more than one script).

and exes are supposed to work standalone, it would be ridiculous and useless if everybody had to install autoit and download your specific include files (of which they would have no knowledge), in order to simply run the exe.

http://www.autoitscript.com/autoit3/docs/keywords/include.htm

Edited by iamtheky
Link to comment
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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...