Sign in to follow this  
Followers 0
dufran3

Compile to .exe GUI problems

7 posts in this topic

#1 ·  Posted (edited)

I am using xskin, and using the FileInstall function, using xbuttons and the lot. When I compile the script to an .exe, and the .exe is in another directory, none of the gui buttons, icons etc. are being displayed....getting an error that says: "$XButton_Location was not found"

here is a piece of the fileinstall portion

FileInstall ('C:\Documents and Settings\user\Desktop\!Scripts\App Installer\xSkin\0.bmp', $Skin_Folder& '\0.bmp', 1)
FileInstall ('C:\Documents and Settings\user\Desktop\!Scripts\App Installer\xSkin\1.bmp', $Skin_Folder& '\1.bmp', 1)
FileInstall ('C:\Documents and Settings\user\Desktop\!Scripts\App Installer\xSkin\2.bmp', $Skin_Folder& '\2.bmp', 1)
FileInstall ('C:\Documents and Settings\user\Desktop\!Scripts\App Installer\xSkin\3.bmp', $Skin_Folder& '\3.bmp', 1)
FileInstall ('C:\Documents and Settings\user\Desktop\!Scripts\App Installer\xSkin\4.bmp', $Skin_Folder& '\4.bmp', 1)
FileInstall ('C:\Documents and Settings\user\Desktop\!Scripts\App Installer\xSkin\5.bmp', $Skin_Folder& '\5.bmp', 1)
FileInstall ('C:\Documents and Settings\user\Desktop\!Scripts\App Installer\xSkin\6.bmp', $Skin_Folder& '\6.bmp', 1)
FileInstall ('C:\Documents and Settings\user\Desktop\!Scripts\App Installer\xSkin\7.bmp', $Skin_Folder& '\7.bmp', 1)
FileInstall ('C:\Documents and Settings\user\Desktop\!Scripts\App Installer\xSkin\skin.dat', $Skin_Folder& '\skin.dat', 1)
FileInstall ('C:\Documents and Settings\user\Desktop\!Scripts\App Installer\xSkin\logo.jpg', $Skin_Folder& '\logo.jpg', 1)

Found this in my script

$XButton_Location = @ScriptDir & '\xSkin\Xbutton'

it seems like fileinstall isn't working, and after the script is compiled, it is looking in that actual directory for the files

I have this in my script just below the $XButton_Location and it doesn't give any errors when the script is compiled.

$RemoteIconPath = @ScriptDir & '\icons\'

EdIT: just to inform, I had to change the source path of file install, and remove the @ScriptDir, this used to work, but now it wouldn't even let me compile. So I changed to the actual location.

Edited by dufran3

Share this post


Link to post
Share on other sites



I have looked and I have no idea how to fix this problem. Here is the first chunk of my script, if at all helpful

#include <GUIConstantsEx.au3>
#include <XSkin.au3>
#include <Log_Functions.au3>
#include <_ButtonHover.au3>

Opt("GUIOnEventMode", 1)



;Variables
$LocalIconPath = @WindowsDir & '\icons\'
$Skin_Folder = 'C:\Temp\xSkin'
$TempFolder = 'C:\Temp\EWUAI\'
$TempFolder_Icons = $TempFolder & 'icons\'
$XButton_Location = @ScriptDir & '\xSkin\Xbutton'
$RemoteIconPath = @ScriptDir & '\icons\'
Global $InstallSource = '\\146.187.7.66\Public\RDT\Installers\'
Global $Debug = 3 ;1 = normal debug 2 = strong 0 = no debug

;Read in Software Versions
$VersionFileRead = @ScriptDir & '\Version.ini'
;Adobe Acrobat Reader
Global $AcrobatVer = IniRead($VersionFileRead, 'Adobe Acrobat Reader', 'Version', 'Not Found')
Global $AcrobatFileName = IniRead($VersionFileRead, 'Adobe Acrobat Reader', 'Filename', 'Not Found')
;Adobe Flash Player
Global $AdobeFlashVer = IniRead($VersionFileRead, 'Adobe Flash Player', 'Version', 'Not Found')
Global $FlashFileName = IniRead($VersionFileRead, 'Adobe Flash Player', 'FileName', 'Not Found')
;Itunes and QuickTime
Global $iTunesVer = IniRead($VersionFileRead, 'iTunes', 'Version', 'Not Found')
Global $iTunesFileName = IniRead($VersionFileRead, 'iTunes', 'FileName1', 'Not Found')
Global $QuickTimeFileName = IniRead($VersionFileRead, 'iTunes', 'FileName2', 'Not Found')
Global $AppleAppSupportFileName = IniRead($VersionFileRead, 'iTunes', 'FileName3', 'Not Found')
Global $MobileDeviceFileName = IniRead($VersionFileRead, 'iTunes', 'FileName4', 'Not Found')
Global $SoftwareUpdateFileName = IniRead($VersionFileRead, 'iTunes', 'FileName5', 'Not Found')
Global $BonjourFileName = IniRead($VersionFileRead, 'iTunes', 'FileName6', 'Not Found')
Global $MobileMeFileName = IniRead($VersionFileRead, 'iTunes', 'FileName7', 'Not Found')
;Java
Global $JavaVersion = IniRead($VersionFileRead, 'Java', 'Version', 'Not Found')
Global $JavaFileName = IniRead($VersionFileRead, 'Java', 'FileName', 'Not Found')
;Firefox
Global $FirefoxVer = IniRead($VersionFileRead, 'Firefox', 'Version', 'Not Found')
Global $FirefoxFileName = IniRead($VersionFileRead, 'Firefox', 'Filename', 'Not Found')
;Office
Global $OfficeVer = IniRead($VersionFileRead, 'Office', 'Version', 'Not Found')
Global $OfficeFileName = IniRead($VersionFileRead, 'Office', 'Filename', 'Not Found')
Global $OfficeInstallSource = IniRead($VersionFileRead, 'Office', 'Path', 'Not Found')
;VLC
Global $VLCVer = IniRead($VersionFileRead, 'VLC', 'Version', 'Not Found')
;Domain Tools
Global $DomainToolsSource = IniRead($VersionFileRead, 'Domain Tools', 'Path', 'Not Found')
Global $DomainToolsTarget = IniRead($VersionFileRead, 'Domain Tools', 'Target', 'Not Found')


DirCreate($TempFolder)
DirCreate($TempFolder_Icons)
Global $LogFileOpen = FileOpen('C:\Temp\EWUAI\EWUAISetup.log', 1)

;Write Log File Header
_WriteLogFile($LogFileOpen, '-------------------------------------------------------')
_WriteLogFile($LogFileOpen, 'Starting script ' & @MON & "-" & @MDAY & "-" & @YEAR & " " & @HOUR & ":" & @MIN & ":" & @SEC & @CRLF)
_WriteLogFile($LogFileOpen, "Started by user: " & @UserName)

;Debug
If $Debug == 3 Then
    _WriteLogFile($LogFileOpen, 'Checking for Xskin directory at "C:\Temp\XSkin"')
EndIf
;/Debug

;Check if Xskin directory exists
If Not FileExists('C:\Temp\Xskin') Then
    DirCreate('C:\Temp\Xskin')
EndIf

;Debug
If $Debug == 3 Then
    _WriteLogFile($LogFileOpen, 'Copying Xskin GUI files to temp directory')
EndIf
;/Debug

;Install Files to Temp Directory
FileInstall ('C:\Documents and Settings\user\Desktop\!Scripts\App Installer\xSkin\0.bmp', $Skin_Folder& '\0.bmp', 1)
FileInstall ('C:\Documents and Settings\user\Desktop\!Scripts\App Installer\xSkin\1.bmp', $Skin_Folder& '\1.bmp', 1)
FileInstall ('C:\Documents and Settings\user\Desktop\!Scripts\App Installer\xSkin\2.bmp', $Skin_Folder& '\2.bmp', 1)
FileInstall ('C:\Documents and Settings\user\Desktop\!Scripts\App Installer\xSkin\3.bmp', $Skin_Folder& '\3.bmp', 1)
FileInstall ('C:\Documents and Settings\user\Desktop\!Scripts\App Installer\xSkin\4.bmp', $Skin_Folder& '\4.bmp', 1)
FileInstall ('C:\Documents and Settings\user\Desktop\!Scripts\App Installer\xSkin\5.bmp', $Skin_Folder& '\5.bmp', 1)
FileInstall ('C:\Documents and Settings\user\Desktop\!Scripts\App Installer\xSkin\6.bmp', $Skin_Folder& '\6.bmp', 1)
FileInstall ('C:\Documents and Settings\user\Desktop\!Scripts\App Installer\xSkin\7.bmp', $Skin_Folder& '\7.bmp', 1)
FileInstall ('C:\Documents and Settings\user\Desktop\!Scripts\App Installer\xSkin\skin.dat', $Skin_Folder& '\skin.dat', 1)
FileInstall ('C:\Documents and Settings\user\Desktop\!Scripts\App Installer\xSkin\logo.jpg', $Skin_Folder& '\logo.jpg', 1)

Share this post


Link to post
Share on other sites

Where are you running the script from? Because your script is looking for the files to be in the folder that the script is, and then in the "\xSkin\Xbutton" folder under that, because that is where you told it to look. You're installing your files in the C:\Temp folder, because of this line "$Skin_Folder = 'C:\Temp\xSkin'" .

If you're not running the compiled script in the C:\Temp folder, it's not going to find the files. You need to explicitly tell the script where the files are going to be when it's run, unless you're never going to run it in a different folder than C:\temp this file will never work. Don't use @ScriptDir for the file location unless you are sure the files are going to be there. Hard-coding a file location to copy the files to, and then using an ambiguous file reference like @Scriptdir is a designed-to-fail approach to programming.


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

Umm i'm not sure but maybe if you try with " " and not ' ' it will work.

Share this post


Link to post
Share on other sites

Thanks, this did work in the older version of AutoIT. This is a script that I used 3 years ago, that I am resurrecting and modifying. So FileInstall did work, and using @ScriptDir did work. Either way, I thought for some reason that when compiled the @ScriptDir macro became "local" searching in the compiled .exe. I know for a fact that this has worked in the past. Something must have changed. What options do I have? I could used the xSkin location on a network resource, but I am not sure that having everything reliant on a network location is such a good idea.

Share this post


Link to post
Share on other sites

If you want to use the files you copied to the drive when the program is run, use the location you saved them to, and don't use @ScriptDir. For instance, if you're saving the skin files to "C:\Temp\xSkin" you have to use that location as the place to look in.


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

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  
Followers 0