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" <[EMAIL PROTECTED]> 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
[EMAIL PROTECTED]

Semantic Compaction Systems
SCIconics, LLC

Lazy River Metal Arts
Lazy River Software™
&
Meeting Wear™ - Unique Apparel Design






_______________________________________________
use-revolution mailing list
use-revolution@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@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@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@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to