phil294 / AHK_X11

AutoHotkey for Linux (X11-based systems)
GNU General Public License v2.0
815 stars 15 forks source link

#DefineCommand direcive does not seem to work #86

Closed xlscode closed 3 months ago

xlscode commented 3 months ago

Hello,

first of all, thank you for your exquisite work on this project.

I have encountered an issue with #DefineCommand directive – it just does not seem to work. I am getting this error message:

Syntax error in line 1:
Command ‘#definecommand’ not found

Line content was: '#DefineCommand, SampleCommand, LblSampleCommand'. (Build::SyntaxException)
  from /tmp/.mount_ahk_x1GGORGE/AppRun.wrapped in '??'
  from /tmp/.mount_ahk_x1GGORGE/AppRun.wrapped in '??'
  from /tmp/.mount_ahk_x1GGORGE/AppRun.wrapped in '__crystal_main'
  from /tmp/.mount_ahk_x1GGORGE/AppRun.wrapped in 'main'
  from /lib/x86_64-linux-gnu/libc.so.6 in '??'
  from /lib/x86_64-linux-gnu/libc.so.6 in '__libc_start_main'
  from /tmp/.mount_ahk_x1GGORGE/AppRun.wrapped in '_start'
  from ???
Gtk-Message: 10:54:32.247: Failed to load module "appmenu-gtk-module"

A sample script to replicate this is like that:

#DefineCommand, SampleCommand, LblSampleCommand

SampleCommand, Peekaboo

Return

LblSampleCommand:
  MsgBox, %A_Param1%
  Return

From my brief and uneducated look at the source code, it seems that the commands defined by a user are registered in user_defined_command_label_by_name hash but somehow it is not used (or referenced) in any other place.

I would be really grateful if you could look into it. The #DefineCommand directive is indispensable in the absence of user defined functions.

By the way, do you have any idea where does the error Failed to load module "appmenu-gtk-module" come from?

Thank you very much for your help.

phil294 commented 3 months ago

heyo,

your code is fine, only problem is the latest release doesn't yet include this feature 👀 (same with Eval and := math expressions) you could build from source instead and then it'll work.

I haven't really had much time lately to dedicate to my OS projects, and there were some other features I wanted to add in before making a new release. But since so much time has passed, I guess I should just do that, because a disparate state between Readme and downloadable build is pretty stupid! ...specially when the Readme s the de-facto homepage of the project.

The #DefineCommand directive is indispensable in the absence of user defined functions

I think this way too, but IMO Windows AHK v1.x should have never added comprehensive expressions, nor functions and classes, but that's too late now :D At least they haven't found their way into ahk_x11... for now

By the way, do you have any idea where does the error Failed to load module "appmenu-gtk-module" come from?

Probably some bug of the used https://github.com/linuxdeploy/linuxdeploy-plugin-gtk script which is part of the script we use to produce an AppImage file. I have them too, and they seem to be harmless.

There is an issue #4 to get these useless GTK messages out of the way. The whole setup is very exotic and I don't know any further, so I guess it will stay like this until someone else fixes it (so forever, basically)

xlscode commented 3 months ago

Thank you for your extensive reply.

… a new release. But since so much time has passed, I guess I should just do that

I am sure a lot of people would applaud.

… you could build from source instead and then it'll work.

Well, apparently, there is no other way at the moment … I will be installing Crystal compiler very soon :-)

Being a Ruby fan, I have been willing to try Crystal anyway for some time now.

Thank you again for making AHK_X11.

xlscode commented 2 months ago

Hello,

I just want to confirm that the #DefineCommand directive works in a binary compiled from the source code. The compilation simple and straightforward. and the description of build process and dependencies is thorough and precise. (One just need to read and understand it. I did not, at first ;-) ... I mean, I did not read :-D )

phil294 commented 2 months ago

you can now also use the lastest release

The compilation simple and straightforward. and the description of build process and dependencies is thorough and precise

Thank you, good to know! 😊

xlscode commented 2 months ago

you can now also use the lastest release

Oh, 1.0.4 is news! The math (not) expression is big improvement. (I like the syntax changes in AHK, I hope you don't mind :-D )

Thank you for info. I will try it ASAP.

And thank you for your great work!