Jump to content

Making add-ons for an AutoIt program


Recommended Posts

Hi there.

I'm making an IRC chatbot that uses mIRC, and I've come across a problem.

What I figured was: I need to make addons for my bot, so I can easily add functionality.

But #include only takes STRINGS and can't take variables.

Aha, but what if I #include "addons.au3", which has a list of addons?

Well, apparantly, AutoIt needs to compile ALL the scripts, including the addons.

And that isn't really an option.

So, my question is: how could I load in an external function written in AutoIt?

For instance, the function NowPlaying(), ripped from a mIRC library

Func NowPlaying()
 $dll = DllOpen("2latemirc.dll")
 $song = DllCall($dll,"none","MP3Song",   "hwnd",-1,"hwnd",-1,"str","","str","3","int","1","int","1")
 $position = DllCall($dll,"none","MP3Position",   "hwnd",-1,"hwnd",-1,"str","","str","3","int","1","int","1")
 $length = DllCall($dll,"none","MP3Lenght",   "hwnd",-1,"hwnd",-1,"str","","str","3","int","1","int","1")
 ControlSend("mIRC -","",  "Edit1", "Now playing: " & $song[3] & " (" & $position[3] & " / " & $length[3] & ") {ENTER}")
 DllClose($dll)
EndFunc

Please help me and don't yell at me, it's 1:36 am and I'm too tired to use the search button beyond the first page. :)

Edited by knight666
Link to comment
Share on other sites

Form1: AutoIt3.exe [/ErrorStdOut] [/AutoIt3ExecuteScript] file [params ...]
                Execute an AutoIt3 Script File
it's from the help file...

To execute a standard AutoIt Script File 'myscript.au3', use the command:
'AutoIt3.exe myscript.au3'
Edited by alexmadman

Only two things are infinite, the universe and human stupidity, and i'm not sure about the former -Alber EinsteinPractice makes perfect! but nobody's perfect so why practice at all?http://forum.ambrozie.ro

Link to comment
Share on other sites

if i understand you right you want to do something like this:

(this code does NOT work)

CODE

$file = FileFindFirstFile(@ScriptDir & "\Addons\*.au3")

$foundfile = FileFindNextFile($file)

#include "Addons\" & $foundfile

Am i right?

If yes i would go around this by creating a "temporary script".

Create your real script. By running it it checks if thereis a addon folder and if there are files in "/Addons".

If yes. It copys the whole script into /temp/ including the *.au3s from /addons and writes at start of the script "#include youraddonfileau3"

this is ugly but would work for you.

Edited by Kademlia
Link to comment
Share on other sites

How would I write a new line to my already compiled script?

And the problem is: it works when you simply include the scripts, but what if you have an updated version of a function?

You'd have to recompile the script, negating the whole external function thing.

Link to comment
Share on other sites

okay your talking about a compiled one...

i think that would result in writing autoit yourself or including AU3 in your script :)

Aha, but what if I #include "addons.au3", which has a list of addons?

Well, apparantly, AutoIt needs to compile ALL the scripts, including the addons.

Link to comment
Share on other sites

I ment including "Autoit" itself.

to be able to insert scripts.

Edit:

Okay if you realy want to do this i would do it this way:

Make a AU3 script with Fileinstall(Autoit.exe).

Compile to an .exe

By running the *.exe you extract te autoit.exe and your script. then go on with creating the temp...

but this definitely sucks

Edited by Kademlia
Link to comment
Share on other sites

;Here's a sample script to get the idea

#include addonNowPlaying.au3 ;works perfectly, except when you update the .au3, in which case you will have to recompile the program
Run ("AutoIt3.exe addonNowPlaying.au3") ;will run scripts, but won't install user defined functions
Execute('Func Test()' & @CRLF & 'MsgBox(64,"Test.","This is a test.")' & @CRLF & 'EndFunc') ;will not install the function
FileInstall("addonNowPlaying.au3","\Temp\addonNowPlaying.au3") ;from what i can tell this will install the script in some other folder? i don't know how this will help meoÝ÷ Ù«­¢+ÙÕ¹9½ÝA±å¥¹ ¤(ÀÌØí±°ô±±=Á¸ ÅÕ½Ðìɱѵ¥É¹±°ÅÕ½Ðì¤(ÀÌØíͽ¹ô±±
±° ÀÌØí±°°ÅÕ½Ðí¹½¹ÅÕ½Ðì°ÅÕ½Ðí5@ÍM½¹ÅÕ½Ðì°ÅÕ½Ðí¡Ý¹ÅÕ½Ðì°´Ä°ÅÕ½Ðí¡Ý¹ÅÕ½Ðì°´Ä°ÅÕ½ÐíÍÑÈÅÕ½Ðì°ÅÕ½ÐìÅÕ½Ðì°ÅÕ½ÐíÍÑÈÅÕ½Ðì°ÅÕ½ÐìÌÅÕ½Ðì°ÅÕ½Ðí¥¹ÐÅÕ½Ðì°ÅÕ½ÐìÄÅÕ½Ðì°ÅÕ½Ðí¥¹ÐÅÕ½Ðì°ÅÕ½ÐìÄÅÕ½Ðì¤(ÀÌØíÁ½Í¥Ñ¥½¸ô±±
±° ÀÌØí±°°ÅÕ½Ðí¹½¹ÅÕ½Ðì°ÅÕ½Ðí5@ÍA½Í¥Ñ¥½¸ÅÕ½Ðì°ÅÕ½Ðí¡Ý¹ÅÕ½Ðì°´Ä°ÅÕ½Ðí¡Ý¹ÅÕ½Ðì°´Ä°ÅÕ½ÐíÍÑÈÅÕ½Ðì°ÅÕ½ÐìÅÕ½Ðì°ÅÕ½ÐíÍÑÈÅÕ½Ðì°ÅÕ½ÐìÌÅÕ½Ðì°ÅÕ½Ðí¥¹ÐÅÕ½Ðì°ÅÕ½ÐìÄÅÕ½Ðì°ÅÕ½Ðí¥¹ÐÅÕ½Ðì°ÅÕ½ÐìÄÅÕ½Ðì¤(ÀÌØí±¹Ñ ô±±
±° ÀÌØí±°°ÅÕ½Ðí¹½¹ÅÕ½Ðì°ÅÕ½Ðí51¹¡ÐÅÕ½Ðì°ÅÕ½Ðí¡Ý¹ÅÕ½Ðì°´Ä°ÅÕ½Ðí¡Ý¹ÅÕ½Ðì°´Ä°ÅÕ½ÐíÍÑÈÅÕ½Ðì°ÅÕ½ÐìÅÕ½Ðì°ÅÕ½ÐíÍÑÈÅÕ½Ðì°ÅÕ½ÐìÌÅÕ½Ðì°ÅÕ½Ðí¥¹ÐÅÕ½Ðì°ÅÕ½ÐìÄÅÕ½Ðì°ÅÕ½Ðí¥¹ÐÅÕ½Ðì°ÅÕ½ÐìÄÅÕ½Ðì¤(
½¹Ñɽ±M¹ ÅÕ½Ðíµ%I´ÅÕ½Ðì°ÅÕ½ÐìÅÕ½Ðì°ÅÕ½Ðí¥ÐÄÅÕ½Ðì°ÅÕ½Ðí9½ÜÁ±å¥¹èÅÕ½ÐìµÀìÀÌØíͽ¹lÍtµÀìÅÕ½Ðì ÅÕ½ÐìµÀìÀÌØíÁ½Í¥Ñ¥½¹lÍtµÀìÅÕ½Ðì¼ÅÕ½ÐìµÀìÀÌØí±¹Ñ¡lÍtµÀìÅÕ½Ðì¤í9QIôÅÕ½Ðì¤(±±
±½Í ÀÌØí±°¤)¹Õ¹

Nothing works. :)

Link to comment
Share on other sites

if i get your right:

You want a *.exe file that uses *.au3 addons right?

Afaik this is not possible. EXCEPT you do like this:

[pseudocode]

Fileinstall(Autoit.exe)

Fileinstall(yourscript as a *.au3)

SearchforAddons("/addons/") ;(Filefindfirst / filefindnext)

fileopen(yourscript as a *.au3)

fileopen (youtscript_TEMP.tmp)

filewrite (youtscript_TEMP.tmp, "#include " & $foundaddon)

filewrite (yourscript_TEMP.tmp, $code_from_yourscript) ; all the code thats in youscript.au3

fileclose(yourscript_temp.tmp)

rename(yourscript_temp.tmp,yourscript_temp.au3)

run(yourscript_temp.au3); run the *.au3 with the extracted autoit.exe

[/pesudocode]

____

what does it do?:

basically install Autoit and then run *.au3s....

as i said...this sucks big time. but would work

Edited by Kademlia
Link to comment
Share on other sites

  • 2 weeks later...

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
 Share

  • Recently Browsing   0 members

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