Jump to content

Compile from within


Recommended Posts

Is there a way to compile a script from inside?

The issue is I collect data from an external file and write it to another .au3 file that when executed writes the data into a parsed database. This paring cannot be done in the initial file.

Instead of filewrite('data.au3', $dataToParse) is there a way I can do something like Compile('data.au3') or FileWriteCompile('data.exe', $data). The later writing to an invisible .au3 file then parsing it... The crux is they do NOT have the compiler executable. Is there a way to implement the commands within the compiler into the core library? :)

- Orca of Frostmane

I AM ORCA!! A VERY POWERFUL WHALE!!!

Link to comment
Share on other sites

Is there a way to compile a script from inside?

The issue is I collect data from an external file and write it to another .au3 file that when executed writes the data into a parsed database. This paring cannot be done in the initial file.

Instead of filewrite('data.au3', $dataToParse) is there a way I can do something like Compile('data.au3') or FileWriteCompile('data.exe', $data). The later writing to an invisible .au3 file then parsing it... The crux is they do NOT have the compiler executable. Is there a way to implement the commands within the compiler into the core library?  :)

- Orca of Frostmane

<{POST_SNAPBACK}>

you could fileinstall aut2exe and recompile the script.
HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code.
Link to comment
Share on other sites

you could fileinstall aut2exe and recompile the script.

<{POST_SNAPBACK}>

The issue with that is I would need to include the compiler file... That's no good, the file will NOT be available locally when the script is run.

I AM ORCA!! A VERY POWERFUL WHALE!!!

Link to comment
Share on other sites

could you put all the info needed into a .txt file, then have the second compiled file read that? that way you wont need to add to the script, and compile.

just read from a .txt file, best way i can think of to "transfer" variables from one script to another.

i think this is what your talking about... you use alot of big words. :)

Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you.

Link to comment
Share on other sites

could you put all the info needed into a .txt file, then have the second compiled file read that? that way you wont need to add to the script, and compile.

just read from a .txt file, best way i can think of to "transfer" variables from one script to another.

i think this is what your talking about... you use alot of big words. :D

<{POST_SNAPBACK}>

Thankyou for the inspiration :evil:

Two initial files. Reader.exe and Parser.exe

Reader.exe creates the data.au3 file which will be executed to create data.dB.

Parser.exe will have one line: #include "data.au3"

The issue I was having was #include is run on execution, prior to creating the data.au3 file. This way it won't include it until after the file has been created.

:)

I AM ORCA!! A VERY POWERFUL WHALE!!!

Link to comment
Share on other sites

Okay so that doesn't work

When you compile a script the compiler reads all #include "file"s into the comipled stand alone.

Is there a way to execute autoit commands from within a string?

Like

$var = "filewriteline('test.txt', 'text')"
execute($var)

I AM ORCA!! A VERY POWERFUL WHALE!!!

Link to comment
Share on other sites

There is a discussion on this I believe in the Dev forum, the Eval function does this, however, due to security issues with this function, many things will not work in Eval (imagine Eval("FileDelete("C:\")")).

You may want to, for the time being, download precompiled autoti scripts from a webserver or network drive.

Writing AutoIt scripts since

_DateAdd("d", -2, _NowCalcDate())
Link to comment
Share on other sites

Why is it eval() hates really long lines of code? I use StringStripWS($data, 8) prior to calling eval, so everything is on one line... Even when I output $Data to a file, define the writen text as $do and call eval("do") I get an error... Why is this? Okay so with notepad wordwrap it amounts to say 5-6 lines..

I AM ORCA!! A VERY POWERFUL WHALE!!!

Link to comment
Share on other sites

Okay so that doesn't work

When you compile a script the compiler reads all #include "file"s into the comipled stand alone.

<{POST_SNAPBACK}>

I wonder if the new features of the Eval command could be used to do a #Include at runtime. I doubt it though. :)
HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code.
Link to comment
Share on other sites

$do='fileWrite("equip.dB","Head"&Chr(9))fileWrite("equip.dB","14591:0:0:0"&chr(9))fileWrite("equip.dB","ff1eff00"&chr(9))fileWrite("equip.dB","<br>Soulbound<br>Head_Leather<br>90_Armor<br>+4_Strength<br>+11_Agility<br>+8_Stamina<br>Durability_50_/_50<br>Requires_Level_35"&chr(9))fileWrite("equip.dB","Hawkeye*s_Helm"&chr(9))fileWrite("equip.dB","Interface\\Icons\\INV_Helmet_15"&chr(9))'
eval("do")

What is wrong with this code? It doesn't do ANYTHING.

Also if I do eval($do) it runs, but errors.

I AM ORCA!! A VERY POWERFUL WHALE!!!

Link to comment
Share on other sites

The issue with that is I would need to include the compiler file... That's no good, the file will NOT be available locally when the script is run.

<{POST_SNAPBACK}>

FileInstall() ??

Cheers

Kurt

__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Link to comment
Share on other sites

$do='fileWrite("equip.dB","Head"&Chr(9))fileWrite("equip.dB","14591:0:0:0"&chr(9))fileWrite("equip.dB","ff1eff00"&chr(9))fileWrite("equip.dB","<br>Soulbound<br>Head_Leather<br>90_Armor<br>+4_Strength<br>+11_Agility<br>+8_Stamina<br>Durability_50_/_50<br>Requires_Level_35"&chr(9))fileWrite("equip.dB","Hawkeye*s_Helm"&chr(9))fileWrite("equip.dB","Interface\\Icons\\INV_Helmet_15"&chr(9))'
eval("do")

What is wrong with this code? It doesn't do ANYTHING.

Also if I do eval($do) it runs, but errors.

<{POST_SNAPBACK}>

First of all look at this quote from the helpfile

Environment, Files, Dir, Disk, GUI, InputBox, MsgBox, Misc, Network, Obj/COM, Process, Registry, Tray, WinKill implying deletion or modification will not be executed. They will set @error to 9999 and return "".

So FileWrite() won't work. :)

Also if you ever use FileWrite() you could combine all those FileWrite() lines into 1 and replace Chr(9) with the macro @Tab

CODE
FileWrite("equip.dB", "Head" & @TAB & "14591:0:0:0" & @TAB & "ff1eff00" & @TAB & "<br>Soulbound<br>Head_Leather<br>90_Armor<br>+4_Strength<br>+11_Agility<br>+8_Stamina<br>Durability_50_/_50<br>Requires_Level_35" & @TAB & "Hawkeye*s_Helm" & @TAB & "Interface\\Icons\\INV_Helmet_15" & @TAB)
goes about 1.6 times faster than

FileWrite("equip.dB", "Head" & Chr(9))
FileWrite("equip.dB", "14591:0:0:0" & Chr(9))
FileWrite("equip.dB", "ff1eff00" & Chr(9))
FileWrite("equip.dB", "<br>Soulbound<br>Head_Leather<br>90_Armor<br>+4_Strength<br>+11_Agility<br>+8_Stamina<br>Durability_50_/_50<br>Requires_Level_35" & Chr(9))
FileWrite("equip.dB", "Hawkeye*s_Helm" & Chr(9)) 
FileWrite("equip.dB", "Interface\\Icons\\INV_Helmet_15" & Chr(9))

This is mostly becuase it is not opening and closing the file six times but only once.

Edited by SolidSnake
HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code.
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
 Share

  • Recently Browsing   0 members

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