Re: Rev && appleScript

2009-01-13 Thread Timothy Miller

Wonderful!

Petathanks to Sarah, Mark, Ben, BNig, Kay and Jim.

Tim


On Jan 13, 2009, at 4:38 PM, Jim Ault wrote:

The biggest reason me to use 'return' in AppleScripts called by Rev  
is that
you can build whatever you wish as a return value and make sure it  
gets

returned in the format you want.

AppleScript has an odd view of text, paragraphs, lists, and items,  
as well

as folder paths.

Jim Ault
Las Vegas



___
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


Re: Rev && appleScript

2009-01-13 Thread Jim Ault
The biggest reason me to use 'return' in AppleScripts called by Rev is that
you can build whatever you wish as a return value and make sure it gets
returned in the format you want.

AppleScript has an odd view of text, paragraphs, lists, and items, as well
as folder paths.

Jim Ault
Las Vegas

On 1/13/09 3:57 PM, "Kay C Lan"  wrote:

> On Wed, Jan 14, 2009 at 5:00 AM, Mark Schonewille <
> m.schonewi...@economy-x-talk.com> wrote:
> 
>> 
>> To return a value back to Revolution, use the return command :-)
>> 
>> put "set x to 12" & cr & "return x" into myScript
>> do myScript as AppleScript
>> put the result into rslt
>> 
> 
> Not a professional programmer so there may be a good reason to 'return' the
> result, but I don't think it's necessary. I extract stuff from applescript
> all the time to Rev without using 'return'.
> 
> Try this in Rev's multi-line Message box:
> 
> put "set x to 12" into myScript
>do myScript as AppleScript
> put the result
> 
> My understanding is that whatever happened on the last line in applescript
> will end up in 'the result' in Rev automatically. If applescript fails mid
> execution I believe an error message, if there is one, will end up in Rev's
> 'the result'.
> 
> For cross platform compatibility maybe it's a good idea as I note the Doc's
> mentioning defining a global variable 'result' in VBscript for Windows as no
> automatic result occurs.
> 
> HTH
> ___
> 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


Re: Rev && appleScript

2009-01-13 Thread Kay C Lan
On Wed, Jan 14, 2009 at 5:00 AM, Mark Schonewille <
m.schonewi...@economy-x-talk.com> wrote:

>
> To return a value back to Revolution, use the return command :-)
>
> put "set x to 12" & cr & "return x" into myScript
> do myScript as AppleScript
> put the result into rslt
>

Not a professional programmer so there may be a good reason to 'return' the
result, but I don't think it's necessary. I extract stuff from applescript
all the time to Rev without using 'return'.

Try this in Rev's multi-line Message box:

put "set x to 12" into myScript
   do myScript as AppleScript
put the result

My understanding is that whatever happened on the last line in applescript
will end up in 'the result' in Rev automatically. If applescript fails mid
execution I believe an error message, if there is one, will end up in Rev's
'the result'.

For cross platform compatibility maybe it's a good idea as I note the Doc's
mentioning defining a global variable 'result' in VBscript for Windows as no
automatic result occurs.

HTH
___
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


Re: Rev && appleScript

2009-01-13 Thread BNig

if you just want to know if firefox is open then you might try this

 do "tell application" & quote & "Finder" & quote & "to return the name of
every process contains" & quote & "firefox-bin" & quote &"" as applescript
 put the result

works for me, watch out for linebrakes, this is two lines, the 'do' line and
the 'put the result' line
hth
Bernd
-- 
View this message in context: 
http://www.nabble.com/RevappleScript-tp21444118p21447094.html
Sent from the Revolution - User mailing list archive at Nabble.com.

___
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


Re: Rev && appleScript

2009-01-13 Thread Ben Rubinstein

Timothy Miller wrote:

When I

do  as "applescript"

is it possible for applescript to pass a variable or function or 
something back to rev?


For instance, just to keep it simple, could I somehow use "the result" 
from appleScript in a Rev script?


Yes.  If you test "the result" immediately after 'do'ing some applescript, it 
will contain the result the of the applescript - or an error.


So for example
do "get 2 + 3" as applescript; put the result

is a very slow way to add; while,

do "get 2 + " as applescript; put the result

will put "compiler error".

If someone can applescript off the cuff and is feeling generous, I want 
to use Rev to check if "/applications/firefox.app" is running. 
Suggestions received gratefully.


I tried checking the openProcesses, but it doesn't seem to work 
reliably, and it doesn't work if I launch the application outside of Rev.


There might well be a (better) way of doing this natively - and I suspect that 
failing that you could do it better using the shell command - but to answer 
your question, I happen to have just been looking at a really ancient stack 
dating back to Mac OS 9, which included these functions:


   function theProcesses
 put "set res to" && quote & quote & return \
 & "repeat with p in the processes" & return \
 & " set res to res & (the name of p) & return" & return \
 & "end repeat" & return \
 & "return res" & return \
 into scrpt
 get doAs(scrpt, "Finder")
 replace numtochar(13) with return in it
 delete first char of it -- quote
 delete last char of it -- quote
 return it
   end theProcesses

   function doAs cod, proc
 put "tell application" && quote & proc & quote & return into asCom
 put cod after asCom
 if last char of cod <> return then put return after asCom
 put "end tell" & return after asCom
 do asCom as applescript
 return the result
   end doAs

HTH,

Ben

___
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


Re: Rev && appleScript

2009-01-13 Thread Mark Schonewille

Hi Tim,

On a side note, I don't think that you need to put "AppleScript"  
between quotes.


To return a value back to Revolution, use the return command :-)

put "set x to 12" & cr & "return x" into myScript
do myScript as AppleScript
put the result into rslt

--
Best regards,

Mark Schonewille

Economy-x-Talk Consulting and Software Engineering
http://economy-x-talk.com
http://www.salery.biz
Dutch forum: http://runrev.info/rrforum

We are always looking for new projects! Feel free to contact us to  
discuss your custom software project!


On 13 jan 2009, at 19:29, Timothy Miller wrote:


When I

do  as "applescript"

is it possible for applescript to pass a variable or function or  
something back to rev?


For instance, just to keep it simple, could I somehow use "the  
result" from appleScript in a Rev script?


If someone can applescript off the cuff and is feeling generous, I  
want to use Rev to check if "/applications/firefox.app" is running.  
Suggestions received gratefully.


I tried checking the openProcesses, but it doesn't seem to work  
reliably, and it doesn't work if I launch the application outside of  
Rev.


Thanks in advance,

Tim



___
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


Re: Rev && appleScript

2009-01-13 Thread Sarah Reichelt
On Wed, Jan 14, 2009 at 4:29 AM, Timothy Miller
 wrote:
> When I
>
> do  as "applescript"
>
> is it possible for applescript to pass a variable or function or something
> back to rev?
>
> For instance, just to keep it simple, could I somehow use "the result" from
> appleScript in a Rev script?

Yes, you can. Have the AppleScript end with a "return" and in Rev,
check "the result".

> If someone can applescript off the cuff and is feeling generous, I want to
> use Rev to check if "/applications/firefox.app" is running. Suggestions
> received gratefully.

Here is my function for checking any application:

function isAppRunning pAppName
put "tell application " & quote & "System Events" & quote & cr into tScript
put "return (exists application process " & quote & pAppname &
quote & ")" & cr after tScript
put "end tell" after tScript
do tScript as AppleScript
return the result
end isAppRunning


HTH,
Sarah
___
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


Rev && appleScript

2009-01-13 Thread Timothy Miller

When I

do  as "applescript"

is it possible for applescript to pass a variable or function or  
something back to rev?


For instance, just to keep it simple, could I somehow use "the result"  
from appleScript in a Rev script?


If someone can applescript off the cuff and is feeling generous, I  
want to use Rev to check if "/applications/firefox.app" is running.  
Suggestions received gratefully.


I tried checking the openProcesses, but it doesn't seem to work  
reliably, and it doesn't work if I launch the application outside of  
Rev.


Thanks in advance,

Tim
___
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


Re: REV, Applescript, Javascript technique

2006-03-12 Thread Phil Davis

Jim -

Shot in the dark: Do your Safari browser settings allow the applescript 
to work as intended? Or are there some OS settings that prevent things 
from working right?


Thanks -
Phil Davis


Jim Ault wrote:

Hope there is a simple answer to the following:

Using Rev to coordinate getting account info via the web.
Used to work, but not does not for some strange reason.
Rev sets the clipboard then calls...
tell application "Safari"
set safariJavaCmdStr to the clipboard
do JavaScript safariJavaCmdStr in document 1
end tell

Document 1 is the current web page frontmost.
The safariJavaCmdStr is the same code as the link on the web page that opens
a popup window when clicked to show detail.  Clicking works.

onclick=popup = window.open('','detailPopup', 'scrollbars')more code

When this window is showing, I tell Safari to...

set sorce to the source of the front document
then tell BBEdit to do some fancy RegEx to extract the essentials
then back to Rev to catalog and loop to the next popup window link.

This worked 6 months ago, OSX 10.3.9 Safari Version 1.3.1 (312.3.1)
Currently does not work on older G4, Panther 10.3.8, Rev 2.5.1
--or--
Now on Tiger 10.4.2 with both Safari Version 1.3.1 (312.3.1) & Version 2.0
(412.2)

Another test was.
Sending the javaScript command directly from Script Editor (also fails with
no change or message in Safari)

This is the command (watch word wrap.. all one line)...
onclick=\"popup = window.open('','detailPopup',
'scrollbars');popup.blur();document.TransactionListForm.gradeNumber.value =
91629973; document.TransactionListForm.ticketNumber.value = 0;
document.TransactionListForm.wagerNumber.value = 0;
document.TransactionListForm.submit(); return

I am not conversant in JavaScript, but understand enough try for a solution
if I had a few clues.  Is there another way to open a series of these
'detail popup' windows, get the source, close and do the next in a loop?

Why doesn't Applescript/Safari work with the do javaScript command?

Thanks for any guidance or help.  The manual method can work, but what a
pain.

Jim Ault
Las Vegas


___
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


REV, Applescript, Javascript technique

2006-03-12 Thread Jim Ault
Hope there is a simple answer to the following:

Using Rev to coordinate getting account info via the web.
Used to work, but not does not for some strange reason.
Rev sets the clipboard then calls...
tell application "Safari"
set safariJavaCmdStr to the clipboard
do JavaScript safariJavaCmdStr in document 1
end tell

Document 1 is the current web page frontmost.
The safariJavaCmdStr is the same code as the link on the web page that opens
a popup window when clicked to show detail.  Clicking works.

onclick=popup = window.open('','detailPopup', 'scrollbars')more code

When this window is showing, I tell Safari to...

set sorce to the source of the front document
then tell BBEdit to do some fancy RegEx to extract the essentials
then back to Rev to catalog and loop to the next popup window link.

This worked 6 months ago, OSX 10.3.9 Safari Version 1.3.1 (312.3.1)
Currently does not work on older G4, Panther 10.3.8, Rev 2.5.1
--or--
Now on Tiger 10.4.2 with both Safari Version 1.3.1 (312.3.1) & Version 2.0
(412.2)

Another test was.
Sending the javaScript command directly from Script Editor (also fails with
no change or message in Safari)

This is the command (watch word wrap.. all one line)...
onclick=\"popup = window.open('','detailPopup',
'scrollbars');popup.blur();document.TransactionListForm.gradeNumber.value =
91629973; document.TransactionListForm.ticketNumber.value = 0;
document.TransactionListForm.wagerNumber.value = 0;
document.TransactionListForm.submit(); return

I am not conversant in JavaScript, but understand enough try for a solution
if I had a few clues.  Is there another way to open a series of these
'detail popup' windows, get the source, close and do the next in a loop?

Why doesn't Applescript/Safari work with the do javaScript command?

Thanks for any guidance or help.  The manual method can work, but what a
pain.

Jim Ault
Las Vegas


___
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


Re: Rev & Applescript

2005-05-03 Thread Jim Ault
I've gotten the first script to work (has one
file attachment) but the second does not. I don't know if my repeat loop is
not correct or the way I'm delimiting the file attachments, or both.
WORKS:
tell application "Mail"
set theSubject to "Test Order"
DOESN'T WORK:
tell application "Mail"
tell content
repeat with fileName in fileList
make new attachment with properties {file name:fileName} at
after the last paragraph
end repeat
end tell
end tell
--
Any ideas?
I believe you do this on one code line rather than repeat.  each
make new attachment with properties {fileList} at
---Further -- here is a working example from a recent post to the list
uses a field "text" as the message, and does 2 replace steps
uses a field "appleScript", does a date replace, and a message replace
I prefer to name any of my objects, scripts and variables with names 
that are NOT reserved words, like repeating the last char of the word 
"item" -> "itemm" so there is not doubt that it is my variable.

Note: be sure that the fld "scriptInit" is a shared, background 
behavior fld or the applescript will only be available on one card. 
Of course you could do "...fld "scriptInit" of card 1 of this stack"

submitted to this list previously ===
On Jan 2, 2005, at 1:10 PM, Sivakatirswami wrote:
on mouseUp
  put fld "msgText" into tNewBody
  replace quote with ("\""e) in tNewBody
replace ":" with ("\:") in tNewBody
put fld "scriptInit" into tScript
replace "#date#" with (quote & "HPI, January 3rd, 2005" & quote) in tScript
replace "#body#" with (quote & tNewBody& quote) in tScript
do tscript as applescript
end mouseUp
Where the apple script is:
Note the

tell application mail
	set theSender to "Hindu Press International <[EMAIL PROTECTED]>"
	set theName to "Hindu Press International"
	set theAddress to "[EMAIL PROTECTED]"
	set theSubject to #date#
		set theBody to  #body#
	tell application "Mail"
		set newMessage to make new outgoing message with 
properties {subject:theSubject, content:theBody & return & return}
		tell newMessage
set visible to true
			set sender to theSender
			make new to recipient at end of to recipients 
with properties {name:theName, address:theAddress}
		end tell
		activate
	end tell

end tell
--
Now back to me.
This should work without much trial and error, but that is the fun of 
discovery :-)

Jim
___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Rev & Applescript

2005-05-03 Thread Marty Knapp
On 5/3/05 3:13 PM, "Sarah Reichelt" <[EMAIL PROTECTED]> wrote:

> The "repeat with" in AppleScript expects an AppleScript list which is
> in the format:
> {"first item", "second item"}
> 
> Try this (or some minor variation):
> set fileList to "{" &  & "," &  & "}"
> 
> Cheers,
> Sarah

I'll give that a try Sarah. I had tried the comma and a few other
characters, but didn't think to have the brackets.

Thanks,
Marty Knapp

___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Rev & Applescript

2005-05-03 Thread Sarah Reichelt
I've gotten one script to work (has one file attachment) but the 
second does
not. I don't know if my repeat loop is not correct or the way I'm 
delimiting
the file attachments, or both. Each email will have 2 or more 
attachments.

DOESN'T WORK:
tell application "Mail"
set theSubject to "BS Order"
set theBody to "TESTING 123"
set theSender to "[EMAIL PROTECTED]"
set theName to "ADI"
set theAddress to "[EMAIL PROTECTED]"
set fileList to  & return & 
set newMessage to make new outgoing message with properties
{subject:theSubject, content:theBody & return & return}
tell newMessage
-- Default is false. Determines whether the compose window will
-- show on the screen or whether it will happen in the 
background.
set visible to true
set sender to theSender
make new to recipient at end of to recipients with properties
{name:theName, address:theAddress}
tell content
repeat with fileName in fileList
make new attachment with properties {file 
name:fileName} at
after the last paragraph
end repeat
end tell
end tell

send newMessage
end tell
The "repeat with" in AppleScript expects an AppleScript list which is 
in the format:
{"first item", "second item"}

Try this (or some minor variation):
set fileList to "{" &  & "," &  & "}"
Cheers,
Sarah
___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Rev & Applescript

2005-05-03 Thread Marty Knapp
>> I'm trying to get Rev to do an Applescript that will talk to either Mail or
>> Entourage (Mac) to auto-generate an email, attach several pdf files and then
>> send the email (with no interaction on my part). The email will always go
>> the the same recipient, but the content will change, so I need to be able to
>> generate that on the fly.


I've gotten one script to work (has one file attachment) but the second does
not. I don't know if my repeat loop is not correct or the way I'm delimiting
the file attachments, or both. Each email will have 2 or more attachments.

WORKS:
tell application "Mail"
set theSubject to "Test Order"
set theBody to "TESTING 123"
set theSender to "[EMAIL PROTECTED]"
set theName to "ADI"
set theAddress to "[EMAIL PROTECTED]"
set theAttachment to 

set newMessage to make new outgoing message with properties
{subject:theSubject, content:theBody & return & return}
tell newMessage

set visible to false
set sender to theSender
make new to recipient at end of to recipients with properties
{name:theName, address:theAddress}
tell content
make new attachment with properties {file name:theAttachment} at
after the last paragraph
end tell
end tell

send newMessage
end tell

DOESN'T WORK:
tell application "Mail"
set theSubject to "BS Order"
set theBody to "TESTING 123"
set theSender to "[EMAIL PROTECTED]"
set theName to "ADI"
set theAddress to "[EMAIL PROTECTED]"
set fileList to  & return & 

set newMessage to make new outgoing message with properties
{subject:theSubject, content:theBody & return & return}
tell newMessage
-- Default is false. Determines whether the compose window will
-- show on the screen or whether it will happen in the background.
set visible to true
set sender to theSender
make new to recipient at end of to recipients with properties
{name:theName, address:theAddress}
tell content
repeat with fileName in fileList
make new attachment with properties {file name:fileName} at
after the last paragraph
end repeat
end tell
end tell

send newMessage
end tell

--
Any ideas?

Thanks so much,

Marty Knapp

___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


Re: Rev & Applescript

2005-05-03 Thread Jim Ault

Question 1 - Do you already have an Applescript that will generate an 
email in either program?  This script would only need to be the 
literal script that would specify the address, subject, message, and 
a single attachment (pdf in your case) ?

Once you have that working in Script Editor (or other), you only have 
to do a few tweaks to make it ready for Revolution.

The basic idea is to take a working script and paste it into a Rev 
field and run the following:

do field "pastedCode" as AppleScript
The next exercise is to make modifications to allow you to change the 
subject, message, and attachments.  So, step one is to get the 
working script as described above.
Let me know if you already have it and I can help with the 
installation into a Rev stack.

Jim Ault
Las Vegas
I'm trying to get Rev to do an Applescript that will talk to either Mail or
Entourage (Mac) to auto-generate an email, attach several pdf files and then
send the email (with no interaction on my part). The email will always go
the the same recipient, but the content will change, so I need to be able to
generate that on the fly.
Thanks for any help.
Marty Knapp
___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution
___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution


Rev & Applescript

2005-05-02 Thread Marty Knapp
Hey,

I'm trying to get Rev to do an Applescript that will talk to either Mail or
Entourage (Mac) to auto-generate an email, attach several pdf files and then
send the email (with no interaction on my part). The email will always go
the the same recipient, but the content will change, so I need to be able to
generate that on the fly.

Thanks for any help.


Marty Knapp

___
use-revolution mailing list
use-revolution@lists.runrev.com
http://lists.runrev.com/mailman/listinfo/use-revolution