Search found 21 matches
- 20 Dec 2023, 00:14
- Forum: Ask for Help (v2)
- Topic: Windows GDI
- Replies: 2
- Views: 364
Re: Windows GDI
One more step toward a solution: When the GUI window receives the WM_PAINT message, we have to first show the picture control cP, which holds the graph, then, copy (BLT) GraphDC to WindowDC, as below. Gui1 := Gui() cP := Gui1.AddPicture("x10 y6 w500 h500 +Border") Gui1.Show() WindowDC := DllCall("Ge...
- 19 Dec 2023, 14:36
- Forum: Ask for Help (v2)
- Topic: Windows GDI
- Replies: 2
- Views: 364
Re: Windows GDI
A partial solution is to add the following to the script: OnMessage 15, WM_Paint ; WM_PAINT: 0x000F WM_PAINT(wParam, lParam, msg, hwnd) { DllCall("StretchBlt", "UInt",WindowDC, "UInt",200, "UInt",200, "UInt",100, "UInt",100, "UInt",GraphDC, "UInt",0, "UInt",0, "UInt",100, "UInt",100, "UInt",0x00CC00...
- 18 Dec 2023, 22:15
- Forum: Ask for Help (v2)
- Topic: Windows GDI
- Replies: 2
- Views: 364
Windows GDI
I tried to draw live graphs over a GUI control by using GDI functions. The following script is its basis. I can move the GUI window with the mouse, just fine. Other windows can be moved over the GUI, and away, the graph stays intact. However, after minimizing and restoring the GUI, the graph disappe...
- 17 Nov 2023, 14:20
- Forum: Ask for Help (v1)
- Topic: Calculator into Gui edit text Topic is solved
- Replies: 26
- Views: 2297
Re: Calculator into Gui edit text Topic is solved
Because Windows provides the old ES5 version of JS, many useful methods are missing. Even filling an Array is a pain in the neck. If you need to tabulate functions, here are some ideas: eval(" ; Sequence i0, i0+d, i0+2d... -> Array ---------- ( ; Multi-line literal string Array.prototype.seqv = func...
- 17 Nov 2023, 10:30
- Forum: Ask for Help (v1)
- Topic: Calculator into Gui edit text Topic is solved
- Replies: 26
- Views: 2297
Re: Calculator into Gui edit text Topic is solved
It does not work under Win11, either. It was a typo, instead of I guess, the '**' exponentiation uses the Math library, which is not loaded automatically. We have to use
Code: Select all
MsgBox eval("y += 2; y*2")
Code: Select all
MsgBox eval("y += 2; Math.pow(y,2)")
- 17 Nov 2023, 02:36
- Forum: Ask for Help (v1)
- Topic: Calculator into Gui edit text Topic is solved
- Replies: 26
- Views: 2297
Re: Calculator into Gui edit text Topic is solved
Wow! Thanks for the information. Just compare these to your function stripped down to 3 lines. It seems to be enough for creating a normal JS eval function: #Requires AutoHotkey v2 eval := GetEval() eval("y = 5") MsgBox eval("y += 2; y**2") GetEval() { ; JS Object -> eval function Static Doc := ComO...
- 16 Nov 2023, 23:21
- Forum: Ask for Help (v1)
- Topic: Calculator into Gui edit text Topic is solved
- Replies: 26
- Views: 2297
Re: Calculator into Gui edit text Topic is solved
...but, my Windows 11 PC uses an old JS version. No BigInt support, no arrow definition of functions, etc. It would be nice if those were also available. Is there a way to update JS? (I installed the latest 64-bit Node.js version, but it made no difference. Can I instruct AHK to work with that?)
- 16 Nov 2023, 16:03
- Forum: Ask for Help (v1)
- Topic: Calculator into Gui edit text Topic is solved
- Replies: 26
- Views: 2297
Re: Calculator into Gui edit text Topic is solved
Thanks, teadrinker! Your JavaScript expression evaluator works perfectly. The only reason I wanted to use an AHK expression evaluator (as opposed to Julia, Python, JS) is to avoid confusion with different syntaxes. Might not be a big deal...
- 16 Nov 2023, 14:58
- Forum: Ask for Help (v1)
- Topic: Calculator into Gui edit text Topic is solved
- Replies: 26
- Views: 2297
Re: Calculator into Gui edit text Topic is solved
Thanks for all the valuable insights. I was thinking of implementing an (arithmetic only) REPL in the second instance of AHK, maybe by dynamically launching a third instance. For AHK it looks complicated, though. I used this functionality with AHK interfacing Julia and Python. They do have REPL out ...
- 16 Nov 2023, 14:18
- Forum: Ask for Help (v1)
- Topic: Calculator into Gui edit text Topic is solved
- Replies: 26
- Views: 2297
Re: Calculator into Gui edit text Topic is solved
Regardless of good or bad praxis, flyingDman's script works for such a simple task as evaluating an arithmetic expression in a string. I use it without problems, even for tabulating prime numbers or similar tasks. It opens a second instance of AHK, sends an appropriate sequence of commands to this s...
- 16 Nov 2023, 13:19
- Forum: Ask for Help (v1)
- Topic: Calculator into Gui edit text Topic is solved
- Replies: 26
- Views: 2297
Re: Calculator into Gui edit text Topic is solved
Sending and receiving data through a Pipe to a second instance of AHK could be better (no hang). Does anyone have a pointer to an example script?
- 16 Nov 2023, 11:02
- Forum: Ask for Help (v1)
- Topic: Calculator into Gui edit text Topic is solved
- Replies: 26
- Views: 2297
Re: Calculator into Gui edit text Topic is solved
Thanks for the suggestion, but making "exec" Static produces an error on the second call. Error: (0x800A005B) Specifically: Write 004: MsgBox(evalx("FileAppend(y+1,'*')")) 006: { ▶ 008: exec.StdIn.Write(x) 009: exec.StdIn.Close() Something has to be done to re-open StdIn. This is the stripped down t...
- 16 Nov 2023, 01:58
- Forum: Ask for Help (v1)
- Topic: Calculator into Gui edit text Topic is solved
- Replies: 26
- Views: 2297
Re: Calculator into Gui edit text Topic is solved
...sorry for reviving this old thread: is there a way to reuse the "exec" object, for subsequent Eval calls? Assignments of previous results to variables, which retain their values between calls could save a lot of typing.
- 05 Nov 2023, 21:33
- Forum: Ask for Help (v2)
- Topic: Convert C++ code Topic is solved
- Replies: 3
- Views: 450
Re: Convert C++ code Topic is solved
Thank both of you for the help. With trial and error, I could find the ComCall index of every used XAudio2 function. This is the script containing the necessary functions for a beep of a given frequency (which could continuously vary with simple code changes), with a given duration, and separate vol...
- 04 Nov 2023, 21:57
- Forum: Ask for Help (v2)
- Topic: Convert C++ code Topic is solved
- Replies: 3
- Views: 450
Convert C++ code Topic is solved
My C++ program starts with the following instructions: CoInitializeEx(nullptr, COINIT_MULTITHREADED); XAudio2Create(&pXAudio2, 0, XAUDIO2_DEFAULT_PROCESSOR); pXAudio2->CreateMasteringVoice(&pMasterVoice); I'd like to convert these to AHK2. The first two instructions seem to be easy: DllCall("Ole32\C...
- 29 Oct 2023, 17:29
- Forum: Ask for Help (v2)
- Topic: CapsLock & s hotkey for screen saver Topic is solved
- Replies: 1
- Views: 379
Re: CapsLock & s hotkey for screen saver Topic is solved
The situation is similar with Sleep: CapsLock & p::DllCall("PowrProf\SetSuspendState", "str","Sleep") Therefore, a workaround with the script to send some keys when the screensaver is not active anymore would not be a general solution. In the meantime, I did find the solution: add a short delay befo...
- 29 Oct 2023, 14:01
- Forum: Ask for Help (v2)
- Topic: CapsLock & s hotkey for screen saver Topic is solved
- Replies: 1
- Views: 379
CapsLock & s hotkey for screen saver Topic is solved
The following script (the critical part of a very long script) activates the screen saver when the CapsLock and the s keys are pressed together: CapsLock::MsgBox "CapsLock" CapsLock & s::SendMessage 0x112, 0xF140, 2,,"Program Manager" ; 0x112 WM_SYSCOMMAND, 0xF140 SC_SCREENSAVE However, after waking...
- 23 Oct 2023, 11:33
- Forum: Bug Reports
- Topic: Hotstring trigger string ending with backtick in v2 Topic is solved
- Replies: 5
- Views: 1415
Re: Hotstring trigger string ending with backtick in v2 Topic is solved
Thanks, lexicos. Adding #Requires AutoHotkey v2 to the script indeed hides this launcher problem.
- 23 Oct 2023, 00:54
- Forum: Bug Reports
- Topic: Hotstring trigger string ending with backtick in v2 Topic is solved
- Replies: 5
- Views: 1415
Re: Hotstring trigger string ending with backtick in v2 Topic is solved
There is another ugly workaround (besides using the HotString command): ::a``:::{BS}b It looks like the parser treats the second backtick as escaping the colon, but the interpreter treats the two backticks as one literal backtick. The replacement string is then ":b", so a backspace is needed to remo...
- 21 Oct 2023, 13:50
- Forum: Bug Reports
- Topic: Hotstring trigger string ending with backtick in v2 Topic is solved
- Replies: 5
- Views: 1415
Re: Hotstring trigger string ending with backtick in v2 Topic is solved
The script contains this single line. Windows 11, American English version. The script is edited in Notepad, and saved in UTF-8 format.