How do I control a Java applet in my browser from Rev?

Dennis Brown see3d at writeme.com
Wed Dec 14 21:58:48 EST 2005


Mark, Tom, Jim, Terry, Xavier,

Thanks for all your suggestions.  I thought there was going to be a  
simple answer when I ask it.  The good news is that it appears to be  
in the realms of doablity.  The bad news is that I have avoided  
learning Applescript and Javascript until now.  Yet I am willing to  
at least put my big toe in the water if that is what it takes.

I am looking at the source HTML with some Javascript for the page in  
question right now.  I can see that the page source is created just  
for me, because it has URL's and passwords for me embedded into text  
constants.  It seems to have some interesting definitions in it that  
leads me to believe that the field I want to input to is accessible  
through the page source.  Since the page is full of URLs as to where  
to find things on the server, I figure it would break soon if I just  
took the script and changed the parts I want to.  I have hacked it to  
remove all the extraneous stuff like Ads, etc. to get the source down  
to readable size --a couple of pages --it even still sort of works.

I think if I could change the values of the following params that are  
in the Javascript, it might work:

   <param name="SYMBOL" value="NASDAQ:QQQQ" />
   <param name="SymbolChange" value="1" />

I would just grab the HTML into a file and edit it on the fly, but  
reloading the page causes the script to take a long time to start up,  
and it does not save the chart settings --they all revert to startup  
defaults.  So my best bet is changing these parameters while it is  
running.

Am I on the right track here?

I could email the HTML source to someone if you would not mind taking  
a quick look at it to see if this approach is likely to work.  (I  
changed the password, but it still runs --just won't connect for the  
real quote data).

Dennis

On Dec 14, 2005, at 6:53 PM, Mark Smith wrote:

> A useful thing can also be to store your applescripts in custom  
> properties, with place-holders for values and then:
>
> put the myApplescript of me into tScript
> replace <placeholder> with <value> in tScript
> do tScript as applescript
>
>
> an example (including a bit of javaScript):
>
> a custom property called jsSetAndGetAS contains:
>
> set tScr to "
> document.ResultSel.Day.selectedIndex = dd;
> document.ResultSel.Month.selectedIndex = mm;
> document.ResultSel.Year.selectedIndex = yy;
> ResultsSubmit()"
>
> tell application "Safari"
> do JavaScript tScr in document 1
> end tell
>
> and then in my app I have
>
> put the jsSetAndGetAS of me into tScript
> replace "dd" with dayOfMonth() in tScript
> replace "mm" with MonthNum() in tScript
> replace "yy" with getYear() in tScript
>
> do tScript as applescript
>
>
> building applescripts in a rev script can get hard to read.
>
> Cheers,
>
> Mark
>
> On 14 Dec 2005, at 23:25, Jim Ault wrote:
>
>> Dennis,   you said
>>> I thought Safari would have been more scriptable.
>> There is a difference between 'recordable' and "scriptable' where  
>> Safari is
>> amazingly scriptable.  The key to your solution may be the following:
>>
>> You might want to check the Applescript dictionary for Safari for
>> Do Javascript command
>> this will send a JavaScript command to the active browser window  
>> and active
>> tab in that window.  This could be a 'one-liner'.
>>
>> A more complictated way is to use UI Elements (User Interface  
>> Elements)
>> which are quite resplendent in Safari.  You can even get the text  
>> string
>> that is in a static text piece in a java applet!
>>
>> I have not done this myself, but this should be the framework plus  
>> a few
>> details......
>> Try along these lines:
>> Transcript code
>>
>> open Safari, go url 'stock page', store the name of the window(or  
>> window ID)
>>
>> ----build the javascript command
>> put "beginning chars "& \
>> quote & "quotedStr" & quote & \
>> " end  chars" into javaStrMadeInRev
>> ---------- done building the javascript command
>>
>> put "tell app "&quote&"Safari"&quote into cmd
>> --optional could be "activate window id "& theStockTickerID
>> --optional could be "activate window "& theStockTickerName
>> put cr & "do javascript "& quote & javaStrMadeInRev & quote after cmd
>> put cr & "end tell" after cmd
>> do cmd as applescript
>> put the result into answerFromSafariWhichShouldBeThePriceILike
>>
>> HTH
>> Jim Ault
>> Las Vegas
>>
>> On 12/14/05 10:35 AM, "Dennis Brown" <see3d at writeme.com> wrote:
>>
>>> Tom,
>>>
>>> I was surprised that it did not, but the docs says that it will not
>>> do that.  If I clicked in the Finder areas, it only recorded that I
>>> selcted the Finder.  It did not record anything when I clicked on
>>> other applications.  I thought Safari would have been more  
>>> scriptable.
>>>
>>> Dennis
>>>
>>> On Dec 14, 2005, at 1:12 PM, Thomas McGrath III wrote:
>>>
>>>> Dennis,
>>>>
>>>> The recording function -- Are you able to at least record a click
>>>> at the button location?
>>>>
>>>> Tom
>>>>
>>>> On Dec 14, 2005, at 1:00 PM, Dennis Brown wrote:
>>>>
>>>>> I also tried Automator and tried the recording function in
>>>>> Applescript Studio, but no good.
>>>>
>>>> Thomas J McGrath III
>>>> 3mcgrath at adelphia.net
>>>>
>>>> Semantic Compaction Systems
>>>> SCIconics, LLC
>>>>
>>>> Lazy River Metal Arts
>>>> Lazy River Software™
>>>> &
>>>> Meeting Wear™ - Unique Apparel Design
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> use-revolution mailing list
>>>> use-revolution at lists.runrev.com
>>>> Please visit this url to subscribe, unsubscribe and manage your
>>>> subscription preferences:
>>>> http://lists.runrev.com/mailman/listinfo/use-revolution
>>>
>>> _______________________________________________
>>> use-revolution mailing list
>>> use-revolution at lists.runrev.com
>>> Please visit this url to subscribe, unsubscribe and manage your  
>>> subscription
>>> preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-revolution
>>
>>
>> _______________________________________________
>> use-revolution mailing list
>> use-revolution at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your  
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-revolution
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution




More information about the use-livecode mailing list