Mimic Keyboard Input - Background Process

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
glen930
Posts: 4
Joined: Mon Jul 24, 2006 5:28 pm

Mimic Keyboard Input - Background Process

Post by glen930 » Fri Jan 14, 2011 6:17 pm

Hello,

I am trying to build a stack that would mimic a keyboard with other actives apps. Basically, if the cursor were placed on a field on a web page of a browser for example, I could use my stack to fire off a macro that would fill the field with text. Obviously, the browser would be the active app at that point, not my stack. Can LiveCode be active as a background process?

I'm not sure if this is even possible with LiveCode, is it?

Thanks in advance for your help.

Glen

doc
Posts: 148
Joined: Fri Jun 09, 2006 4:30 pm

Re: Mimic Keyboard Input - Background Process

Post by doc » Fri Jan 14, 2011 7:21 pm

Not sure about LiveCode (guru's can chime in at any time), but if you are using Windows, either of these freebies should do what you want:

AutoHotKey
http://www.autohotkey.com/

AutoIt
http://www.autoitscript.com/autoit3/index.shtml

newpie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 155
Joined: Sat Jun 29, 2013 11:24 pm

Re: Mimic Keyboard Input - Background Process

Post by newpie » Sun Jun 15, 2014 3:50 am

Hello, I am aware this is an old post, but it sums up my question as well except for the fact I am trying to move away from autohotkey entirely or at least partially. Can LiveCode perform send commands, activate window ____, copy text to a variable, and such. I much rather use LiveCode as my as my main base than autohotkey as I find it more professional it seems and good support.

Thanks

SparkOut
Posts: 2944
Joined: Sun Sep 23, 2007 4:58 pm

Re: Mimic Keyboard Input - Background Process

Post by SparkOut » Sun Jun 15, 2014 9:05 am

LiveCode certainly can help with *some* of those sort of things (such as storing a vbscript to "do" something, such as "sendkeys"). Interacting directly with other applications by manipulating their controls is not LiveCode's forte though. Where LC really does score is in web interaction. Instead of faking keystrokes to fill in a web form and click a submit button to post the data, you can create the post directly in LC and submit.
For instance http://forums.livecode.com/viewtopic.php?f=7&t=16602

newpie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 155
Joined: Sat Jun 29, 2013 11:24 pm

Re: Mimic Keyboard Input - Background Process

Post by newpie » Sun Jun 15, 2014 12:52 pm

Thanks for replying SparkOut, I am pretty familiar with autohotkey and I would say the number one thing I would need done is basically screen scraping, gathering data from a highlight-able text field and storing as variable so LiveCode could use it. Would VB Script be able to achieve this that you know of.

Thanks for the link also.

SparkOut
Posts: 2944
Joined: Sun Sep 23, 2007 4:58 pm

Re: Mimic Keyboard Input - Background Process

Post by SparkOut » Sun Jun 15, 2014 2:16 pm

I guess it *could* but you would be better off sticking with what you know if you are going to go the 3rd party route.
What you could do better in LiveCode is to "get" the URL (directly - without using a browser at all) and then parsing the returned page data to extract the variable information you need.

newpie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 155
Joined: Sat Jun 29, 2013 11:24 pm

Re: Mimic Keyboard Input - Background Process

Post by newpie » Sun Jun 15, 2014 3:15 pm

That is a great idea, unfortunately I am working with standalone programs, not URLs. I assume that LiveCode can parse a CSV file so I could just have LiveCode activate an exe file of hotkey and then have hotkey send data to a csv file, then have LiveCode read the csv file to use the data.

SparkOut
Posts: 2944
Joined: Sun Sep 23, 2007 4:58 pm

Re: Mimic Keyboard Input - Background Process

Post by SparkOut » Sun Jun 15, 2014 3:25 pm

Yes, that's the way I think you'd need to go. Some similarities with this approach: http://forums.livecode.com/viewtopic.ph ... 18#p101118

newpie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 155
Joined: Sat Jun 29, 2013 11:24 pm

Re: Mimic Keyboard Input - Background Process

Post by newpie » Sun Jun 15, 2014 3:36 pm

Ok thanks SparkOut, I will try to limit the use of hotkey if possible. You mentioned VBScript, by chance you have a suggested link where I can learn this aspect. Thanks for help.

SparkOut
Posts: 2944
Joined: Sun Sep 23, 2007 4:58 pm

Re: Mimic Keyboard Input - Background Process

Post by SparkOut » Mon Jun 16, 2014 6:28 pm

I guess it depends to some extent what applications you are using and what objects they expose to windows scripting control via vbscript.
An example is here http://opencodeproject.com/2012/01/29/a ... -vbscript/
Whether you can achieve what you wish using vbscript interaction with your applications called from LiveCode I can't really say.
Googling briefly should give you many vbscript resources, if you do manage to go down this route. Good luck!

Post Reply