Ghost in the Machine

preid at reidit.co.uk preid at reidit.co.uk
Wed Dec 15 11:45:51 EST 2021


Thanks Richard and Alex.

The membership system is web-based and the page I'm trying to interact with contains HTML, php and Javascript material. Therefore the POST construction approach seems to be promising. Unfortunately, the membership details features about 900 lines of LiveCode script, much like the following

...[snip]...
class="start-tag">tr</span>></span><span></span><span><<span
class="start-tag">td</span> <span
class="attribute-name">style</span>="<a
class="attribute-value">width:900px</a>"></span><span>Where You Live</span><span></<span
class="end-tag">td</span>></span><span></span><span></<span
class="end-tag">tr</span>></span><span></span><span></<span
class="end-tag">table</span>></span><span></span><span><<span
class="start-tag">table</span> <span
class="attribute-name">align</span>="<a
class="attribute-value">center</a>" <span
class="attribute-name">border</span>="<a
class="attribute-value">0</a>" <span
class="attribute-name">class</span>="<a
class="attribute-value">tableMain</a>"></span><span></span><span><<span
class="start-tag">tr</span>></span><span></span><span><<span
class="start-tag">td</span> <span
class="attribute-name">style</span>="<a
class="attribute-value">width:100px</a>" <span
class="attribute-name">class</span>="<a
class="attribute-value">middle</a>"></span><span>Address</span><span></<span
class="end-tag">td</span>></span><span></span><span><<span
class="start-tag">td</span> <span
class="attribute-name">style</span>="<a
class="attribute-value">width:800px</a>"></span><span>No/Name </span><span><<span
class="start-tag">input</span> <span
class="attribute-name">type</span>="<a
class="attribute-value">text</a>" <span
class="attribute-name">name</span>="<a
class="attribute-value">ecHouse</a>" <span
class="attribute-name">id</span>="<a
class="attribute-value">ecHouse</a>" <span
class="attribute-name">size</span>="<a
class="attribute-value">10</a>" <span
class="attribute-name">maxlength</span>="<a
class="attribute-value">25</a>" <span
class="attribute-name">value</span>="<a
class="attribute-value">71</a>" <span
class="attribute-name">onChange</span>="<a
class="attribute-value">modified()</a>" <span
class="attribute-name">class</span>="<a
class="attribute-value">vAddress</a>"></span><span><span
class="entity"><span>&</span>nbsp;</span><span
class="entity"><span>&</span>nbsp;</span><span
class="entity"><span>&</span>nbsp;</span><span
class="entity"><span>&</span>nbsp;</span><span
class="entity"><span>&</span>nbsp;</span>Street/Building </span><span><<span
class="start-tag">input</span> 
...[snip]...
 
So I think I'll spend a bit of time looking at the ghost-in-the-machine method; see if it has any legs!

Thanks again

Peter
--
Peter Reid
Loughborough, UK

> On 13 Dec 2021, at 5:00pm, use-livecode-request at lists.runrev.com wrote:
> 
> Today's Topics:
> 
>   1. Re: Ghost in the Machine? (preid at reidit.co.uk)
>   3. Re: Ghost in the Machine? (Richard Gaskin)
>   8. Re: Ghost in the Machine? (Alex Tweedly)
> 
> ----------------------------------------------------------------------
> 
> Message: 1
> Date: Sun, 12 Dec 2021 18:29:03 +0000
> From: preid at reidit.co.uk
> To: use-livecode at lists.runrev.com
> Subject: Re: Ghost in the Machine?
> Message-ID: <B6730A07-370F-4BA1-800D-DB648B97DC05 at reidit.co.uk>
> Content-Type: text/plain;	charset=utf-8
> 
> Thanks Alex, Dan & Tom for responding to this, but I suspect that I didn't explain things well enough, let me elaborate?
> 
> 1. Periodically we have small batches of new members joining a club. We have their details in a CSV file which we'd normally think of doing some kind of batch upload.
> 
> 2. However, the existing club membership system doesn't have a batch load facility only an on-screen form (such as the following) to be typed in:
> 
> +---------------------------------------------------------------------------------+
> |  Surname:[.............]   Firstname(s):[...........]   Initials:[......]       |
> |									          |	
> |	Address:[.............]   Town:[.............]   Phone: [.............]   |
> |	        [.............]   Postcode:[.........]   Mobile:[.............]   |
> |										  |
> |	Email:[....................]   GiftAid:[x]   Payment:(o)Bank  ( )Chq	  |
> +---------------------------------------------------------------------------------+
> 
> 3. We want a way to upload a group of new members by 'driving' the input fields, i.e. our app would click into each field, checkbox, radiobox and 'type' in the details.
> 
> 4. We don't have access to the membership system's coding, it's one off the shelf. We just want do what we might have attempted some years ago, during the terminal/command line days! In those old days, we'd redirect the stdin, stdout, stderror.
> 
> So my query is really as follows:
> a) is this kind of 'channel' redirection possible, can we send mouse clicks, type keys to enter text into fields etc?
> b) has anyone done something like this? 
> c) does anyone have any methods and/or code they can let me have for this?
> 
> My overview of what's required is as follows (assuming no show-stoppers):
> - I make an overlay map, transparent everywhere except where there are input fields ? this could be an actual map with "X"s over entry fields, spaces elsewhere, but might simply be a list of objects expressed as coordinate rectangles
> - we take the name of a field, 'Surname' say, and lookup its location on the screen
> - we position our virtual mouse to click into the location where the equivalent field can be found
> - we enter its value as virtual keystrokes and click the 'tab' key to move to the next input object
> 
> Any idea whether this is possible and any code examples?!
> 
> Thanks.
> 
> Peter
> ------------------------------
> 
> Message: 3
> Date: Sun, 12 Dec 2021 11:38:20 -0800
> From: Richard Gaskin <ambassador at fourthworld.com>
> To: use-livecode at lists.runrev.com
> Subject: Re: Ghost in the Machine?
> Message-ID: <a8790e72-0aff-f373-f0c8-0892101756d3 at fourthworld.com>
> Content-Type: text/plain; charset=utf-8; format=flowed
> 
> Peter Reid wrote:
> 
>> We want a way to upload a group of new members by 'driving' the input
>> fields, i.e. our app would click into each field, checkbox, radiobox
>> and 'type' in the details.
> 
> If the goal is to submit new member info you can do that with a single 
> POST command.
> 
> Examine the source HTML. Look for the action URL.  Look at the input 
> names. Package up the input data as name-value pairs form-encoded, send 
> it to the URL via POST, and you're done.
> 
> -- 
>  Richard Gaskin
>  Fourth World Systems
>  Software Design and Development for the Desktop, Mobile, and the Web
>  ____________________________________________________________________
>  Ambassador at FourthWorld.com                http://www.FourthWorld.com
> 
> ------------------------------
> 
> Message: 8
> Date: Mon, 13 Dec 2021 01:36:51 +0000
> From: Alex Tweedly <alex at tweedly.net>
> To: use-livecode at lists.runrev.com
> Subject: Re: Ghost in the Machine?
> Message-ID: <0fc4be03-ba78-c5e8-deca-fe4aca6144bd at tweedly.net>
> Content-Type: text/plain; charset=UTF-8; format=flowed
> 
> Peter,
> 
> I think the piece of info we are all missing (or guessing wrongly about) is:
> 
> the existing club membership system - is it a web-based system, or an app that runs on your desktop.
> 
> We're all kind of assuming it's a web page, but I now suspect maybe it isn't.
> 
> If it is a web page - then the answers so far are all relevant, and should be straightforward to try out.
> 
> [My suggestion re. the browser widget still feels like the "right official" way to do it - but personally I'd look at the html and see if I could POST the correct info - i.e. what Richard said :-)  ]
> 
> If it's a custom app, then it's a very different question - and I currently have no idea. If so, please say a little bit more about the custom app, or put up a screenshot / video somewhere.
> 
> Alex.
> 
> On 12/12/2021 18:29, Peter Reid via use-livecode wrote:
>> Thanks Alex, Dan & Tom for responding to this, but I suspect that I didn't explain things well enough, let me elaborate?
>> 
>> 1. Periodically we have small batches of new members joining a club. We have their details in a CSV file which we'd normally think of doing some kind of batch upload.
>> 
>> 2. However, the existing club membership system doesn't have a batch load facility only an on-screen form (such as the following) to be typed in:
>> 
>> +---------------------------------------------------------------------------------+
>> |  Surname:[.............]   Firstname(s):[...........]   Initials:[......]       |
>> |									          |	
>> |	Address:[.............]   Town:[.............]   Phone: [.............]   |
>> |	        [.............]   Postcode:[.........]   Mobile:[.............]   |
>> |										  |
>> |	Email:[....................]   GiftAid:[x]   Payment:(o)Bank  ( )Chq	  |
>> +---------------------------------------------------------------------------------+
>> 
>> 3. We want a way to upload a group of new members by 'driving' the input fields, i.e. our app would click into each field, checkbox, radiobox and 'type' in the details.
>> 
>> 4. We don't have access to the membership system's coding, it's one off the shelf. We just want do what we might have attempted some years ago, during the terminal/command line days! In those old days, we'd redirect the stdin, stdout, stderror.
>> 
>> So my query is really as follows:
>> a) is this kind of 'channel' redirection possible, can we send mouse clicks, type keys to enter text into fields etc?
>> b) has anyone done something like this?
>> c) does anyone have any methods and/or code they can let me have for this?
>> 
>> My overview of what's required is as follows (assuming no show-stoppers):
>> - I make an overlay map, transparent everywhere except where there are input fields ? this could be an actual map with "X"s over entry fields, spaces elsewhere, but might simply be a list of objects expressed as coordinate rectangles
>> - we take the name of a field, 'Surname' say, and lookup its location on the screen
>> - we position our virtual mouse to click into the location where the equivalent field can be found
>> - we enter its value as virtual keystrokes and click the 'tab' key to move to the next input object
>> 
>> Any idea whether this is possible and any code examples?!
>> 
>> Thanks.
>> 
>> Peter





More information about the use-livecode mailing list