Jump to content
r2du-soft

Invalid FileInstall() function

Recommended Posts

Posted (edited)

hello

i want create i installer, my installer script create a main installer and i want create more that 1 out put from that script

i a part of my installer in base section i have:

;-----------------------------------------------------
;#Local Variables
    Local $FileName
    Local $Check_EE
;-----------------------------------------------------

;-----------------------------------------------------
$Check_EE = "A"
;---
IF $Check_EE == "A" Then
    $FileName = "A.exe"
ElseIF $Check_EE == "B" Then
    $FileName = "B.exe"
ElseIF $Check_EE == "C" Then
    $FileName = "C.exe"
EndIF
;---
FileInstall (@ScriptDir & "\Files\" & $FileName, @TempDir & "\" & $FileName, 1)
;-----------------------------------------------------

in each compile i want change the $Check_EE value manually and compile manually

but i encounter the following error

2020-03-29_2-47-56.bmp

i know this error is from using variable in FileInstall function: $FileName

 

also i try this:

;-----------------------------------------------------
;#Local Variables
    Local $FileName
    Local $Check_EE
;-----------------------------------------------------

;-----------------------------------------------------
$Check_EE = "B"
;---
IF $Check_EE == "A" Then
    FileInstall (@ScriptDir & "\Files\A.exe", @TempDir & "\" & $FileName, 1)
ElseIF $Check_EE == "B" Then
    FileInstall (@ScriptDir & "\Files\B.exe", @TempDir & "\" & $FileName, 1)
ElseIF $Check_EE == "C" Then
    FileInstall (@ScriptDir & "\Files\C.exe", @TempDir & "\" & $FileName, 1)
EndIF
;-----------------------------------------------------

but in fisrt compile all exe files include in my installer.exe and here the main problem with which I encounter is my installer.exe file size. OutPut file size...

Actually A.exe and B.exe also C.exe file size is more 100MB for each file.

The only solution that I came to it create some one script file and use once FileInstall in each script file...

I need to do one of the above steps and i dont know how can!????

really thanks

Edited by r2du-soft

Share this post


Link to post
Share on other sites
;-----------------------------------------------------
;#Local Variables
    Local $FileName
    Local $Check_EE
;-----------------------------------------------------

;-----------------------------------------------------
$Check_EE = "A"
;---
IF $Check_EE == "A" Then
    $FileName = "A.exe"
ElseIF $Check_EE == "B" Then
    $FileName = "B.exe"
ElseIF $Check_EE == "C" Then
    $FileName = "C.exe"
EndIF
;---
FileInstall (".\Files\" & $FileName, @TempDir & "\" & $FileName, 1)
;-----------------------------------------------------

 

 

 

Actually i want use variable $FileName in FileInstall

2020-03-29_4-32-56.bmp

 

Share this post


Link to post
Share on other sites

you can, but not like that

;-----------------------------------------------------
;#Local Variables
    Local $Check_EE
;-----------------------------------------------------

;-----------------------------------------------------
$Check_EE = "A"
;---
IF $Check_EE == "A" Then
    assign("filename" , "A.exe")
ElseIF $Check_EE == "B" Then
    assign("filename" , "B.exe")
ElseIF $Check_EE == "C" Then
    assign("filename" , "B.exe")
EndIF
;---
FileInstall (@ScriptDir & "\" & eval("filename"), @ScriptDir & "\test\" & eval("filename"), 1)

 


,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Share this post


Link to post
Share on other sites
Posted (edited)
On 3/29/2020 at 4:55 AM, iamtheky said:

you can, but not like that

;-----------------------------------------------------
;#Local Variables
    Local $Check_EE
;-----------------------------------------------------

;-----------------------------------------------------
$Check_EE = "A"
;---
IF $Check_EE == "A" Then
    assign("filename" , "A.exe")
ElseIF $Check_EE == "B" Then
    assign("filename" , "B.exe")
ElseIF $Check_EE == "C" Then
    assign("filename" , "B.exe")
EndIF
;---
FileInstall (@ScriptDir & "\" & eval("filename"), @ScriptDir & "\test\" & eval("filename"), 1)

  

when compiling display error Invalid FileInstall() Function

😌

Edited by r2du-soft

Share this post


Link to post
Share on other sites
Posted (edited)

wrapping shit in execute like this doesnt work either, it gets past the compiler but the resulting script fails.  This might entertain while we find a fun way to pull it off without too much maneuvering.

*Also, i feel that there is a long thread on this topic somewhere on the forum, but i cant find it yet.

ftr, gets past compiler, does not work once compiled:

;-----------------------------------------------------
;#Local Variables
    Local $Check_EE
;-----------------------------------------------------

;-----------------------------------------------------
$Check_EE = "A"
;---
IF $Check_EE == "A" Then
    assign("filename" , "A.exe")
ElseIF $Check_EE == "B" Then
    assign("filename" , "B.exe")
ElseIF $Check_EE == "C" Then
    assign("filename" , "B.exe")
EndIF
;---
execute('FileInstall (@ScriptDir & "\" & eval("filename"), @ScriptDir & "\test\" & eval("filename"), 1)')

 

Edited by iamtheky

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Share this post


Link to post
Share on other sites

There is no way to use a variable in a fileinstall as the source file except as noted in the help file. Any other method that requires the script to interpret the variable will fail every single time. There is NO way for the compiler to know what the variable contains at compile time, it's not running the script it's just compiling. You should stop trying to figure out a way to circumvent this because every effort will fail and you'll be wasting your time. Unless you're bored and need to try and hack the compiler in your free time.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites
4 minutes ago, BrewManNH said:

Unless you're bored and need to try and hack the compiler in your free time.

... and even then: How would the logic need to be ? 

Jos


SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

I couldn't tell you, I don't push stones up hill all day when bored.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

I've glanced at this thread but really would like the OP to state what needs to be the behaviour of the FileInstall when the compiled EXE is copied to another place or computer.

Jos


SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
Posted (edited)

- If you can F5 it you can make it happen on the target.   Boredom made me give the question a plausible backstory like a server building custom deploys.  Asking if that's the optimal way to gather/stage files is what I would do if I wasnt stuck in quarantine, instead I am going to spend a couple of days to relearn all the fun ways to write droppers. 

- At worst, you have all the information at the end of that function to have the script write the line into a separate au3 on the fly and fire it.

And you find 1 or both of those to be Sisyphean?  I don’t see this ending with “you can’t” so much as in a sea of workarounds.

 

 

 

Edited by Melba23
the font is totally stuck like that - No it was not!

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Share this post


Link to post
Share on other sites
1 hour ago, iamtheky said:

At worst, you have all the information at the end of that function to have the script write the line into a separate au3 on the fly and fire it.

I'm not sure what you're saying here, what's writing the file and what's firing that file, and what does that file eventually do?


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

@iamtheky,

Though you weren't the OP so why are you replying with this total off the wall story?
Maybe either let the OP respond with their true goal here or else simply state what it is you are trying as I no idea what you are trying to say in your last post.

Jos

 

 


SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
Posted (edited)

Based off CheckEE creates a custom exe that fileinstalls only the payload assigned to the variable 'filename'.  Some of it unnecessary, Rube Goldberg style.  

;~ ;-----------------------------------------------------
;#Local Variables
    Local $Check_EE
;~ ;-----------------------------------------------------

;~ ;-----------------------------------------------------
$Check_EE = "A"
;---
IF $Check_EE == "A" Then
    assign("filename" , "A.exe")
ElseIF $Check_EE == "B" Then
    assign("filename" , "B.exe")
ElseIF $Check_EE == "C" Then
    assign("filename" , "B.exe")
EndIF
;---

$tgtfile = "testfileinstall_writeonfly_" & $Check_EE   ; file name based off result of If

FileWrite($tgtfile & ".au3" , 'FileInstall("' & @ScriptDir & '\' & eval("filename") & '", "' & @ScriptDir & '\test\' & eval("filename") & '")') ; Write the au3 that does the thing you want

runwait("cmd /c " & FileGetShortName(@ProgramFilesDir) & "\AutoIt3\Aut2Exe\Aut2exe.exe /in " & @ScriptDir & "\" & $tgtfile & ".au3")  ; compiles that au3 to an exe of the same name in the same dir

;~ run(@ScriptDir & "\" & $tgtfile & ".exe") ; runs that exe

 

Edited by iamtheky

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Share this post


Link to post
Share on other sites
Posted (edited)
15 minutes ago, iamtheky said:
;~ ;-----------------------------------------------------
;#Local Variables
    Local $Check_EE
;~ ;-----------------------------------------------------

;~ ;-----------------------------------------------------
$Check_EE = "A"
;---
IF $Check_EE == "A" Then
    assign("filename" , "A.exe")
ElseIF $Check_EE == "B" Then
    assign("filename" , "B.exe")
ElseIF $Check_EE == "C" Then
    assign("filename" , "B.exe")
EndIF
;---

$tgtfile = "testfileinstall_writeonfly_" & $Check_EE   ; file name based off result of If

FileWrite($tgtfile & ".au3" , 'FileInstall("' & @ScriptDir & '\' & eval("filename") & '", "' & @ScriptDir & '\test\' & eval("filename") & '")') ; Write the au3 that does the thing you want

runwait("cmd /c " & FileGetShortName(@ProgramFilesDir) & "\AutoIt3\Aut2Exe\Aut2exe.exe /in " & @ScriptDir & "\" & $tgtfile & ".au3")  ; compiles that au3 to an exe of the same name in the same dir

;~ run(@ScriptDir & "\" & $tgtfile & ".exe") ; runs that exe

 

 

15 minutes ago, iamtheky said:

Based off CheckEE creates a custom exe that fileinstalls only the payload assigned to the variable 'filename'.  Some of it unnecessary, Rube Goldberg style.  

this is similar to something i used to do with one of my projects, it had a separate compiler script that would do my "if" checks then choose from pre-made scripts based on results then compile them.

i like this idea of the compiler script writing the .au3 file from scratch using variables.

Edited by alienclone

If @error Then
    MsgBox(262192, "", @ComputerName & " slaps " & @UserName & " around a bit with a large trout!")
    EndIf

"Yeah yeah patience, how long will that take?"  -Ed Gruberman

REAL search results

Share this post


Link to post
Share on other sites
Posted (edited)

@iamtheky, (and others!)

Could you please stop polluting this thread with these off-topic scripts and give the OP time to state what they really wants to accomplish?

@r2du-soft, Please indicate what you want to accomplish with the FileInstall() that isn't working yet.

 

Thanks,
Jos

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...