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

Jump to content


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

How to compile Autoit Script which uses "#include autoit.au3" Trying to write an autoti script for OS installation Rate Topic: -----

#1 User is offline   nice_guy75 

  • Advanced Member
  • PipPipPip
  • 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>


;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.


#2 User is offline   iamtheky 

  • Friend of MSFN
  • PipPipPipPipPip
  • 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


#3 User is offline   nice_guy75 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 406
  • Joined: 07-December 09

Posted 14 December 2011 - 11:44 PM

View Postiamtheky, 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?

#4 User is offline   allen2 

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

Posted 15 December 2011 - 03:24 AM

Yes.

#5 User is offline   nice_guy75 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 406
  • Joined: 07-December 09

Posted 15 December 2011 - 09:37 AM

View Postallen2, 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.

#6 User is offline   Tripredacus 

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

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.

#7 User is offline   nice_guy75 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 406
  • Joined: 07-December 09

Posted 15 December 2011 - 12:18 PM

View PostTripredacus, 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.

#8 User is offline   iamtheky 

  • Friend of MSFN
  • PipPipPipPipPip
  • 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


Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

2 User(s) are reading this topic
0 members, 2 guests, 0 anonymous users



All trademarks mentioned on this page are the property of their respective owners
Copyright © 2001 - 2013 msfn.org
Privacy Policy