Miguel Posted January 21, 2012 Share Posted January 21, 2012 Hello everybody, After spending some hours searching the forum i gave up, i´m using Koda to GUI design and i want to automaticly replace the icon full path by relative path before compiling In this case, replacing "C:\Documents and Settings\Miguel\Os meus documentos\Meus Scripts\Google Maps\Icons\Ok_check.ico" by @WorkingDir&"\icons\Ok_chech.ico" Is this possible? How could i do it ? this is my GUI design code #Region ### START Koda GUI section ### Form=c:\documents and settings\miguel\os meus documentos\dropbox\meus scripts\google maps\opt_zonas_gui.kxf $Opt_zonas_gui = GUICreate("zonas", 105, 347, 0, 0, BitOR($WS_SIZEBOX,$WS_THICKFRAME,$WS_POPUP,$WS_CLIPSIBLINGS), 0, $Main_Gui) $ListView_opt_zonas = GUICtrlCreateListView("", 8, 8, 73, 289, BitOR($LVS_REPORT,$LVS_SINGLESEL,$LVS_SHOWSELALWAYS,$WS_GROUP), BitOR($WS_EX_CLIENTEDGE,$LVS_EX_CHECKBOXES)) $Icon_Ok = GUICtrlCreateIcon("C:\Documents and Settings\Miguel\Os meus documentos\Meus Scripts\Google Maps\Icons\Ok_check.ico", -1, 36, 305, 32, 32, BitOR($SS_NOTIFY,$WS_GROUP)) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### thanks in advance Link to comment Share on other sites More sharing options...
ChrisL Posted January 21, 2012 Share Posted January 21, 2012 (edited) Why do you need both? Why not just have them all as relative paths in the first place? The only way I can think of doing it if you insist is If @Compiled then $Icon_OK_Check = @WorkingDir & "iconsOk_check.ico" Else $Icon_OK_Check = "C:Documents and SettingsMiguelOs meus documentosMeus ScriptsGoogle MapsIconsOk_check.ico" Endif $Icon_Ok = GUICtrlCreateIcon($Icon_OK_Check, -1, 36, 305, 32, 32, BitOR($SS_NOTIFY,$WS_GROUP)) Edited January 21, 2012 by ChrisL [u]Scripts[/u]Minimize gui to systray _ Fail safe source recoveryMsgbox UDF _ _procwatch() Stop your app from being closedLicensed/Trial software system _ Buffering Hotkeys_SQL.au3 ADODB.Connection _ Search 2d Arrays_SplashTextWithGraphicOn() _ Adjust Screen GammaTransparent Controls _ Eventlogs without the crap_GuiCtrlCreateFlash() _ Simple Interscript communication[u]Websites[/u]Curious Campers VW Hightops Lambert Plant Hire Link to comment Share on other sites More sharing options...
JohnOne Posted January 21, 2012 Share Posted January 21, 2012 I you are talking about a function to parse your code to do something like that, I don't think it is trivial. First you would need a RegExp to locate all the paths, then a recursive search to find its relative position etc... But maybe I'm wrong about what you want to achieve. In any case you should not assume that the working directory is on dir or another, and should set it with native function FileChangeDir(). AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Miguel Posted January 21, 2012 Author Share Posted January 21, 2012 My problem is that Koda puts the full path in the icon and if i forgot to change the path to relative path before compiling, that image wont be shown. thats why i am trying to find a way to change the path before compiling, maybe doing it using auto it wrapper. But my knowledges are not enough to achieve it. Link to comment Share on other sites More sharing options...
Miguel Posted January 21, 2012 Author Share Posted January 21, 2012 (edited) Maybe the only way to achieve it will be like this...... #cs *********** DONT FORGET BEFORE COMPILING ************* Search -> Replace "C:Documents and SettingsMiguelOs meus documentosDropboxMeus ScriptsGoogle MapsIcons" -> @WorkingDir &"Icons" #ce Edited January 21, 2012 by Miguel Link to comment Share on other sites More sharing options...
guinness Posted January 22, 2012 Share Posted January 22, 2012 Why not use AutoItWrapper to embed the icon in the compiled script? Or am I missing something? UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
Miguel Posted January 22, 2012 Author Share Posted January 22, 2012 Fixed !!!! Created a script called _RunBeforeCompiling This way all full paths placed by Koda wil be replaced by relative path #include <File.au3> $find = """C:Documents and SettingsMiguelOs meus documentosDropboxMeus ScriptsGoogle Maps" $replace = "@WorkingDir&""" $filename = @WorkingDir&"GmapsMarkers.au3" $retval = _ReplaceStringInFile($filename,$find,$replace) if $retval = -1 then msgbox(0, "ERROR", "The pattern could not be replaced in file: " & $filename & " Error: " & @error) exit else msgbox(0, "INFO", "Found " & $retval & " occurances of the pattern: " & $find & " in the file: " & $filename) endif Link to comment Share on other sites More sharing options...
Miguel Posted January 22, 2012 Author Share Posted January 22, 2012 @guiness sorry my beginner question .... how do i use the embeded icon, i mean whats the path to a icon embeded in the EXE ? Link to comment Share on other sites More sharing options...
guinness Posted January 22, 2012 Share Posted January 22, 2012 Have a look here >> http://www.autoitscript.com/autoit3/scite/docs/AutoIt3Wrapper.htm and the section "Adding Extra Ico's to the program resources." UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
martin Posted January 22, 2012 Share Posted January 22, 2012 In case it's ever any help, I have had the same problem many times with koda and this is how I deal with it. In the Koda design I don't use the icon I really want to use, I do something like $IconStEnd2Pt = GUICtrlCreateIcon("shell32.dll", -9, 970, 181, 34, 34, BitOR($GUI_SS_DEFAULT_ICON, $SS_SUNKEN)) Those kind of icon will be found on any PC I hope. The after the Koda section of my script I have lines like this GUICtrlSetImage($IconStEnd2Pt, @ScriptFullPath & 'imagespic5.ico') or something like GUICtrlSetImage($IconStEnd2Pt, @ScriptFullPath, -25) ; if I'm using AutoIt resources Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
Miguel Posted January 22, 2012 Author Share Posted January 22, 2012 @ guiness @ martin Thank´s for your help. 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