Jump to content
Sign in to follow this  
Doctorkirk

FileInstall

Recommended Posts

Doctorkirk

Hi Guys, i was trying to make a "Installation Wizard" but, i can't make FileInstall works... Here's my code, what the hell am I doing wrong? :unsure:

#include <GuiConstantsEx.au3>
#RequireAdmin


$Gui = GUICreate("Installazione",500,200)
$Input = GUICtrlCreateInput (@ProgramFilesDir&"\PassMan",100,70,200,20)
$Browse = Guictrlcreatebutton("Sfoglia...",390,70)
$Cancel = GUICtrlCreateButton("Annulla",100,150)
$Install = GUICtrlCreateButton("Installa",300,150)
GUISetState ()

While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
Exit
Case $Browse
$FolderSelect = FileSelectFolder("Scegli una destinazione...","",7)
GUICtrlCreateInput ($FolderSelect,100,70,200,20)
Case $Cancel
Exit
Case $Install
$rInput = GUICtrlRead($Input)
FileInstall("PassMan 1.0.exe",$FolderSelect)
FileInstall("config.ini",$FolderSelect)
FileInstall("My_Bank.pmb",$FolderSelect)
EndSwitch
WEnd
Edited by Doctorkirk

Share this post


Link to post
Share on other sites
BrewManNH

$FolderSelect is a folder, you have to pass a folder and file name to FileInstall, you can't use just a folder name.

BTW, why are you creating an Input control with the contents of the $FolderSelect variable as the default value, are you changing it there? Further down the script, you're getting the the value inside an input control but you're not using it anywhere.

Are the files you're using with FileInstall in the same folder as your script? Because you're using a file name with no path information.

Edited by BrewManNH

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
LarryDalooza

$FolderSelect is a folder, you have to pass a folder and file name to FileInstall, you can't use just a folder name.

from help file...

"The destination path of the file with trailing backslash if only the directory is used."


f_mrcleansmalm_77ce002.jpgAutoIt has helped make me wealthy

Share this post


Link to post
Share on other sites
BrewManNH

Thanks for the correction, been a while since I've looked at that one. :)

Now that I have been corrected, I can correct the OP with that information. FileSelectFolder doesn't return the folder name with the trailing backslash, so if you need C:Temp, you're going to have to append the backslash on to $FolderSelect like this:

$FolderSelect = FileSelectFolder("Scegli una destinazione...","",7)
$FolderSelect &= "\"

Edited by BrewManNH

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
Doctorkirk

$FolderSelect is a folder, you have to pass a folder and file name to FileInstall, you can't use just a folder name.

What an idiot, i forgot to put the file name! ahaha Thanks BrewMan you just save me! :P

BTW, why are you creating an Input control with the contents of the $FolderSelect variable as the default value, are you changing it there?

Yes, i'm changing it, i wanna show the selected folder in the Input.

Further down the script, you're getting the value inside an input control but you're not using it anywhere.

Yeah I know i forgot to delete it, that's all ;)

Aswering your last question, yep, they are in the same folder as the script.

Thanks again BrewMan! :)

Edited by Doctorkirk

Share this post


Link to post
Share on other sites
Starstar

it is better if you let a verable is equal to file directory for example

$FolderSelect = C:Folder nameFile name


Life is like a coin. You can spend it Anyway as you wish and for your kind information. "you can spend it only once."

Share this post


Link to post
Share on other sites
Doctorkirk

The $FolderSelect take the path from the FileSelectFolder, so we can install the program where the user want...

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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.