Is there any non-100%-interpreted scripting language alternative to AutoHotKey?

Discuss other programming languages besides AutoHotkey
User
Posts: 407
Joined: 26 Jun 2017, 08:12

Is there any non-100%-interpreted scripting language alternative to AutoHotKey?

22 Jan 2019, 10:34

Yes, Autohotkey is a scripting language that can be defined as being a 100% interpreted language!

Why? Because every time a line from ".ahk" scripts is executed, it needs to be translated to "machine code" by AHK interpreter in order to allow the cpu to understand and execute it! (This makes AHK a very slow language!)



I was betting on "AutoIt", but I found out that it is the same as AHK, 100% interpreted language! (Although it is better than AHK, since it is a language based on functions instead commands, supports null character "Chr(0)", better array\object support, dynamic code execution, compiled scripts can execute other scripts, etc, etc, etc)



So basically, is there any scripting language similar to AHK or AutoIt that, unlike them, translates the whole script to machine code only once , avoiding the need of an interpreter while the script is being executed?



[Obs:] I read somewhere that, "loop" is the "Achilles' heel" of any 100% interpreted scripting language! (see Example below)

loop, 1000
Any-Code

The "Any-Code" above would have to be translated 1000 times to machine code by the language interpreter, which makes all the execution process really slow!

In the other hand, for non-100%-interpreted languages, the "Any-Code" above would have to be translated to machine code only once by the language interpreter, which makes all the execution process really faster!

Moderator Note: Moved topic from Ask for Help. ~ sinkfaze
User avatar
nnnik
Posts: 4500
Joined: 30 Sep 2013, 01:01
Location: Germany

Re: Is there any non-100%-interpreted scripting language alternative to AutoHotKey?

22 Jan 2019, 10:41

There are compiled, interpreted and JIT compiled languages.
JIT essentially mixes the best of both worlds and is more commonly used in modern languages.
Java is JIT compiled from Bytecode at the time it runs on the target machine,
The closest thing I know might be Pythons PyPy JIT compiler.
Recommends AHK Studio
User
Posts: 407
Joined: 26 Jun 2017, 08:12

Re: Is there any non-100%-interpreted scripting language alternative to AutoHotKey?

22 Jan 2019, 10:53

Python's indentation structure imposition is a no go for me!
User
Posts: 407
Joined: 26 Jun 2017, 08:12

Re: Is there any non-100%-interpreted scripting language alternative to AutoHotKey?

22 Jan 2019, 11:04

This thread should be in "Ask For Help" instead "Other Programming Languages" forum!

I'm not "Discussing other programming languages besides AutoHotkey"!

I'm asking for people here to help me find an alternative scripting language similar, but faster, than AHK or AutoIt!
User avatar
nnnik
Posts: 4500
Joined: 30 Sep 2013, 01:01
Location: Germany

Re: Is there any non-100%-interpreted scripting language alternative to AutoHotKey?

22 Jan 2019, 11:06

Which is a different language than Autohotkey - not help with the usage of AutoHotkey.
Python is the way to go - it's a good language. Other than that I dont have much hope for you.
Recommends AHK Studio
User
Posts: 407
Joined: 26 Jun 2017, 08:12

Re: Is there any non-100%-interpreted scripting language alternative to AutoHotKey?

22 Jan 2019, 11:11

nnnik wrote:
22 Jan 2019, 11:06
Which is a different language than Autohotkey - not help with the usage of AutoHotkey.
Python is the way to go - it's a good language. Other than that I dont have much hope for you.
Hehe, Lol!
TAC109
Posts: 1099
Joined: 02 Oct 2013, 19:41
Location: New Zealand

Re: Is there any non-100%-interpreted scripting language alternative to AutoHotKey?

22 Jan 2019, 17:47

User wrote:
22 Jan 2019, 10:34
Yes, Autohotkey is a scripting language that can be defined as being a 100% interpreted language!

Why? Because every time a line from ".ahk" scripts is executed, it needs to be translated to "machine code" ...
Are you aware that AHK performs many optimisations when the script is loaded? See Built-in Performance Features for load-time optimisations.
My scripts:-
XRef - Produces Cross Reference lists for scripts
ReClip - A Text Reformatting and Clip Management utility
ScriptGuard - Protects Compiled Scripts from Decompilation
I also maintain Ahk2Exe
SOTE
Posts: 1426
Joined: 15 Jun 2015, 06:21

Re: Is there any non-100%-interpreted scripting language alternative to AutoHotKey?

23 Jan 2019, 04:11

1) When the term "slow" is used, that's quite relative. Slow for doing what?

For the vast majority of purposes, AutoHotkey is definitely fast enough.

2) I think there are many that feel that AutoIt is in no way superior to AutoHotkey.

In fact, this appears to be more of a "depends" type of situation. Where one scripting language is better at somethings, while the other language is better at other things.

There are 3 versions of actively developed AutoHotkey. With AutoHotkey v2 and Autohotkey_H having a host of features beyond the official and stable release of AutoHotkey_L. The vast majority of users are likely not to see what the fuss is about with commands vs functions, but if a person takes issues with that, there is AutoHotkey v2 (v2 help doc- https://lexikos.github.io/v2/docs/AutoHotkey.htm) that specifically addresses that.

Directly Adding Machine Code

You can also write machine code directly into AutoHotkey scripts. There are so many posts about it, here are a few... https://autohotkey.com/board/topic/75777-convert-ahk-code-into-machine-code/ (Convert AHK Code into Machine Code), https://www.autohotkey.com/boards/viewtopic.php?t=32242 (best AutoHotkey machine code functions), https://www.autohotkey.com/boards/viewtopic.php?f=6&t=4642&hilit=machine+code(MCode4GCC -- C/C++ to MCode Generator).

Also, the ability to add machine code partially addresses the "speed" issue too. You can literally take your "favorite functions" from C or C++ and use them as machine code in AutoHotkey. In fact, you can use Object Pascal functions as well, and have other programming languages inside of your AutoHotkey script. Clearly making AutoHotkey very flexible.

3) Object Pascal

If a person doesn't want to deal with Python, then the best candidate would arguably be Object Pascal. Code written in Object Pascal can be compiled directly with the FPC (Free Pascal Compiler) and there is an open source IDE, Lazarus.

A promising project appears to be WinAutoKey, https://github.com/jasc2v8/WinAutoKey. As Object Pascal is already a powerful programming language, a lot of "meat" of a language and flow control isn't needed. It's more an issue of adding automation functions and various other conveniences. However, it's not clear how far the author will go with it. Maybe he needs help. There are also other Pascal automation projects like Simba, where inspiration for other functions can come from.

4) Loop in AutoHotkey

"Loops, blocks, IFs, and ELSEs are given the memory addresses of their related jump-points in the script."

"Each script is semi-compiled while it is being loaded and syntax-checked. In addition to reducing the memory consumed by the script, this also greatly improves runtime performance."

Various optimizations have been made in AutoHotkey in order for it to perform faster. This goes back to "fast for what?" You didn't bring up a specific comparison, where the difference in speed between languages was of some significance. And the vast majority of users are arguably likely to not care or be concerned about it. For many people, especially non-programmer types, it will come down to ease of use and easy to understand syntax. Which by the way, "Loop" is very easy to understand. This is arguably why Autohotkey is so well loved, and there is increasingly so much written about it, in addition to being open source.
Last edited by SOTE on 23 Jan 2019, 06:10, edited 1 time in total.
User avatar
nnnik
Posts: 4500
Joined: 30 Sep 2013, 01:01
Location: Germany

Re: Is there any non-100%-interpreted scripting language alternative to AutoHotKey?

23 Jan 2019, 04:52

When someone wants a scripting language Object Pascal is no choice because it's not a scripting language.
Recommends AHK Studio
SOTE
Posts: 1426
Joined: 15 Jun 2015, 06:21

Re: Is there any non-100%-interpreted scripting language alternative to AutoHotKey?

23 Jan 2019, 05:56

nnnik wrote:
23 Jan 2019, 04:52
When someone wants a scripting language Object Pascal is no choice because it's not a scripting language.
Yes, you are correct that Object Pascal is not a scripting language. However, there is Pascal Script (https://github.com/remobjects/pascalscript and another implementation of it- http://www.be-precision.com/products/pdscript/) and they are based on Pascal. So we are talking highly compatible syntax, where if you know one, you just about know the other. Simba is an example of an automation tool that makes use of it. A Pascal Script that you write in the Simba application, can be copied and pasted (with often just small alterations) and compiled with the FPC (Free Pascal Compiler) or pasted into Lazarus. Though, to be fair, Simba is often underutilized and the community mainly focuses on bots versus programs with other uses.

Also, based on the original argument, it appeared he is taking issue with the AutoHotkey Interpreter. Therefore I offered a suggestion where no Interpreter is needed, and the code could be compiled directly.
"Yes, Autohotkey is a scripting language that can be defined as being a 100% interpreted language!

Why? Because every time a line from ".ahk" scripts is executed, it needs to be translated to "machine code" by AHK interpreter in order to allow the cpu to understand and execute it! (This makes AHK a very slow language!) "

So basically, is there any scripting language similar to AHK or AutoIt that, unlike them, translates the whole script to machine code only once , avoiding the need of an interpreter while the script is being executed?
He also appeared to be looking for something that is AutoHotkey-like, which I assume he is referring to automation and he doesn't like Python. Thus I suggested WinAutoKey (which uses Pascal), where his code can be compiled directly and it's something that has various automation functions. Clearly it's not as feature rich as AutoHotkey (in terms of Windows automation and not in terms of a programming language), but based on his complaints, it looks like something that could possibly fit his situation.
User
Posts: 407
Joined: 26 Jun 2017, 08:12

Re: Is there any non-100%-interpreted scripting language alternative to AutoHotKey?

23 Jan 2019, 11:21

SOTE wrote:
23 Jan 2019, 04:11
AHK is a slow language in general, that's already a common sense and I know that you already know it!

AHK may be fast enough for windows Os and games automation tasks, but,

For data processing, string manipulation, etc, etc, AHK is definitely not the way to go!

Believe me, most of people here already noticed that "functions" are better than "commands"!

"Machine Code" is not an option here, I wouldn't be coding in AHK if I already knew how to code in C\C++
SOTE wrote:
23 Jan 2019, 05:56
He also appeared to be looking for something that is AutoHotkey-like, which I assume he is referring to automation and he doesn't like Python. Thus I suggested WinAutoKey (which uses Pascal), where his code can be compiled directly and it's something that has various automation functions. Clearly it's not as feature rich as AutoHotkey (in terms of Windows automation and not in terms of a programming language), but based on his complaints, it looks like something that could possibly fit his situation.
Not so "AutoHotkey-like", I would say more "AutoIt-like"!

"WinAutoKey" seems interesting, I will look into it!

Python's indentation structure imposition was\is a really bad decision its developer\s took, in my opinion, of course! (I really would like to use it, but unfortunately ...)

By the way, what do you think about C#? or even Java?

I already know how to code Javascript, which I may say, is a very good and in the same time a weak language (for example, regex is very bad in javascript, functions variables are global by default, functions static variables are not supported natively unless workarounds are used, etc, etc, etc)

PHP is a nice language too, regex support is really good, but its a server side language, which is bad and good at same time!

So, based on my likings, should I learn C# or Java? (Can both of them do real compilation? Are both of them cross-platform?)

I'm already finishing all my projects that I started with AHK (in which I wouldn't start if at the time I started them I knew all the AHK limitations) and move on!

So, in what language should I bet?
User avatar
nnnik
Posts: 4500
Joined: 30 Sep 2013, 01:01
Location: Germany

Re: Is there any non-100%-interpreted scripting language alternative to AutoHotKey?

23 Jan 2019, 11:45

Java or C# is essentially the same thing in the end.
Java compiles to bytecode which is then JIT compiled by the JVM (Java Virual Machine) when the file is executed.
As far as I understand C# can output many types of code and even directly compile to Machine Code depending on which compiler you used.
And I haven't touched C# enough yet to really give you some hints in that regard.
Recommends AHK Studio
SOTE
Posts: 1426
Joined: 15 Jun 2015, 06:21

Re: Is there any non-100%-interpreted scripting language alternative to AutoHotKey?

23 Jan 2019, 12:19

Well we can at least agree on one thing... I dislike Python too. Not interested in it, and feel other languages are better suited for tasks I want to do or have an interest in. Rather play with C, Pascal, Javascript... Hell, even Visual Basic (one of those Basic-like languages) or C# before Python.

Of course, language preference is up to the individual and their personality. I think some languages agree with certain people more than others. We are all individuals, so "to each his own". When it comes to C# or Java, I feel that Object Pascal stacks up better. Microsoft doesn't play well with others, so C# is way too much about them and their business interests, as oppose to being truly cross-platform. And if you are content in just programming for Windows, there is a good argument to just stick to C and/or C++, though Microsoft is trying hard to push C# and .NET. As for Java, in my personal opinion, it has several flaws. Not against anybody using it, but think one can do well with Object Pascal's cross-compiling and cross-platform abilities, which also has a lot less "baggage" than Java.

I'm perplexed by the sentiment that you are expressing, in terms of "out growing" AutoHotkey. Even if a person is programming in other languages, I feel strongly that AutoHotkey is a great utility language for Windows. In fact, I think it's the best (to include better than AutoIt). When it comes to ease of use, or for those little quick and dirty automated tasks, AutoHotkey just shines. Another point, is AutoHotkey is arguably a great application prototype building and testing language. Something handy, that you use everyday or a lot for little tasks, that you can use for mid size or bigger tasks as well or to test out ideas.

The "need for speed", is again so relative. Even when mentioning and dealing with data processing or string manipulation, we are talking about how critical the speed of the script/application is for you. And usually, you will need to see if there are ways to optimize your code first or to be clear about how fast you need a script/application to be. And if a person feels that the best option is another programming language, that often will not be any easier than learning to use machine code in AutoHotkey. The person will still have to climb the hill of learning to use that other language and learning something new.

So I guess the best advice is go try various languages out and just see how you feel about them. And the great thing is you know AutoHotkey, so it's there if you need it and has given you the foundation to understand programming better.
User avatar
nnnik
Posts: 4500
Joined: 30 Sep 2013, 01:01
Location: Germany

Re: Is there any non-100%-interpreted scripting language alternative to AutoHotKey?

23 Jan 2019, 12:32

Machine Code is not an option - learning Java was so much easier than achieving anything meaningful on a big scale in MCode that I cannot even begin to describe it.

Each tool has its uses - AutoHotkey is suitable for automation - Java/C# are for full grown applications - Javascript is to build websites or to build desktop applications.
Java is also used for android development - C is for libraries that you want to share with every possible language.

Python is a language that lets you program things quick and dirty without requiring much work or forcing much on the user.
Thats why it is used a lot by non-programmers e.g. scientists/mathematicians for data analasys and similar.
Recommends AHK Studio
User
Posts: 407
Joined: 26 Jun 2017, 08:12

Re: Is there any non-100%-interpreted scripting language alternative to AutoHotKey?

23 Jan 2019, 12:41

Thanks for your advices!

SOTE wrote:
23 Jan 2019, 12:19
And the great thing is you know AutoHotkey, so it's there if you need it and has given you the foundation to understand programming better.

In my case, Javascript, PHP and even AutoIt gave me some proper foundation to understand programming better, then I started to apply them to AHK!
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Is there any non-100%-interpreted scripting language alternative to AutoHotKey?

23 Jan 2019, 19:56

- I find AutoHotkey to be fast enough for almost everything.
- For the few exceptions, I use machine code. That machine code is written in C++ (or FASM if I prefer). The C++ code is compiled using TDM-GCC.
- If even that was insufficiently fast, I could consider writing some command-line programs in C++, and running them via AutoHotkey.
- It would be interesting to know what kinds of programs you think need to be written in other languages.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
User
Posts: 407
Joined: 26 Jun 2017, 08:12

Re: Is there any non-100%-interpreted scripting language alternative to AutoHotKey?

23 Jan 2019, 20:22

jeeswg wrote:
23 Jan 2019, 19:56
- It would be interesting to know what kinds of programs you think need to be written in other languages.
Hi @jeeswg,

As it is already mentioned, AHK may be fast enough for Windows OS and games automation tasks!

But, for example, for data processing, string manipulation, and many other things, AHK is really slow and not recommended!

Processing\manipulating kilobytes of files, AHK speed may be ok! But, megabytes of files, AHK is a no go!
SOTE
Posts: 1426
Joined: 15 Jun 2015, 06:21

Re: Is there any non-100%-interpreted scripting language alternative to AutoHotKey?

24 Jan 2019, 01:01

User wrote:
23 Jan 2019, 20:22
jeeswg wrote:
23 Jan 2019, 19:56
- It would be interesting to know what kinds of programs you think need to be written in other languages.
Hi @jeeswg,

As it is already mentioned, AHK may be fast enough for Windows OS and games automation tasks!

But, for example, for data processing, string manipulation, and many other things, AHK is really slow and not recommended!

Processing\manipulating kilobytes of files, AHK speed may be ok! But, megabytes of files, AHK is a no go!
User, you have not given a specific code example of AutoHotkey being too slow for a task. Speed is still relative and is very much a depends type of issue. The problem could be caused by bad coding, using a bad algorithm, or corrected via code optimization, to include using machine code for some particular function that can speed up performance.

As mentioned, AutoHotkey is an interpreted language that has various optimizations. Thus the term "semi-compiled". Please reference the before mentioned help documentation. The term "semi-compiled" is often used (like with AutoHotkey), where the code is interpreted only the first time it is executed. Every time after that, the compiled code is executed. Remember that the AutoHotkey interpreter is basically a C/C++ program, so if a redundant operation is being done, it can be optimized to reuse the memory address and its code. Of course the AutoHotkey developers can speak on this more, as to the nature of the optimizations made.

From what I read, many large companies are using "slow languages" like Java and Python to handle large data, as oppose to compiled languages like C++. Though partially their usage is based on how easy it is to find programmers, various libraries, and how easy it is to work with/understand the language (thus various may avoid C++). That being the case, AutoHotkey could arguably be equal to the task, when compared to Java and Python on Windows. What is really going on could possibly be using correct algorithms and coding, versus that the language is inadequate. The answer might be in becoming a better programmer, versus needing a new language.

If you are talking about some massive application and project, that's often beyond the scope of a single independent developer. Those cases are often referring to large companies and big budgets, and has a lot of other factors. AutoHotkey was never designed for such use. If the criticism of AutoHotkey is about being cross-platform and cross-compiling, I would say that is more understandable. So far, the developers have specifically focused on the Windows OS. Though maybe the ReactOS will one day give AutoHotkey (with it's C++ interpreter) another significant platform to be used on.

I think Object Pascal is a fine choice as a next programming language after learning AutoHotkey, because it's easier to learn, lots of free tools and lessons, and it's cross-platform. So based on your complaints, like speed and cross-platform, it has a lot to offer. With that typed, there is still a lot of room in AutoHotkey to do a great many things, in addition to combining it with other programming languages inside your scripts, in various ways. Among the advantages of interpreted and scripting languages like AutoHotkey is near instant testing of code changes, versus having to compile and then test, which helps when developing applications or solutions.
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Is there any non-100%-interpreted scripting language alternative to AutoHotKey?

24 Jan 2019, 01:23

- Yes, concrete use cases would be good.
- One minor point. You could have a script to convert a loop into multiple hardcoded iterations, prior to running. Worth doing, anyone?
- Could be of interest.
Script Performance | AutoHotkey
https://autohotkey.com/docs/misc/Performance.htm
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
User avatar
nnnik
Posts: 4500
Joined: 30 Sep 2013, 01:01
Location: Germany

Re: Is there any non-100%-interpreted scripting language alternative to AutoHotKey?

24 Jan 2019, 03:16

Java is not much slower than C. That surprised me too.
Python uses libraries which are the equivalent to AHKs machine code - except supported by a large community and supported by many companies. Python also is generally more optimized but when compared to AHK:
AHK has no chance speed wise.
One of the stages where I had to use Java was when I created a little game and wanted to apply a genetic algorithm to it.
Coding that in machine code would mean coding everything in Machine Code - everything except maybe creating the Gui. But I hate AHK v1s Gui system so I would probably avoid even that.
The entirety of my AHK code would probably looks like this:

Code: Select all

reallyLongDllCall :=...
DllCall(reallyLongDllCall)
SOTE and jeeswg: It seems to me like you are trying to convince people of staying with this language longer than they need it. He says he needs a faster language and that just might be the case.
While everything can be made faster its a pain to do that in AHK. It's probably better to switch languages for him.
Recommends AHK Studio

Return to “Other Programming Languages”

Who is online

Users browsing this forum: No registered users and 4 guests