Page 1 of 5

window to window functionality lacking?

Posted: Wed Dec 14, 2016 11:19 am
by Ed_Ray
The regular livecode ver 8 that I have been trying out does not seem capable (unless I am missing something) to communicate and interface with non livecode windows like the windows explorer windows the control panel windows, Firefox launched window, or any window that is not a stack made by the livecode developer.

The lack of interface/communication includes very simple things that even very lame and outdated scripting languages have all been providing for years like:
[1] Sending keystrokes (i.e. Ctrl-A , ALT-F4 etc.) between windows to close, minimize a window, maximize a window, write to some app windows, read from some app windows etc.
[2] Identify, move, hide activate, launch windows etc. via their windows classes, internal API handles or titles/text on windows and be able to get indications that they have launched successfully and to interface directly with them (send messages/keystrokes/mouse clicks between them).
[3] COM support & be able to directly call windows and third-party DLL APIs
[4] Manipulate any window or process (not just livecode ones)

Are there any livecode extensions that allow the developer to do the things specified above?
If not, isn’t it about time for livecode to add these things considering that even old outdated scripting languages have been providing these functionalities for years?

I consider livecode to be incomplete without these basic functionalities since sometimes it becomes a struggle to do very simple tasks like sending keystrokes between windows when the mentioned tools are not available as part of the developer program itself. The developer then has to resort to crudely added bits and pieces of add on software and overly complicate their code unnecessarily to fit them in defeating what may have been an original elegantly constructed piece of source code and adding a lot of wasted time to make this patch work do anything constructive.

Re: window to window functionality lacking?

Posted: Wed Dec 14, 2016 1:36 pm
by richmond62
I have yet to see any applications that communicate with windows of other applications
on any of the 3 major platforms (Mac, Win, Linux), so don't really understand what the
point is here.

Re: window to window functionality lacking?

Posted: Wed Dec 14, 2016 3:54 pm
by dunbarx
On a Mac, can Applescript do that? Or a shell command from any platform?

Craig Newman

Re: window to window functionality lacking?

Posted: Wed Dec 14, 2016 6:19 pm
by jacque
Inter-app communication is done with the "do as <alternative language>" command, which for Windows is VBScript.

Re: window to window functionality lacking?

Posted: Wed Dec 14, 2016 7:26 pm
by FourthWorld
One man's "basic functionality" is another man's security exposure. Sending and receiving key events between applications is not needed by most apps. Exceptional program categories that rely on these include keyloggers and rubber duckies.

I'm sure your use is for legitimate automation tasks, but given the risks we're seeing in the wild most OS vendors tilt toward ever tighter sandboxing and narrower IAC going forward, with some third-party security add-ons raising flags with such hooks.

If your app depends on being able to control other apps without user intervention, you may find this increasingly difficult to rely on.

But at the moment LC does make it easy to use OS-provided hooks for this via VBScript and PowerShell, as Jacque noted.

If you need access to lower-level hooks LC also has the LiveCode Builder language to provide access to OS APIs beyond the scope of system scripting languages.

Re: window to window functionality lacking?

Posted: Sun Jan 08, 2017 4:15 am
by Ed_Ray
=== For richmond62 ===

You misunderstood my post. I am NOT trying to communicate with another app that are not mine.
I am trying to communicate between my app and an external window my own app opened such as a LOCAL html file opened with a launched browser within livecode.

Then I am sending it a select all etc. to this local (MY OWN local web page). Things like this. So there are NO SECURITY issues being opened up nor am I or attempting to do unwarranted things to other apps windows etc.

As far as other apps that does this. There are many such scripting languages that already do this all the time so this is not an extraordinary feat or achievement to request this. Example: using vbscript and its COM objects (has its limitations as explained to Jacque below) to jato access other windows that may be open etc, autoit, autohotkeys among MANY other scripting languages out there that have been doing this for years.

I am requesting a livecode extension or similar to do this because I am just trying to avoid making a Hodgepodge of different scripting language mixes and ending up with what I stated at the end of my original post which stated:

“The developer then has to resort to crudely added bits and pieces of add on software and overly complicate their code unnecessarily to fit them in, defeating what may have been an original elegantly constructed piece of source code and adding a lot of wasted time to make this patch work do anything constructive”.


=== For Jacque ===
I am requesting a livecode extension or similar to do this because I am just trying to avoid making a Hodgepodge of different scripting language mixes and ending up with what I stated at the end of my original post which stated:

“The developer then has to resort to crudely added bits and pieces of add on software and overly complicate their code unnecessarily to fit them in, defeating what may have been an original elegantly constructed piece of source code and adding a lot of wasted time to make this patch work do anything constructive”.

In addition,
Vbscripts native COM objects have limited scope (methods and properties limitations many times require additional third party DLLs such as “jssshellx” or “XNHost.Loaddll” among many other such third party workarounds to access all the necessary window APIs since vbscipts can’t directly access all of the windows APIs.


== For: Fourthworld ==;

See my responses to “For richmond62” and “Jacque”.

I will be looking into your recommended “Livecode builder language” in the near future to see where it leads me in this regard.

It’s just that its YET another thing to learn or YET another “Livecode limitation” to overcome when I feel it should ALREADY be part of the regular livecode capabilities since so many other “barebones” scripting languages out there that are not anywhere near as “powerful” as Livecode as specified in my previous responses, have been successfully exhibiting these functionalities for years.


Thanks for all of your responses, really appreciate the feedback.

Re: window to window functionality lacking?

Posted: Sun Jan 08, 2017 5:01 pm
by jacque
I'm not sure any language or new technique will do what you want. While your motivation may be innocent, other people's may not be. The rise of malware has caused most operating systems to severely limit what one app can do with another. Apple has made it nearly impossible with app sandboxing. I am not as familiar with Windows limitations but I'd be surprised if similar steps have not been taken. Near total restrictions apply on all mobile platforms.

For Windows your best bet is VBScript. LC provides an easy way to incorporate VBScript but you will still be limited by what the OS permits.

Re: window to window functionality lacking?

Posted: Sun Jan 08, 2017 5:38 pm
by richmond62
So there are NO SECURITY issues
I think that as soon as one application starts "talking" to another one; whether local, over a network,
or whatever, there are security problems.

Re: window to window functionality lacking?

Posted: Mon Jan 16, 2017 1:17 pm
by MaxV
Ed_Ray wrote:The regular livecode ver 8 that I have been trying out does not seem capable (unless I am missing something) to communicate and interface with non livecode windows like the windows explorer windows the control panel windows, Firefox launched window, or any window that is not a stack made by the livecode developer.
...
Are you are loooking for open process: http://livecode.wikia.com/wiki/Open_process
or shell() ? ( http://livecode.wikia.com/wiki/Shell )

Re: window to window functionality lacking?

Posted: Tue Jan 24, 2017 6:36 am
by Ed_Ray
for jacque;

You wrote "I'm not sure any language or new technique will do what you want."
Recall I am attempting to send keystrokes and communicate with my OWN launched local window NOT someone else sandboxed app.

Its possible you missed my statement which stated programs already do this TODAY (let you send keystrokes mouse clicks and communicate with ones OWN launched windows (not some one else's app). These have ALREADY have been existing for many years now, so no new technologies are necessary and no OS has ever limited any cmds they send out for the purposes I have stated.

A few repeated examples of such EXISTING programming scripting languages are : Autoit, autohotkeys, pureBasic, ooRexx, tcl/tk, Javauto (the last four are cross platform and typically work with windows,linux and MacOSX and other platforms etc) among so many others too numerous to mention.

Vbscript works too for windows (for example the sendkey vbscript COM object method is used to send keystrokes to another window) but its com object methods are too limited like it can't even wait for a window to become active based on a parcial title or a windows handle because its com objects has limited access to the windows API or similar functionality etc.

Hopefully I have clarified this to the extent that it does make sense for livecode to support communicating beyond just its own created windows for the purposes stated or similar. As I mentioned before, when having to do such simple tasks, livecode is unnecessarily way too limited.

Don't get me wrong, in general, I think livecode is great (that why I use it...smile), its just that sometimes venting becomes necessary particularly when i have spent more than 50 percent of my time on my "almost to be distributed program" that will benefit many Regular expression users, overcoming Livecodes limitations, in order to get the program completed.

In other words, it has taken me more time to overcome some of livecode's limitations than to actually create the code for the program's functionality. This should not be the case.

Anyway, thanks for all of your comments. You seem always very helpful.

Re: window to window functionality lacking?

Posted: Tue Jan 24, 2017 5:22 pm
by jiml
Here's how MS defines sendkey:
Visual Basic for Applications Reference
Visual Studio 6.0
SendKeys Statement
Sends one or more keystrokes to the active window as if typed at the keyboard.
Syntax
SendKeys string[, wait]
LiveCode has always had the TYPE command:
Type command
Syntax
type string [with key [, key [, key ]]]
Summary - Simulates typing on the keyboard.
Is that what you want? Since you say,
"I am attempting to send keystrokes and communicate with my OWN launched local window NOT someone else sandboxed app."

Jim Lambert

Re: window to window functionality lacking?

Posted: Tue Jan 24, 2017 5:57 pm
by jacque
The misunderstanding may be due to terminology. I interpreted your request to mean inter-app communication because you mentioned external windows. If instead you mean communication between two LC windows running in your own standalone then you have many options, one of which is the "type" command as Jim mentioned. You should also look at the "send" and "dispatch" commands. There is also the "click" command.

There is no issue if you are working within your own app. The problem is only when communicating between two independent apps. The examples you listed are installed as, or hook into, system extensions, which is a different thing. LC allows you to tap into these system level extensions but is not one itself.

Re: window to window functionality lacking?

Posted: Wed Jan 25, 2017 2:22 am
by Ed_Ray
For jiml and Jacque;
Thank you for your responses.

Unless I am not understanding the type command I think you folks are still misunderstanding the intent of my needs which is satisfied by all those other scripting programs I mentioned in previous posts.

My understanding of the type command as described in the dictionary is and I directly quote:
“The type command sends a rawKeyDown and rawKeyUp message to the CURRENT CARD for each character typed”

Also I quote:
“The key is one of commandKey, controlKey, optionKey, or shiftKey. You can specify up to three keys, separated by commas”

This means to me type is used to send a string to the “CURRENT CARD”, either a straight string with no keyboard simulation or the string is sent specifying one of the three specified keys.

This is NOT what I need to do in my app. Like I previously mentioned my understanding is that livecode ONLY allows one to send keystrokes to a window one has created WITHIN livecode not to a window launched by ones application that was never created by livecode. That is the problematic limitation.

I will give you a concrete example to make this crystal. I need to fix another livecode limitation where it can’t retain text background colors OUTSIDE of livecode as in the case I have a livecode field that has my output results but the user wants to copy these colored highlights outside of livecode say to a word processing app so that he can manipulate all or part of the results once the livecode app has been closed.

My fix to this is to launch my OWN LOCAL html file from within livecode that is COMPLETELY MINE not some else’s sandboxed app or someone’s information stored on someone’s remote web server. This launched local html file contains an on-the-fly fix to being able to retain text colored backgrounds.

My app needs to re-select/copy the selection the user made from my results field into my OWN local remedied web page. THIS is where I need to send keystrokes Ctrl-A (Select All) and Ctrl-C (copy) to MY OWN local web page so that the app can automatically provide the selection to the user so that the user can then go to any word processing app to PASTE the selection thus RETAINING the text colored backgrounds OUTSIDE of livecode.

While doing this, the OTHER livecode limitation I need to overcome is that livecode does not seem to provide a way that MY OWN launched web page can communicate back to my current livecode card telling it that it now exists and is now active window. This is crucial else I could potentially be sending keystrokes to a window that has not yet emerged since it takes an undetermined amount of time (different per each user’s computer) for the launched web page to come up and be the active web page. Just using a wait command is LAME because you would be only guessing how long this is really going to take.

Lastly my app needs to close MY OWN local web page after it has been left up for two seconds worth of feedback for the user so as not to leave extraneous windows on the users system (although if left, it does not cause anybody any harm since it’s just a copy of what the users wanted for THEMSELVES.)

So in summary livecode does NOT provide the tools to do some VERY SIMPLE task to MY OWN locally launched html file. These are:
[1] Let me know my locally launched web page finally emerged and is now the active window
[2] Let me send it Ctrl-A and Ctrl- C keystrokes for selecting and copying MY own programs information to MY OWN html file.
[3]Let me close MY OWN local html file after leaving it up for 2 secs worth of user feedback.

There really isn’t any valid reason for any programming language to have such limitations particularly when the limitations are only protecting one’s OWN money from one’s OWN piggy bank metaphorically speaking.

Any OS worth anything should easily be able to DISTINGUISH the sequence I have described in detail versus an app trying to invade someone else’s sandboxed app. If it can’t, then I would say shame on such an OS for not being able to do something so obvious and due to not being able to do so, has become an unnecessary continuous security nag.

Again thanks for your both of your inputs.

FOR JACQUE:
Jacque, regarding another unanswered but related post whose subject states: “Unclear on using “sample stacks” from the livecode toolbar” can you be kind enough to provide me guidance there so I can distribute my app and quell the past forum complaints folks have had regarding livecode regular expression functions. I think this app has resolved all of those issues and will make many people happy.

Thanks again always appreciate your help.

Re: window to window functionality lacking?

Posted: Wed Jan 25, 2017 11:11 am
by richmond62
ONLY allows one to send keystrokes to a window one has created WITHIN livecode not to a window launched by ones application that was never created by livecode.
Aha: so, after all the foggy stuff and fudging around, we are getting down to what the "problem" is:

You DO want to send commands from a LiveCode stack/standalone to another application.

Re: window to window functionality lacking?

Posted: Wed Jan 25, 2017 2:49 pm
by Lagi Pittas
Reading this thread I thought I was going mad.

First I "understood" that Ed wanted to send keystrokes to other non livecode windows, then I "understood" they were HIS windows (cards?) launched by livecode and I now really really know that they are windows/programs/processes that have nothing to do with livecode.

I'll be the first to ask for additions that I see missing from Livecode but when it comes to this feature request I have yet to see ANY language or system that have this built in without libraries dll's, COM etc etc which can with some coding be done in Livecode if someone writes the plugin/external/LCB

The languages listed other than Purebasic are all either created for the specific purpose asked for or in the case of Rexx and TCL which are both are originally "glue" script languages with greater facilities added onto the original MACRO/Scripting Paradigm.

We could ask all the makers of the other languages to add all the stuff that makes Livecode so easy to work with - but then that would make them Livecode - i've stopped harping on about adding dot notation :wink:

For this "Problem" I would personally use Purebasic as the "glue" by writing a small exe and shell from Livecode, and when infinite Livecode comes along create a dll using Purebasic (or whatever) and add the calls as a widget into Livecode .

Can you Do this in Ruby or Python without plugins/libraries/extensions?, I don't know but I'm willing to guess no.

One simple method as mentioned by others above was to use the DO As <script language> option> Vbscript, and Jscript being built in and lets be honest sending a key in any language is about finding the command not about learning the language.

In my travels when I last used WSH (more for edification ) I found a couple of useful articles -

http://newsletters.livecode.com/june/is ... etter1.php
https://en.wikipedia.org/wiki/Windows_Script_Host
http://lessons.livecode.com/m/2592/l/12 ... ing-itunes

this one from Simon shows how to control firefox from livecode
http://forums.livecode.com/viewtopic.php?f=7&t=18526


Regards Lagi