Jump to content

Extract Resource


 Share

Recommended Posts

Ok is there a way to:

say i saved a text file as a resource or included it using fileinstall() in my 1st program

and i want my 2nd program to edit the content of that text file and update the 1st program with the new text file. Is there a way?

Link to comment
Share on other sites

Ok is there a way to:

say i saved a text file as a resource or included it using fileinstall() in my 1st program

and i want my 2nd program to edit the content of that text file and update the 1st program with the new text file. Is there a way?

No. Rats. Forgot about Zedna's excellent Resources.au3 UDF. In my defense, this is not a native ability of AutoIt, but comes from external use of RESHACKER.EXE, which Zedna has made much easier with his UDF. What Varian proposes below is scripting of what you can do natively in AutoIt -- recompile with the modified files.

:P

Edit: Corrected too-simplistic previous answer.

Edited by PsaltyDS
Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Here is what I did with Portable RoboForm Script that I created.

Here is the relevant code from my scripts

First file, 'Master.exe'

CODE
;Next lines installs Files to compile temp version of this script with updated data

FileInstall('.\Aut2Exe.exe', @TempDir & '\', 1)

FileInstall('.\AutoitSC.bin', @TempDir & '\', 1)

FileInstall('.\upx.exe', @TempDir & '\', 1)

FileInstall('.\Icon.ico', @TempDir & '\', 1)

;Data file that I use

FileInstall('.\Data.rar', @TempDir & '\', 1)

;Installs this script uncompiled so we can later include it as resource

FileInstall('.\master-temp.au3', @TempDir & '\', 1)

;Creates a second copy of master script..this is the one that is compiled

FileCopy(@TempDir & '\master-temp.au3', @TempDir & '\temp.au3', 1)

;Creates a text file to show from where script was run

FileOpen(@TempDir & '\Originating Path.txt', 2)

FileWrite(@TempDir & '\Originating Path.txt', @ScriptFullPath)

FileClose(@TempDir & '\Originating Path.txt')

;Install second program and runs it

FileInstall('.\Slave.exe', @TempDir & '\', 1)

Run(@TempDir & '\Slave.exe', @TempDir)

Second script, 'Slave.exe'

CODE
;Overwrites old Data file

FileMove($Drive & '\Data.rar', @TempDir & '\Data.rar', 1)

_Splash('Please Wait...Saving Changes and Recompiling RoboForm')

;Compiles Master Script, including updated Data file

RunWait(@ScriptDir & '\Aut2Exe.exe /in temp.au3 /comp 4 /icon Icon.ico', @ScriptDir)

;Reads location from which script was run

$Destination = FileRead(@TempDir & '\Originating Path.txt')

;Moves newly compiled script with updated data overwritng old script..maybe add version info later

FileMove(@ScriptDir & '\temp.exe', $Destination, 1)

Hope this gives you ideas of how to solve your problem!

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