# MSFN Forum: How to compile Autoit Script which uses "#include autoit.au3" - MSFN Forum

Page 1 of 1

## How to compile Autoit Script which uses "#include autoit.au3" Trying to write an autoti script for OS installation Rate Topic: //<![CDATA[ rating = new ipb.rating( 'topic_rate_', { url: 'http://www.msfn.org/board/index.php?app=forums&module=ajax&section=topics&do=rateTopic&t=154722&md5check=' + ipb.vars['secure_hash'], cur_rating: 0, rated: 0, allow_rate: 0, multi_rate: 1, show_rate_text: true } ); //]]>

### #1nice_guy75

• Group: Members
• Posts: 406
• Joined: 07-December 09

Posted 14 December 2011 - 07:55 PM

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>

```

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.

### #2iamtheky

• Friend of MSFN
• Group: Members
• Posts: 866
• Joined: 11-November 08

Posted 14 December 2011 - 08:05 PM

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?

This post has been edited by iamtheky: 14 December 2011 - 08:06 PM

### #3nice_guy75

• Group: Members
• Posts: 406
• Joined: 07-December 09

Posted 14 December 2011 - 11:44 PM

iamtheky, on 14 December 2011 - 08:05 PM, said:

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?

### #4allen2

• Not really Newbie
• Group: Members
• Posts: 1,734
• Joined: 13-January 06

Posted 15 December 2011 - 03:24 AM

Yes.

### #5nice_guy75

• Group: Members
• Posts: 406
• Joined: 07-December 09

Posted 15 December 2011 - 09:37 AM

allen2, on 15 December 2011 - 03:24 AM, said:

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.

### #6Tripredacus

• K-Mart-ian Legend
• Group: Super Moderator
• Posts: 8,669
• Joined: 28-April 06
• OS:Server 2012
• Country:

Posted 15 December 2011 - 09:41 AM

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.

### #7nice_guy75

• Group: Members
• Posts: 406
• Joined: 07-December 09

Posted 15 December 2011 - 12:18 PM

Tripredacus, on 15 December 2011 - 09:41 AM, said:

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.

### #8iamtheky

• Friend of MSFN
• Group: Members
• Posts: 866
• Joined: 11-November 08

Posted 15 December 2011 - 12:46 PM

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.autoitscr...rds/include.htm

This post has been edited by iamtheky: 15 December 2011 - 12:47 PM