Jump to content

Include variable or file in compiled script?


Recommended Posts

If i have an compiled script on a pc witch do not have autoit, and i want to "give" that compiled script some varibles it have to remember, or a file it has to include, and keep... is that somehow possible?

Or have a compiled script reading from an ini file, and keep that information it gets..

Any ideas?

Link to comment
Share on other sites

Static variables set on compile time.

Nice idea :)

<{POST_SNAPBACK}>

Well, FileInstall() will bundle any file you tell it into the compiled script and then extract it as needed...so that's one way to make sure a file travels around with your script.

Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Link to comment
Share on other sites

Well, FileInstall() will bundle any file you tell it into the compiled script and then extract it as needed...so that's one way to make sure a file travels around with your script.

<{POST_SNAPBACK}>

Yeah thats true, but thats not what i want..

I want to be able to update that file. Give it new information.. and when the script is compiled, it will only extract files right? not include it again..

Link to comment
Share on other sites

Idea:

- INIWrite the information

- FileInstall the INI file and make it extract to the same location

- Compile the script

- When you run the compiled script on another PC, you can INIRead the file.

Small part of what I'm thinking about (there are probably bugs in it):

Dim $NewInfo
If @Compiled Then
   $NewInfo = INIRead("StaticVals.ini", "Values", "NewInfo", "")
Else
  ;Retrieve info and store it in $NewInfo
   INIWrite("StaticVals.ini", "Values", "NewInfo", $NewInfo)
EndIf
FileInstall("StaticVals.ini", "StaticVals.ini")
Link to comment
Share on other sites

Idea:

- INIWrite the information

- FileInstall the INI file and make it extract to the same location

- Compile the script

- When you run the compiled script on another PC, you can INIRead the file.

Small part of what I'm thinking about (there are probably bugs in it):

Dim $NewInfo
If @Compiled Then
   $NewInfo = INIRead("StaticVals.ini", "Values", "NewInfo", "")
Else
 ;Retrieve info and store it in $NewInfo
   INIWrite("StaticVals.ini", "Values", "NewInfo", $NewInfo)
EndIf
FileInstall("StaticVals.ini", "StaticVals.ini")

<{POST_SNAPBACK}>

Good idea, and then he can use the file to continue to store information if necessary.

My addition would only re-install the .ini if the user deleted it.

Dim $NewInfo
If @Compiled Then
   $NewInfo = INIRead("StaticVals.ini", "Values", "NewInfo", "")
Else
 ;Retrieve info and store it in $NewInfo
   INIWrite("StaticVals.ini", "Values", "NewInfo", $NewInfo)
EndIf
If Not FileExists("C:\staticvals.ini") then; added by Drache
   FileInstall("StaticVals.ini", "StaticVals.ini")
EndIf

Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Link to comment
Share on other sites

Can't really figure this out, or waht to use that for..

Lets say i have a compiled script witch contains:

$ip = 192.168.1.1

msgbox(0,"test",$ip)

Could i somehow change to data if $ip, if its compiled?

Or lets says that the compiled script contains a ini file with these data:

[value]
ip = 192.168.1.1

Could i somehow change that data, so i do not have to compile a new script in order to update that information in the ini file?

An idea if its possible (or actually was what you showed me before):

Could i replace the current ini file in the compile script with a new one, with other data?

Link to comment
Share on other sites

An idea if its possible (or actually was what you showed me before):

Could i replace the current ini file in the compile script with a new one, with other data?

<{POST_SNAPBACK}>

That would be easy

IniRead() the data from a file that's stored on a \\server\share drive that all computers on the network have access to. That way, you could change one file and all the other comps would be updated.

Edited by Blue_Drache

Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Link to comment
Share on other sites

How about saving the values in the registry

Example:

HKEY_LOCAL_MACHINE\SOFTWARE\MyProgram\IPAddress

Have the program read this key. If not found or no value that update the registry with the default 192.168.1.1. If the key is found read in the value. If you need to change the value, deploy an update script that updates the registry.

What instigates the change in the value? Can the script determine that something is different and update the registry itself?

RPC

Link to comment
Share on other sites

deploy an update script that updates the registry

Wouldn't you need to compile the script again?... the thing is, i dont want any external files to follow this compiled script, i have to be a stand alone compiled program, witch you store new data in.. like:

the script know this ip address: 192.168.1.1 witch is stored in the comilped script one way or another..

Now i want to let it use a new address, witch it have to use, without have to compile a new script.. is it impossible to compile a script withot autoit installed?.. or can i somehow include a compiler witch can compile a script...?

Link to comment
Share on other sites

No, I don't think it's posssible to store data in a exe at runtime. That's a good idea tho. It would be nice if a exe had some sort of dynamic memory area to store varibles and stuff.

I wonder if ther is a way to "wrap" an exe so that it could contain a data file.

EDIT: I was thinking maybe you could have a archive like a zip or something where if you double click the zip, it runs the program inside. And you could have a data file inside the zip. But I don't know if it would be possible to write to the data file while it's inside the zip.

tho it could be setup that when the zip is "run", it extracts its contents, does its work then creates a new zip with the new data and erases the old zip.

But then the user would have to have a archive extracter installed on their comp too

Edited by steveR
AutoIt3 online docs Use it... Know it... Live it...MSDN libraryglobal Help and SupportWindows: Just another pane in the glass.
Link to comment
Share on other sites

I'm not sure i understand. If you have data in the ini that you want to use in your program, you just read and write the ini. you don't have to compile a new exe everytime your ini updates.

you would need at least two files, one is your exe. and one is your ini. Or you could use the regitstry to store the data. if you use the registry, you would only need the one file, the exe.

Edited by steveR
AutoIt3 online docs Use it... Know it... Live it...MSDN libraryglobal Help and SupportWindows: Just another pane in the glass.
Link to comment
Share on other sites

Wouldn't you need to compile the script again?... the thing is, i dont want any external files to follow this compiled script, i have to be a stand alone compiled program, witch you store new data in.. like:

the script know this ip address: 192.168.1.1 witch is stored in the comilped script one way or another..

Now i want to let it use a new address, witch it have to use, without have to compile a new script.. is it impossible to compile a script withot autoit installed?.. or can i somehow include a compiler witch can compile a script...?

<{POST_SNAPBACK}>

You wouldn't have to compile every time. Just set up your program so any data that may change is stored in the registry. I you have that exe on 20 comps, and you want to change the data. Then just write one script to update with the new data and send it out
AutoIt3 online docs Use it... Know it... Live it...MSDN libraryglobal Help and SupportWindows: Just another pane in the glass.
Link to comment
Share on other sites

im using larry's dll to connect two computers to each other over WAN and LAN, and there for the client have to know witch ip address to connect to. And the client have to be told witch ip it has to connect to, before the client is send out. This has to be done on a computer without autoit... so i have to somehow tell the client witch ip it is, and then send it..

Link to comment
Share on other sites

So there is two options:

One: The exd file have to read from a txt file or something, store that data, and use it when running on the other computer..

Secound: Ill had to send a package with includes the client, an compiler, and the txt file to read from. But i can't really use any "stand alone" compiler to compile with right?...

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