Paste Text into Browser [accepting bids for solution]

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller

Post Reply
townsend
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 430
Joined: Sun Feb 13, 2011 8:43 pm
Location: Seattle, USA

Paste Text into Browser [accepting bids for solution]

Post by townsend » Tue Feb 23, 2016 11:11 pm

I've tried a few things. Nothing has worked. I'm sure there must be a way.
How about I pay someone (you) to figure this out for me? Here's the project.

Below I have a simple 5 second timer. Just drop this into any button and it works.
At the end of 5 seconds there's a beep. I need you to add to or modify this code so that;

After I click the Start button, (before the 5 seconds is over),
I move my cursor and place it in any field in any browser,
(ideally Chrome), and have LiveCode paste in some text,
"any text" to the browser field, at the end of the 5 seconds.
Is this possible? Can you do this?

Send me a personal message with a bid.
How much money would you need to do this for me?
I'd like to act on this as soon as possible.

PS: I hope this is the right place to post contract proposals.

Code: Select all

-- count-up seconds timer v3, written by me
-- just drop this code into any button and click to start

local started, cntr

on mouseUp
     if the label of me <> "Start" then set the label of me to "Start"
     if the label of me = "Start" then
          put the long seconds into started
          put (the long seconds - started) into cntr
          set the label of me to cntr
          countUp
     else if value(the label of me) >0 then
          set the label of me to "Start"
     end if
end mouseUp

on countUp
     if cntr >5 then  -------> SET TIMER VALUE in SECONDS <-------
          set the label of me to "Start"
          exit to top
     else 
          if the label of me = "Start" then
               exit to top
          else
               put (the long seconds - started) into cntr
               set the label of me to cntr
          end if
     end if
     -- breakpoint
     send "countUp" to me in 0.2 seconds
end countUp

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 8280
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Paste Text into Browser [accepting bids for solution]

Post by FourthWorld » Tue Feb 23, 2016 11:30 pm

What do you want done with the text after it's in the browser? Are you submitting a form?

Sounds similar to this recent thread:
http://forums.livecode.com/viewtopic.php?f=8&t=26549
Richard Gaskin
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

townsend
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 430
Joined: Sun Feb 13, 2011 8:43 pm
Location: Seattle, USA

Re: Paste Text into Browser [accepting bids for solution]

Post by townsend » Tue Feb 23, 2016 11:52 pm

Hey Richard! Thanks for the link. This would be a lot easier if I were working with LiveCode's built in revBrowser, but I'm looking to integrate this with an external browser. No need to worry about submitting a form. This is just a small part of a larger project... but this one particular problem has me stumped.

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

Re: Paste Text into Browser [accepting bids for solution]

Post by SparkOut » Wed Feb 24, 2016 12:26 am

Is the project getting to paste text from the clipboard into a field in a browser, where the clipboard text was captured by LiveCode? And you will manually click a button in LiveCode to start a timer and during the timing period of 5 seconds, you will manually move the mouse and select a field in the browser that will have the clipboard text pasted into after the duration of the timer?

townsend
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 430
Joined: Sun Feb 13, 2011 8:43 pm
Location: Seattle, USA

Re: Paste Text into Browser [accepting bids for solution]

Post by townsend » Wed Feb 24, 2016 12:57 am

SparkOut wrote:Is the project getting to paste text from the clipboard into a field in a browser, where the clipboard text was captured by LiveCode? And you will manually click a button in LiveCode to start a timer and during the timing period of 5 seconds, you will manually move the mouse and select a field in the browser that will have the clipboard text pasted into after the duration of the timer?
Yeah. That's it. The text would first need to be moved into the clipboard from LiveCode, and then from LiveCode, the text would eventually be pasted into the browser's field. The BIG problem is, once focus moves from LiveCode to the browser, the pasted test never ends up in the browser.

I've updated the code a bit. The Beep at the end of the routine was left out before. Also, I've added a set the systemWindow command... which doesn't seem to make any difference.

Code: Select all

-- count-up seconds timer v3, written by me
-- just drop this code into any button and click to start

set the systemWindow of stack "test3" to true
local started, cntr

on mouseUp
     if the label of me <> "Start" then set the label of me to "Start"
     if the label of me = "Start" then
          put the long seconds into started
          put (the long seconds - started) into cntr
          set the label of me to cntr
          countUp
     else if value(the label of me) >0 then
          set the label of me to "Start"
     end if
end mouseUp

on countUp
     if cntr >5 then  -------> SET TIMER VALUE in SECONDS <-------
          set the label of me to "Start"
          paste
          beep -----------> Here's the end of the routine
          exit to top
     else 
          if the label of me = "Start" then
               exit to top
          else
               put (the long seconds - started) into cntr
               set the label of me to cntr
          end if
     end if
     -- breakpoint
     send "countUp" to me in 0.2 seconds
end countUp

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3460
Joined: Sun Jan 07, 2007 9:12 pm
Location: Bochum, Germany

Re: Paste Text into Browser [accepting bids for solution]

Post by bn » Wed Feb 24, 2016 6:22 am

Hi,

You are trying to do some sort of Inter Application Communication. LC can not do this natively without using either shell, AppleScript or some Windows equivalent.

if you are on a Mac then you could try something like this:

it pastes the clipboard into an open TextEdit document (the frontmost) at the cursor location. Did not try this with a browser.

make a field, call it "fAS"
paste this into the field

Code: Select all

activate application "TextEdit"
delay 0.2

tell application "System Events"
	keystroke "v" using command down -- this is same as CMD-V
end tell
now use your button with this code

Code: Select all

-- count-up seconds timer v3, written by me
-- just drop this code into any button and click to start

local started, cntr

on mouseUp
     if the label of me <> "Start" then set the label of me to "Start"
     if the label of me = "Start" then
          put the long seconds into started
          put (the long seconds - started) into cntr
          set the label of me to cntr
          countUp
     else if value(the label of me) >0 then
          set the label of me to "Start"
     end if
end mouseUp

on countUp
     if cntr >5 then  -------> SET TIMER VALUE in SECONDS <-------
        set the label of me to "Start"
        put field "fAS" into tAS
        do tAS as appleScript
       -- put the result into field 1
          beep -----------> Here's the end of the routine
          exit to top
     else 
          if the label of me = "Start" then
               exit to top
          else
               put (the long seconds - started) into cntr
               set the label of me to cntr
          end if
     end if
     -- breakpoint
     send "countUp" to me in 0.2 seconds
end countUp
this is of course extremely minimalistic, just pasting. But if that is what you want then this might work for you.

If you manually choose the browser and the insertion location you can leave out the first part of the AppleScript: activate application "TextEdit" and delay 0.2

Kind regards
Bernd

townsend
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 430
Joined: Sun Feb 13, 2011 8:43 pm
Location: Seattle, USA

Re: Paste Text into Browser [accepting bids for solution]

Post by townsend » Wed Feb 24, 2016 7:06 pm

bn wrote:You are trying to do some sort of Inter Application Communication. LC can not do this natively without using either shell, AppleScript or some Windows equivalent.
Thanks Bernd. Yes, that is now becoming very clear, as originally implied by Richards reference to the other similar post:
http://forums.livecode.com/viewtopic.php?f=8&t=26549

I'm not set up for Mac development, though with all the new LC iPhone utilities, I should seriously consider this. Anyway, using Shell or AppleScript would not be appropriate here, and since I've received no bids, I'm inclined to conclude this is not possible.

Though, I do have a budget from my client on this project, and now that I know not to waste any more time on this problem, I want you to know I appreciate you 3 chipping in with your insights. So, if each of you, Richard, SparkOut, and Bernd, would send me a private message with your email address, I'd be glad to send you some payPal tip money.

bn
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3460
Joined: Sun Jan 07, 2007 9:12 pm
Location: Bochum, Germany

Re: Paste Text into Browser [accepting bids for solution]

Post by bn » Wed Feb 24, 2016 7:15 pm

Hi townsend,
private message with your email address, I'd be glad to send you some payPal tip money.
thank you for the offer but no tip money needed.

You should be able to do this via VBScript. Though I have no experience with this.

try a Google search with "vbscript paste from clipboard", there are many hits.

Kind regards

Bernd

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 8280
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Paste Text into Browser [accepting bids for solution]

Post by FourthWorld » Wed Feb 24, 2016 9:02 pm

townsend wrote:Anyway, using Shell or AppleScript would not be appropriate here, and since I've received no bids, I'm inclined to conclude this is not possible.
Without knowing the goal of the system it'll be hard to advise, but if it's for emulating user behaviors you may want to explore Egglant, a tool for developing testing systems that has under its hood a rather xtalk-like scripting language:
http://www.testplant.com/eggplant/testing-tools/
Though, I do have a budget from my client on this project, and now that I know not to waste any more time on this problem, I want you to know I appreciate you 3 chipping in with your insights. So, if each of you, Richard, SparkOut, and Bernd, would send me a private message with your email address, I'd be glad to send you some payPal tip money.
I appreciate the offer, but I haven't done anything yet. If you're feeling incorrigibly generous you could let me know when you're passing through LA and we'll have a meal.
Richard Gaskin
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

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

Re: Paste Text into Browser [accepting bids for solution]

Post by SparkOut » Wed Feb 24, 2016 11:49 pm

Given the problem as above, this is also pretty straightforward on Windows. Send me a PM with some more specific notes about what you want to be able to choose to do, and I am sure we can knock up a solution.

tetsuo29
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 63
Joined: Thu Jun 07, 2007 1:30 am

Re: Paste Text into Browser [accepting bids for solution]

Post by tetsuo29 » Fri Feb 26, 2016 1:53 pm

Hi.

I took your code and put it in a button.

Then I added a field and named it "Statements"

In the "Statements" field I placed the following code:

Code: Select all

Set WshShell = CreateObject("WScript.Shell")
WshShell.SendKeys "^v"
In your code, I made the following modification:

Code: Select all

on countUp
   if cntr >5 then  -------> SET TIMER VALUE in SECONDS <-------
       do text of field "Statements" as VBScript
When I click the "Start" button, your script will count up for 5 seconds and when it is finished, it will paste whatever is in the clipboard into whatever app is in the foreground. If this is Chrome, then it pastes the contents of the clipboard into Chrome if a field has the focus.

Hopefully this helps.

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”