Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>A long time ago, I stopped using the res file stuff, and swtiched to <code>FileInstall(...)</code> <a href="http://www.autoitscript.com/autoit3/docs/functions/FileInstall.htm" rel="nofollow">http://www.autoitscript.com/autoit3/docs/functions/FileInstall.htm</a></p> <pre><code>FileInstall("C:\Users\Kristian\SkyDrive\Autoit\Bungee Minecraft Server Launcher.exe",@TEMPDIR &amp; "\Bungee Minecraft Server Launcher.exe") FileInstall("C:\Users\Kristian\SkyDrive\Autoit\Bungee Server Launcher\Licence.txt",@TEMPDIR &amp; "\Licence.txt") </code></pre> <p>Then you just use the file ^_^</p> <p>Also, it's worth noting that your paths are different:</p> <pre><code>Autoit\{BUNGEE MINECRAFT SERVER LAUNCHER.EXE} Autoit\Bungee Server Launcher\{LICENCE.TXT} </code></pre> <p>I'd open up a command prompt and double check the full path</p> <pre><code>cd C:\Users\Kristian\SkyDrive\Autoit &amp; dir licence.txt /b /s </code></pre> <p>Another solution would be to make the text file a variable in your script. If you open the file in SciTE, you can replace the regular expression <code>^(.*)$</code> with <code>"$1" &amp; @CRLF &amp;_</code> then copy and paste it into the script...</p> <p>Here is the code modified to work with FileInstall and a couple upgrades/fixes to the code. I tested it on my PC with different paths, and it worked. Functions should be self-contained, so I made them mostly internal. Ideally, you'd have them do a <code>Return SetError(...)</code> and put the msgbox code outside of the function call...but if it works for what you're using it for, go for it!</p> <pre><code>#Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Icon=..\Resources\unnamed.ico #AutoIt3Wrapper_Outfile=..\..\..\Desktop\Minecraft Server Launcher Installer.exe #AutoIt3Wrapper_UseX64=n #AutoIt3Wrapper_Add_Constants=n #AutoIt3Wrapper_AU3Check_Stop_OnWarning=y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include &lt;GUIConstantsEx.au3&gt; #include &lt;WindowsConstants.au3&gt; #include &lt;EditConstants.au3&gt; ; Target path of temp files - you should add code to delete these when done $LAUNCHPATH = @TempDir &amp; "\BMSLauncher.exe" $LICENCEPATH = @TempDir &amp; "\BMSLicence.txt" ; Check if the install files exist, and if not, output to console $EXIST1 = FileExists("C:\Users\Kristian\SkyDrive\Autoit\Bungee Minecraft Server Launcher.exe") $EXIST2 = FileExists("C:\Users\Kristian\SkyDrive\Autoit\Bungee Server Launcher\Licence.txt") IF NOT $EXIST1 OR NOT $EXIST2 Then ConsoleWrite("ERROR! FILE(S) NOT FOUND!" &amp; @CRLF) IF NOT $EXIST1 THEN ConsoleWrite("LAUNCHER FILE NOT FOUND!" &amp; @CRLF) IF NOT $EXIST2 THEN ConsoleWrite("LICENCE FILE NOT FOUND!" &amp; @CRLF) EndIf ; Copy files to destination FileInstall("C:\Users\Kristian\SkyDrive\Autoit\Bungee Minecraft Server Launcher.exe",$LAUNCHPATH,1) FileInstall("C:\Users\Kristian\SkyDrive\Autoit\Bungee Server Launcher\Licence.txt",$LICENCEPATH,1) ; Read licence file to variable $LICENCE = FileRead($LICENCEPATH) $msgbox1 = MsgBox(36, "Minecraft Server Launcher Installer", "Do you want to install the Launcher?") If $msgbox1 = 6 Then $EULAGUI = GUICreate("Minecraft Server Launcher Installer", 373, 325) GUICtrlCreateLabel("Read the following agreement. Scroll down to view the rest of the agreement.", 10, 10) GUICtrlCreateEdit($LICENCE, 10, 51, 350, 191, $WS_VSCROLL + $ES_READONLY + $ES_MULTILINE) GUICtrlCreateLabel("Do you accept all the terms of the license agreement? Selecting No" &amp; @CRLF &amp; "cancels the installation. You must accept the agreement to install.", 10, 250) $YES = GUICtrlCreateButton("Yes", 204, 296, 75, 23) $NO = GUICtrlCreateButton("No", 290, 296, 75, 23) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE, $NO Exit Case $YES GUIDelete($EULAGUI) Choose_Loc() EndSwitch WEnd EndIf Func Choose_Loc() LOCAL $LOCGUI = GUICreate("Minecraft Server Launcher Installer", 363, 108) GUICtrlCreateLabel("Choose Install Location", 10, 5) $INPUT = GUICtrlCreateInput("C:\Program Files (x86)\KnarCraft\Minecraft Server Launcher", 10, 40, 255, 22) $BROWSE = GUICtrlCreateButton("Browse...", 275, 40, 80, 23) $CANCEL = GUICtrlCreateButton("Cancel", 275, 75, 80, 23) $OK = GUICtrlCreateButton("OK", 185, 75, 80, 23) GUISetState(@SW_SHOW) While 1 ; you could make the switch guigetmsg() without $msg, idk what's best practice here $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE, $CANCEL Exit Case $OK LOCAL $INSTALLPATH = GUICtrlRead($INPUT) IF FileExists($INSTALLPATH) Then GUIDelete($LOCGUI) Install($LAUNCHPATH,$INSTALLPATH) EndIf Case $BROWSE $FOLDER = FileSelectFolder("Choose Install Location...", "", 7) If Not $FOLDER = "" Then GUICtrlSetData($INPUT, $FOLDER) EndSwitch WEnd EndFunc ;==&gt;Choose_Loc Func Install($FPATH,$IPATH) LOCAL $ERROR ; you should check for a trailing slash on the $IPATH input $IPATH &amp;= "\Bungee Minecraft Server Launcher.exe" FileCopy($FPATH,$IPATH) $ERROR = @error FileCreateShortcut($IPATH, @DesktopDir &amp; "\Bungee Minecraft Server Launcher.ink") If Not @error AND NOT $ERROR Then MsgBox(64, "Finished", "Installation completed with no errors. Please enjoy your new software.") Else MsgBox(16, "Finished", "The installation was interrupted by an error and the software may not work.") EndIf Exit EndFunc ;==&gt;Install </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload