Fraser Posted June 2, 2012 Share Posted June 2, 2012 (edited) Hello,I have been writing an app for work for the past 3 months and I would like to include the install files in the exe.I have several different functions both for Windows 7 and Windows XP installs with Remote and Local installs for both calling the same install files but putting them in different places!I have had a look at the Fileinstall function, however it would appear that this function will add the file to the exe more than once if the function is used more than once (as below).If @OSVersion = "Win_7" Then FileInstall("..Install FilesProgFilesTESTTEST.DLL", "C:Program Files x86TESTTESTTEST.DLL", 1) EndIf If @OSVersion = "Win_XP" Then FileInstall("..Install FilesProgFilesTESTTEST.DLL", "C:Program FilesTESTTESTTEST.DLL", 1) EndIfI noticed that there is also a function in Autoit3wrapper which will add a file, however I’m not too sure how to the call the file when it needs to be copied.Below is how I have the test script set out:#region #AutoIt3Wrapper_Res_File_Add="..Install FilesProgFilesTESTTEST.DLL", File, DW2UK #endregion #include <IE.au3> #include <File.au3> #include <GUIConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <StaticConstants.au3> #include <ProgressConstants.au3> DirCreate ("C:Program Files x86TESTTEST") FileCopy("DW2UK", "C:Program Files x86TESTTESTTEST.DLL", 1)Any help will be much appreciated.P.S. Sorry if this is in the wrong place or if someone else has already posted something similar!Kind Regards,Fraser Edited June 2, 2012 by Fraser Link to comment Share on other sites More sharing options...
abberration Posted June 2, 2012 Share Posted June 2, 2012 If you don't want a double copy of the file embedded within your exe, you could just fileinstall to @tempdir and then use the if @osversion = "Win_7" then... else if @osversion = "Win_XP" then... to call directly from the single @tempdir location. Easy MP3 | Software Installer | Password Manager Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted June 2, 2012 Moderators Share Posted June 2, 2012 Fraser,Welcome to the AutoIt forum. it would appear that this function will add the file to the exe more than once if the function is used more than onceAnd of course it does - as it has no idea which of those 2 conditions will be met at run-time. abberration has the right idea - only I would FileInstall the DLL to @tempdir in all cases and then FileMove it to the correct location depending on the OS: M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Fraser Posted June 2, 2012 Author Share Posted June 2, 2012 Hello Both,Why didn't I think of that?Thank you for both of your speedy replies, I will do as suggested!Kind Regards,Fraser Link to comment Share on other sites More sharing options...
Fraser Posted June 2, 2012 Author Share Posted June 2, 2012 (edited) Hello again, Just thought i would mention how i'm going to due it! Due to the way the computers are configured at work (badly), I have created a new function and added the Fileinstall function to it, i'm then going to call it from another function (along the line of below). expandcollapse popup#include <IE.au3> #include <File.au3> #include <GUIConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <StaticConstants.au3> #include <ProgressConstants.au3> Global $font = "Arial" Install_sel() Func Install_sel() $Install_sel_GUI = GUICreate ("Install", 300, 130) Opt("GUICoordMode", 3) GUISetFont(11, 1000, 0, $font) $Ok = GUICtrlCreateButton("OK", 10, 10, 135) $exit = GUICtrlCreateButton("EXIT", 50, 40, 200) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Ok GUIDelete($Install_sel_GUI) Install() ExitLoop Case $msg = $exit ExitLoop EndSelect WEnd EndFunc Func Install() IF @OSVersion = "WIN_7" Then $Prog_ver = "Program Files (x86)" ElseIf @OSVersion = "WIN_XP" Then $Prog_ver = "Program Files" EndIf MsgBox(0, "Installing", "Installing") DirCreate ("C:"& $Prog_ver $ "TESTTEST") Sleep(2000) FileInstall("..Install FilesProgFilesTESTTEST1.DLL", "C:" & $Prog_ver & "TESTTESTTEST1.DLL", 1) FileInstall("..Install FilesProgFilesTESTTEST2.DLL", "C:" & $Prog_ver & "TESTTESTTEST2.DLL", 1) FileInstall("..Install FilesProgFilesTESTTEST3.properties", "C:" & $Prog_ver & "TESTTESTTEST3.properties", 1) MsgBox(0, "Installed", "Installed") EndFunc Again thank you for taking the time to reply! Kind Regards, Fraser Edited June 2, 2012 by Fraser Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted June 2, 2012 Moderators Share Posted June 2, 2012 Fraser, Glad we could help. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Zedna Posted June 2, 2012 Share Posted June 2, 2012 You can also look at my Resources UDF. Link is in my signature. Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now