Active window and mouse location
dougr at telus.net
Wed May 9 11:32:24 EDT 2018
Thanks, as always, for the responses. Getting old means you forget about the differences between Commands and Functions... but anyway
My MAIN question was whether there was a way to get LC to make a desktop window THE active, top-most window... next necessarily the LC's window (in my case) but ANY window for that matter.
I'll be using a shell command out to an AUTOHOTKEY compiled script to switch to the desired desktop window but was wondering if there was a native LC way to do so. BTW, anyone who hasn't heard or tried AutoHotKey, should do themselves a huge favor (favour in the British colonies) and explore its capabilities... which, I assure you, are myriad on Windows platforms. There are similar tools I have NOT explored available on the Mac.
However, before this thread evolves into a discussion about external scripting tools; please, if possible, let me know if anyone knows a LC-way to active a specific window on the desktop. ... ps... I am completely ignorant (and likely to remain so) regarding Java... so, if that is an option, I'd need a "seed" scripting suggestion as to how to start.
> In Windows 7, LC v8.1.9
> Is there a way to make an LC "window" the active / top window on the desktop after making another
> window on the desktop active? I have an app which allows me to copy a portion of text from, say, a
> Notepad window, into the clipboard. A timed loop within my LC script then pulls the clipboard text
> into an LC field and starts an analysis of the contents of that field. THAT works great. But then I
> need the LC window to become the active window after the analysis is done and displayed on my LC
> window, so I can manipulate the various controls I have on it.
> Of course I can "manually" click on the LC window to activate it but I was wondering if there is a way
> to do so in LC script. I've tried "focus on field xxx" (where xxx is a field in my displayed LC
> window), "set the screenMouseLoc to the loc of this stack", "go to this stack" and a variety of "click
> at" commands... none of these make the LC window the top active window on the desktop. The Notepad
> (or whatever) window stays as the top, active window.
> On a somewhat related note, how do you "set" the mouse location within an LC window? I know and use
> the "set the screenMouseLoc to the loc of this stack" but an equivalent "set the MouseLoc to the loc
> of this stack" or "set the mouseLoc to "650,420"" generates an error of "Properties: token is not a
> property) near "mouseLoc", char 10" when trying to save the code. Seems odd that I have to use FULL
> screen coordinates to set the mouse location rather than relative ones to the stack.
> Douglas Ruisaard
> Trilogy Software
> (250) 573-3935
> > The "screenMouseLoc" is a property, but the "mouseLoc" is a > function.You cannot set a function.
> > Why this was wrought this way is anybody's guess.
> If memory serves mouseLoc was implemented as a function for compatibility with HyperCard, which
> offered no way to move the mouse cursor.
> When the opportunity came up to make a global version, it seems the choice to make that one a property
> was simply because a property is more useful, allowing both getting and setting.
> Richard Gaskin
> Fourth World Systems
> Software Design and Development for the Desktop, Mobile, and the Web
> Ambassador at FourthWorld.com http://www.FourthWorld.com
More information about the Use-livecode