Icons in exe - Compiler workaround Topic is solved

Get help with using AutoHotkey and its commands and hotkeys
User avatar
BriHecato
Posts: 124
Joined: 18 Jul 2017, 07:17

Icons in exe - Compiler workaround

12 Apr 2018, 07:32

My script include Menu, submenu and icons for menu items.
When i'm launching *.ahk file - it works
When I'm launching *.exe app from the same folder - it works
When I'm launching *.exe from other location - it doesn't work :
Got two error messages
- unable to load icon (but app launch and sit in tray)
- menu does not exist (and point to the line where is Menu Show command)

What is wrong with compiler ??

I'm using newest v1.1.28.02 to create exe
Last edited by BriHecato on 12 Apr 2018, 23:00, edited 1 time in total.
just me
Posts: 6430
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: Compiler Bug

12 Apr 2018, 07:59

How does your script 'include' icons?
joefiesta
Posts: 270
Joined: 24 Jan 2016, 13:54
Location: Pa., USA

Re: Compiler Bug

12 Apr 2018, 08:27

no one can tell you what is wrong with your code--and that is probably the problem--unless you include your code. And, if nothing is wrong with your code, we still need to see your code to try to recreate the problem.
just me
Posts: 6430
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: Compiler Bug

12 Apr 2018, 11:10

BriHecato wrote:When I'm launching *.exe app from the same folder - it works
That means, there's nothing wrong with the exe. Most likely the icons cannot be found if they aren't in the folder containing the exe respectively in the current working directory. That's what the first error message is trying to tell you.
User avatar
BriHecato
Posts: 124
Joined: 18 Jul 2017, 07:17

Re: Compiler Bug

12 Apr 2018, 15:18

First - beggining of mycode 1:1

Code: Select all

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

#SingleInstance force
#Persistent
FileEncoding, UTF-8

;;;;;;;;;;; SUBMENU  ;;;;;;;;;;;;;	
	Menu, AutoMenu , Add , BKF, useautobkf
	Menu, AutoMenu , Icon , BKF, ikony\bkf.ico, 1

	
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; MENU  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 	Menu, ZamMenu , Add , Wyszukaj GEO `t F1 , usef1
	Menu, ZamMenu , Default , Wyszukaj GEO `t F1
	Menu, ZamMenu , Icon , Wyszukaj GEO `t F1, ikony\geoquest.ico, 1
 	Menu, ZamMenu , Add , Podepnij GEO `t Ctrl+F1 , usecf1
	Menu, ZamMenu , Icon , Podepnij GEO `t Ctrl+F1, ikony\geoplus.ico, 1	
	Menu, ZamMenu , Add , Wyszukaj PDF1 `t F2 , usef2
	Menu, ZamMenu , Icon , Wyszukaj PDF1 `t F2 , ikony\pdfquest.ico, 1
	Menu, ZamMenu , Add , Podepnij PDF1 `t Ctrl+F2 , usecf2
	Menu, ZamMenu , Icon , Podepnij PDF1 `t Ctrl+F2 , ikony\pdfplus.ico, 1	
	Menu, ZamMenu , Add , Wyszukaj PDF2 `t F3 , usef3
	Menu, ZamMenu , Icon , Wyszukaj PDF2 `t F3 , ikony\pdfquest.ico, 1	
	Menu, ZamMenu , Add , Podepnij PDF2 `t Ctrl+F3 , usecf3
	Menu, ZamMenu , Icon , Podepnij PDF2 `t Ctrl+F3 , ikony\pdfplus.ico, 1	
	Menu, ZamMenu , Add , Pozycja anulowana , canceled
;	Menu, ZamMenu , Icon , Pozycja anulowana , ikony\pdfplus.ico, 1	
	Menu, ZamMenu , Add , Wyszukaj katalog firmy `t F4 , usef4
	Menu, ZamMenu , Icon , Wyszukaj katalog firmy `t F4 , ikony\folderquest.ico, 1	
	Menu, ZamMenu , Add , Automatyczne podpinanie, :AutoMenu	
	Menu, ZamMenu , Add
	Menu, ZamMenu , Add , Generuj JOB z tej pozycji `t F5, jobgen
	Menu, ZamMenu , Icon , Generuj JOB z tej pozycji `t F5, ikony\jobgen.ico, 1
	Menu, ZamMenu , Add
	Menu, ZamMenu , Add , Usuń GEO `t Alt+F1 , useaf1
	Menu, ZamMenu , Icon , Usuń GEO `t Alt+F1 , ikony\geominus.ico, 1
	Menu, ZamMenu , Add , Usuń PDF1 `t Alt+F2 , useaf2
	Menu, ZamMenu , Icon , Usuń PDF1 `t Alt+F2 , ikony\pdfminus.ico, 1
	Menu, ZamMenu , Add , Usuń PDF2 `t Alt+F3 , useaf3
	Menu, ZamMenu , Icon , Usuń PDF2 `t Alt+F3 , ikony\pdfminus.ico, 1
	Menu, ZamMenu , Add , Usuń wszystko `t DEL , delall
	Menu, ZamMenu , Add				
	Menu, ZamMenu , Add , Pokaż odpady surowca, prodshow
	Menu, ZamMenu , Icon , Pokaż odpady surowca, ikony\prod.ico, 1
	Menu, ZamMenu , Add		
	Menu, ZamMenu , Add , Segreguj detale z I: na P: `t F6, segregate
	Menu, ZamMenu , Icon , Segreguj detale z I: na P: `t F6, ikony\intofolder.ico, 1	
	Menu, ZamMenu , Add	
	Menu, ZamMenu , Add , Utwórz katalog zlecenia `t F7, dircreate
	Menu, ZamMenu , Icon , Utwórz katalog zlecenia `t F7, ikony\folderplus.ico, 1		
	;end of menu
	
;;;;;;;;;;;;;;;;;; GLOBAL HOTKEYS ;;;;;;;;;;;;;;;;;;;;;;;;
~CapsLock::Reload
~ScrollLock::Suspend
+Esc::ExitApp

;;;;;;;;;;;;;;;;;;;;;;;;;;;; VARIABLES  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
After this are all labels
then got launching hotkey

Code: Select all

;;;;;;;;;;;;;;;;;; HOTKEY ;;;;;;;;;;;;;;;;;;;;;;
#IfWinActive xvXlLaserZam, Pozycje

MButton::
	Menu, ZamMenu, Show
	FileAppend, Menu: ok `n -- `n, bzm.errorlog
Return,		;end of button
Questions are:
1. why i cannot compile standalone exe that will have icons inside (like any compiler would do)?
2. why got error with "menu not found" when trying to launch it with hotkey despise missing icons?

Found some answers for question1 - that ahk compiler cannot do that - just combining current script with "script engine library" and that's all, but not find solution for menu error.

I've made little modification:
remove icons from script (just ;; comment them),
compile exe,
move it to another location,
run
and still got "missing menu" error
User avatar
BriHecato
Posts: 124
Joined: 18 Jul 2017, 07:17

Re: Compiler Bug

12 Apr 2018, 15:23

just me wrote:That means, there's nothing wrong with the exe.
That's why i titled this topic "Compiler bug" - i expected that icons will be in exe. This made compiler a little useless right now. Unless theres another way to make icons into exe file (other than resource hacking each build ..... :thumbdown: )

Maybe it can combine icon library (icl / dll) into the exe?
User avatar
kczx3
Posts: 858
Joined: 06 Oct 2015, 21:39

Re: Compiler Bug

12 Apr 2018, 19:58

It’s been requested many times but definitely would be useful to include the resources in the exe and not have to write them out to disk when the exe is ran.
User avatar
Flipeador
Posts: 1114
Joined: 15 Nov 2014, 21:31
GitHub: Flipeador
Location: Argentina
Contact:

Re: Compiler Bug

12 Apr 2018, 20:22

Yeah... The current compiler is very simple, regrettable I would say haha. We need a complete oficial compiler with a great set of options.
:wave:
Windws 1♂ Pro 64-Bits I make scripts for AHKv2 (my v2 compiler) & WIN_7+ Spanish Argentina
(If any of my code written for v2 has stopped working, send me a private message. I appreciate that you correct my English.)
User avatar
Cuadrix
Posts: 199
Joined: 07 May 2017, 08:26

Re: Compiler Bug

12 Apr 2018, 20:38

You could try using SKANs Base64 encoder/decoder for Binary data
----
User avatar
BriHecato
Posts: 124
Joined: 18 Jul 2017, 07:17

Re: Icons in exe - Compiler workaround

12 Apr 2018, 23:09

I must say that FileInstall does the trick - so I doesn't need to worry for icons (sort of :) )
I've found also this script - http://www.computoredge.com/AutoHotkey/ ... #ImageList
that display contents of my dll icon library.
Anyway - thank you all.

Return to “Ask For Help”

Who is online

Users browsing this forum: digidings, ElDunco, Flipeador, Google [Bot], Odlanir, TheArkive and 201 guests