Khalil
Khalil

Reputation: 311

Autokey RTL input for other than MsgBox?

I want to output Arabic text, which is RTL orientated on an output window. This output window is to serve as a scrolling window of your history, one snippet at a time. MsgBox has the RTL parameter, but is unfriendly when it comes to handling the scrolling function. The scrolling function should work by merely scrolling the middle mouse button, so you can scroll quickly through 50 history snippets, one by one.

Upvotes: 0

Views: 139

Answers (1)

MCL
MCL

Reputation: 4075

Have a look at this example:

myPid := DllCall("GetCurrentProcessId")
wordList := "Lorem ipsum dolor sit amet consetetur"
StringSplit, wordList, wordList, %A_SPACE%
counter := 0
myMsgBox := -1

F9::
    myMsgBox := WinExist("ahk_pid " myPid " ahk_class #32770")
    if(counter + 1 > wordList0) {
        ControlSetText, Static1, DONE
        return
    }
    counter++
    if(!myMsgBox) {
        SetTimer, MakeMyMsgBox, -1
    } else {
        ControlSetText, Static1, % wordList%counter%
    }
return

MakeMyMsgBox:
    MsgBox, 1048576, RTL Test, % wordList%counter%
return

The salient point is the use of SetTimer to produce the MsgBox, allowing the hotkey routine to run again although there's a waiting MsgBox window present. Instead of closing the old MsgBox and producing a new one every time, I update the existing one with ControlSetText.

Upvotes: 0

Related Questions