koresho

How to use FileInstall()

13 posts in this topic

I would love to throw a few files into my main executable for distribution, I just can't seem to figure how to use FileInstall().

I have about 600MB worth of programs that need to be included with my script for it to work properly. Right now I have the script on the root, and the programs in @ScriptDir & "\Tools\" and they are handled by executing a self-extracting RAR archive. However if I could bundle it all in the script using FileInstall() and then call the files out that would be awesome.

If that is too much data, I have a couple little batch files I would like to include in the script at least. Any suggestions, maybe a step by step on how to do it? I read the help file but I must be dumb; I can't get it to work.

Thanks in advance.

Share this post


Link to post
Share on other sites



I would love to throw a few files into my main executable for distribution, I just can't seem to figure how to use FileInstall().

I have about 600MB worth of programs that need to be included with my script for it to work properly. Right now I have the script on the root, and the programs in @ScriptDir & "\Tools\" and they are handled by executing a self-extracting RAR archive. However if I could bundle it all in the script using FileInstall() and then call the files out that would be awesome.

If that is too much data, I have a couple little batch files I would like to include in the script at least. Any suggestions, maybe a step by step on how to do it? I read the help file but I must be dumb; I can't get it to work.

Thanks in advance.

FileInstall("C:\original\file\location\on\hard\drive\written\out\completely.exe", @scriptdir & "\bin\completely.exe",1)

The first parameter has to be completly written out. NO VARIABLES. NO MACROS.

The second parameter can contain macros or variables.

The third parameter is opitonal.

1 person likes this

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

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

I've been working with this one as well, and the problem that I ran into is that you need to create the directory before trying to install anything.

failing Example:

CODE

$return = FileInstall("C:\7za\7z.exe", "C:\7za\")

If $return = 0 Then

MsgBox(0, "file install error 1", "Unable to install 7z.exe")

Exit

EndIf

Successful Example

CODE

DirCreate("c:\7za")

$return = FileInstall("C:\7za\7z.exe", "C:\7za\")

If $return = 0 Then

MsgBox(0, "file install error 1", "Unable to install 7z.exe")

Exit

EndIf

Edited by Kerros

Kerros===============================================================How to learn scripting: Figure out enough to be dangerous, then ask for assistance.

Share this post


Link to post
Share on other sites

thanks for the help guys!!

That solves it.

Now the question: Can I FileInstall() 600+ MB worth of programs into my script?

Share this post


Link to post
Share on other sites

Q: How do you code someone eating a whale?

A: One byte at a time.

Ok, horrible parable ... but I think you understand.

The short answer is: Yes.

1 person likes this

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

Share this post


Link to post
Share on other sites

Simple answer:

Yes, but I would have to program it for every damn file, i cant do it for folders or anything right?

Share this post


Link to post
Share on other sites

Simple answer:

Yes, but I would have to program it for every damn file, i cant do it for folders or anything right?

http://www.autoitscript.com/forum/index.ph...c=34805&hl=

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

Simple answer:

Yes, but I would have to program it for every damn file, i cant do it for folders or anything right?

Zip the files into a self extracting exe, fileinstall it and then run it to create the folder structure.


Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Share this post


Link to post
Share on other sites

Ah ha why didnt i think of that?!?

Sweet. Thanks!

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

"Fileinstall " explanation can be tricky  this  was the clearest info so far, that page did it for me. 

 

fileInstall("C:\original\file\location\on\hard\drive\written\out\completely.exe", @scriptdir & "\bin\completely.exe",1)

once i had the basic working , i was able to use relative path. The key is to  use "dirCreate". i know it;s old however still relevant.

Global $sDestination='c:\Installers\EpsonJavaPosAdk\'
DirCreate($sDestination)

FileInstall(".\DataStorage\copyfile2.exe", $sDestination& "copyfile2.exe", 1);===> Modify this path copyfile2.exe


;~DataStorage is a folder within my script directory where the files i want to copy are located

 

Edited by antonioj84
error

Share this post


Link to post
Share on other sites

#12 ·  Posted

The explanation on this thread was the clearest at least to me, and I hope it can help someone else. Simple, i am not looking for any trouble, let me know if i should remove it ?

1 person likes this

Share this post


Link to post
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