Active window and mouse location
Lagi Pittas
iphonelagi at gmail.com
Wed May 9 12:38:36 EDT 2018
Hi Doug,
Could this thread be helpful?
http://forums.livecode.com/viewtopic.php?f=7&t=30984
and this lesson
http://lessons.livecode.com/m/2592/l/125868-searching-for-
an-open-window-by-title
Only for Livecode "windows"/stacks though
Failing that, using FFI with C would do it
You need to get the handle of the window
via enumwindows (abou 10 ways of doing it)
https://msdn.microsoft.com/en-us/library/windows/desktop/
ms633497.aspx
then call
https://msdn.microsoft.com/en-us/library/windows/desktop/
ms632673(v=vs.85).aspx
This pdf (aboutvisual foxpro winapi access ) give all manner of calls and
calling structures which should help with FFI - I'm going to have to have a
go at FFI soon.
https://www.dropbox.com/s/a0sa3q8vu3ctf3o/E-WAPI.pdf?dl=0
I did this with a Visual Foxpro routine over a decade ago - but I've been
to bed since then so hopefully one of the clever cloggs on here could do
this
to give us all a good template example for accessing windows apis via FFI
and C - Go on mark/panos/Ali - in between bites of your sandwiches.
a 15 minutes slot on LC Global?
Regards Lagi
On 9 May 2018 at 16:32, Douglas Ruisaard via use-livecode <
use-livecode at lists.runrev.com> wrote:
> 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.
>
> Cheers!
> Doug
>
> Douglas Ruisaard
> Trilogy Software
> (250) 573-3935
>
> > 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
> >
> >
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
More information about the use-livecode
mailing list