Re: Perl and AppleScript Studio

2002-02-05 Thread Kee Hinckley

At 12:40 PM -0500 1/15/02, Chris Nandor wrote:
>In article ,
>  [EMAIL PROTECTED] (Kee Hinckley) wrote:
>
>>  The nice thing about this approach is that writing the initial glue
>>  shouldn't be a big deal.  Handling every possible object is a lot of
>>  work, but it can be built incrementally.  Anytime someone needs to
>>  handle a new type of object they simply add the relevant Applescript
>>  and Perl code to the libraries.
>>
>>  Is any of this making sense?
>
>I'm not sure, but it seems a lot more complex than simply dropping an
>application on a droplet and then coding to it in Perl, bypassing
>AppleScript altogether.

Somehow I missed this the first time round.

I guess I'm not sure what you mean by that sentence.  My goal is to 
be able to write an event-driven Perl program that is taking 
information from the UI, and passing information back.  Ideally *not* 
by execing the Perl program everytime.
-- 

Kee Hinckley - Somewhere.Com, LLC
http://consulting.somewhere.com/
[EMAIL PROTECTED]

I'm not sure which upsets me more: that people are so unwilling to accept
responsibility for their own actions, or that they are so eager to regulate
everyone else's.



Re: Perl and AppleScript Studio

2002-02-05 Thread Justin Simoni

I would really appreciate that, moving from BBEdit to Project Builder at 
2 am has made me feel a bit estranged.

[EMAIL PROTECTED]

justin.

s k a z a t - http://skazat.com

'my manta ray's alright'
   -the pixies



On Tuesday, February 5, 2002, at 01:24 PM, Paul N. Schatz wrote:

>   I got this to work.  I can't remember off hand whether there was 
> an issue with unix line endings, but I would be happy to send you the 
> project.
>
>   Paul
> **
>
> At 1:26 AM -0700 2/5/02, Justin Simoni wrote
>> I know this is an old thread, but can someone give more details on how 
>> to
>> make this work? :)
>>
>> I followed these directions:
>>
>> 
>> Yes! This is working. I just changed the Hello World example with this
>> script:
>>
>> on clicked theObject
>> tell main bundle to set thePath to path for resource "stats"
>> extension "perl"
>> try
>> set thePath to "\"" & thePath & "\""
>> set r to do shell script thePath
>> display dialog r
>> on error msgError
>> display dialog msgError
>> display dialog thePath
>> end try
>> end clicked
>>
>> And put a stats.perl file in the Resources folder with this snippet:
>>
>> #!/usr/bin/perl
>>
>> use strict;
>>
>> my $r = scalar (localtime);
>>
>> print $r;
>>
>> And then build the Hello World app and its working. The only problem
>> that I had was that I forgot to set executable bit on the stats.perl
>> file.
>>
>> Wow, this is very very cool
>>
>> 
>>
>> But all I get is a window with nothing in it, and if I run it in 
>> Project
>> builder, I get a red text thingy that says that the applescript has 
>> exited
>> with a status of '0'
>>
>>
>> Anyone understand what's going on, or have a working example they can 
>> share?
>> I'm confused on what kind of project I'm supposed to make and when and 
>> what
>> I chmod the Perl script to, do I open up the bundle and do it there?
>>
>>
>> Justin Simoni
>
> -- --
> Paul Schatz
> Chem Dept
> University of Virginia
>
>




Re: Perl and AppleScript Studio

2002-02-05 Thread Paul N. Schatz

I got this to work.  I can't remember off hand whether there 
was an issue with unix line endings, but I would be happy to send you 
the project.

Paul
**

At 1:26 AM -0700 2/5/02, Justin Simoni wrote
>I know this is an old thread, but can someone give more details on how to
>make this work? :)
>
>I followed these directions:
>
>
>Yes! This is working. I just changed the Hello World example with this
>script:
>
>on clicked theObject
> tell main bundle to set thePath to path for resource "stats"
>extension "perl"
> try
> set thePath to "\"" & thePath & "\""
> set r to do shell script thePath
> display dialog r
> on error msgError
> display dialog msgError
> display dialog thePath
> end try
>end clicked
>
>And put a stats.perl file in the Resources folder with this snippet:
>
>#!/usr/bin/perl
>
>use strict;
>
>my $r = scalar (localtime);
>
>print $r;
>
>And then build the Hello World app and its working. The only problem
>that I had was that I forgot to set executable bit on the stats.perl
>file.
>
>Wow, this is very very cool
>
>
>
>But all I get is a window with nothing in it, and if I run it in Project
>builder, I get a red text thingy that says that the applescript has exited
>with a status of '0'
>
>
>Anyone understand what's going on, or have a working example they can share?
>I'm confused on what kind of project I'm supposed to make and when and what
>I chmod the Perl script to, do I open up the bundle and do it there?
>
>
>Justin Simoni

-- 
--
Paul Schatz
Chem Dept
University of Virginia



Re: Perl and AppleScript Studio

2002-02-05 Thread Justin Simoni

I know this is an old thread, but can someone give more details on how to
make this work? :) 

I followed these directions:

 
Yes! This is working. I just changed the Hello World example with this
script:

on clicked theObject
tell main bundle to set thePath to path for resource "stats"
extension "perl"
try
set thePath to "\"" & thePath & "\""
set r to do shell script thePath
display dialog r
on error msgError
display dialog msgError
display dialog thePath
end try
end clicked

And put a stats.perl file in the Resources folder with this snippet:

#!/usr/bin/perl

use strict;

my $r = scalar (localtime);

print $r;

And then build the Hello World app and its working. The only problem
that I had was that I forgot to set executable bit on the stats.perl
file.

Wow, this is very very cool

 

But all I get is a window with nothing in it, and if I run it in Project
builder, I get a red text thingy that says that the applescript has exited
with a status of '0'


Anyone understand what's going on, or have a working example they can share?
I'm confused on what kind of project I'm supposed to make and when and what
I chmod the Perl script to, do I open up the bundle and do it there?


Justin Simoni

-- 
+ Freelance Web Design
+ Internet Application Development

[EMAIL PROTECTED] | http://justinsimoni | 720.436.7701










> Hello,
> 
> I just had this conversation on the AppleScript Studio list with Tim
> Bumgarner, the lead developer, and thought that some people on this
> list might be interested.
> 
> If you want to use a little bit of AppleScript for manipulating the
> UI, you could build easily Perl app with a nice Aqua interface.
> 
>> À (At) 23:36 -0500 17/12/01, Emmanuel. M. Decarie écrivait (wrote) :
>>> 
 *** 2. Can I put a Perl script or any other text file containing
 shell commands in the project that I could call from
 Application.applescript?
 
 Suppose I want to build an AS Studio app that will open a window
 to choose a file, and then pass the path to the file to a Perl
 script that will sort every words in the file alphabetically with
 the number of occurrences for each word, and then return back the
 stats to the user in a new window.
 
 - Could I embed the Perl script file in the project?
 - If so, how do I get the path to this file to be able to run it
 from Application.applescript (i.e do shell script "path in to my
 Perl script")
 
>>> I don't have any experience with perl, but you should be able to do
>>> the following:
>>> 
>>> 1. Create a perl script, say 'stats.perl'.
>>> 2. Add it to your project. This will typically end up in the
>>> 'Bundle Resources' build phase which usually put's it's products
>>> into 'Contents/Resources' inside of your built application.
>>> 3. Do the following somewhere in your script: 'tell main bundle to
>>> set thePath to path for resource "stats" extension "perl"'.  This
>>> will return the full POSIX path to your 'stats.perl' script that is
>>> in your built application.
>>> 4. Pass that path to an execution of 'do shell script'. I'm not
>>> sure how to invoke a perl script, but I think you get the idea.
>>> 
>>> You can check out the 'path for' command for more variants. It
>>> listed in the Application Suite.
>> 
>> Yes! This is working. I just changed the Hello World example with this
>> script:
>> 
>> on clicked theObject
>> tell main bundle to set thePath to path for resource "stats"
>> extension "perl"
>> try
>> set thePath to "\"" & thePath & "\""
>> set r to do shell script thePath
>> display dialog r
>> on error msgError
>> display dialog msgError
>> display dialog thePath
>> end try
>> end clicked
>> 
>> And put a stats.perl file in the Resources folder with this snippet:
>> 
>> #!/usr/bin/perl
>> 
>> use strict;
>> 
>> my $r = scalar (localtime);
>> 
>> print $r;
>> 
>> And then build the Hello World app and its working. The only problem
>> that I had was that I forgot to set executable bit on the stats.perl
>> file.
>> 
>> Wow, this is very very cool
>> 
> 
> AppleScript Studio list:
> 




Re: Perl and AppleScript Studio

2002-01-15 Thread Chris Nandor

In article ,
 [EMAIL PROTECTED] (Kee Hinckley) wrote:

> The nice thing about this approach is that writing the initial glue 
> shouldn't be a big deal.  Handling every possible object is a lot of 
> work, but it can be built incrementally.  Anytime someone needs to 
> handle a new type of object they simply add the relevant Applescript 
> and Perl code to the libraries.
> 
> Is any of this making sense?

I'm not sure, but it seems a lot more complex than simply dropping an 
application on a droplet and then coding to it in Perl, bypassing 
AppleScript altogether.

-- 
Chris Nandor  [EMAIL PROTECTED]http://pudge.net/
Open Source Development Network[EMAIL PROTECTED] http://osdn.com/



Re: Perl and AppleScript Studio

2002-01-14 Thread Kee Hinckley

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

I was thinking about the Perl/AppleScript issue the other day as I 
was writing my first AppleScript program in Studio.  (So far no luck, 
can't figure out how to make a droplet wake up when I drop a URL on 
it from IE.)

While you can certainly have Applescript run a Perl script on every 
action, that's painful and doesn't maintain any state.

It seems to me that someone should write an AppleScript program that 
takes a set of standard UI events, decomposes the objects, and then 
turns them in to SOAP calls.  In fact maybe the hooks already exist 
for translating Apple Events into SOAP (anyone know?).  Then you just 
need a Perl library for turning those into method calls.  To use a 
Perl program in this environment you write it as an event driven 
server.  When your application starts up, it starts the perl program. 
All communication thereon is via SOAP.  In that environment, writing 
a GUI Perl program is just a matter of loading a template that has 
all the Applescript code, and then editing your Perl program to take 
the events.  (Okay, if you want to send anything interesting back, 
you'll have to write some Applescript to take it and display it, but 
still, the guts can be in Perl.)

The nice thing about this approach is that writing the initial glue 
shouldn't be a big deal.  Handling every possible object is a lot of 
work, but it can be built incrementally.  Anytime someone needs to 
handle a new type of object they simply add the relevant Applescript 
and Perl code to the libraries.

Is any of this making sense?
- -- 

Kee Hinckley - Somewhere.Com, LLC
http://consulting.somewhere.com/
[EMAIL PROTECTED]

I'm not sure which upsets me more: that people are so unwilling to accept
responsibility for their own actions, or that they are so eager to regulate
everyone else's.

-BEGIN PGP SIGNATURE-
Version: PGP Personal Security 7.0.3

iQA/AwUBPEOEriZsPfdw+r2CEQKXyACg6eECtEEsbd0LYA85QZAGPZMV5wAAnA/i
AVD/2Q73/b8Zo3oF7yuGkVK8
=fcY0
-END PGP SIGNATURE-



Re: Perl and AppleScript Studio

2002-01-04 Thread Chris Nandor

In article <[EMAIL PROTECTED]>,
 [EMAIL PROTECTED] (Michael Stearne) wrote:

> That's really cool.  I'm a lot better with Perl.  But I guess you don't 
> get any of the application tie ins like you do with AppleScript.

Sure you can.  Someone just needs to port the Mac:: modules, and then 
you'll have Mac::Glue, which can do nearly everything anything 
AppleScript can do (as far as controlling and talking to applications), 
using the same vocabulary (but with a Perl syntax).

   use Mac::Glue;
   $itunes = new Mac::Glue 'iTunes';
   $itunes->play;

Mac::Glue works from MacPerl under Classic to control Mac OS X apps too, 
somewhat (I've not tested it extensively, and at least on problem 
involves the droplet to create the "glue" for an application doesn't yet 
understand Mac OS X apps).

In the case of iTunes, I created the glue using the Classic version of 
iTunes, and used it as above to control the Mac OS X version of iTunes, 
running MacPerl from Classic.

And like I said, if the Mac:: modules (AppleEvents, Events, etc.) are 
ever ported to Mac OS X, you'll be able to do the same under perl for 
Mac OS X.  I don't know when that will happen.  One thing is nearly 
certain: it will happen before I make the switch to Mac OS X as my main 
box.  :-)  But that might not be for quite some time.  Mac OS 9 is quite 
comfortable, and Mac OS X is not, for now.

-- 
Chris Nandor  [EMAIL PROTECTED]http://pudge.net/
Open Source Development Network[EMAIL PROTECTED] http://osdn.com/



Re: Perl and AppleScript Studio

2001-12-18 Thread Bill Stephenson

on 12/17/01 10:46 PM, Emmanuel. M. Decarie at [EMAIL PROTECTED] wrote:

> Hello,
> 
> I just had this conversation on the AppleScript Studio list with Tim
> Bumgarner, the lead developer, and thought that some people on this
> list might be interested.
> 
> If you want to use a little bit of AppleScript for manipulating the
> UI, you could build easily Perl app with a nice Aqua interface.

That's pretty cool. Thanks for the info!

-- 

Bill Stephenson
www.PerlHelp.com
1-417-546-5593





Re: Perl and AppleScript Studio

2001-12-17 Thread Michael Stearne

That's really cool.  I'm a lot better with Perl.  But I guess you don't 
get any of the application tie ins like you do with AppleScript.

Michael

Emmanuel. M. Decarie wrote:

> Hello,
>
> I just had this conversation on the AppleScript Studio list with Tim 
> Bumgarner, the lead developer, and thought that some people on this 
> list might be interested.
>
> If you want to use a little bit of AppleScript for manipulating the 
> UI, you could build easily Perl app with a nice Aqua interface.
>
>> À (At) 23:36 -0500 17/12/01, Emmanuel. M. Decarie écrivait (wrote) :
>>
>>>
 *** 2. Can I put a Perl script or any other text file containing 
 shell commands in the project that I could call from 
 Application.applescript?

 Suppose I want to build an AS Studio app that will open a window to 
 choose a file, and then pass the path to the file to a Perl script 
 that will sort every words in the file alphabetically with the 
 number of occurrences for each word, and then return back the stats 
 to the user in a new window.

 - Could I embed the Perl script file in the project?
 - If so, how do I get the path to this file to be able to run it 
 from Application.applescript (i.e do shell script "path in to my 
 Perl script")

>>> I don't have any experience with perl, but you should be able to do 
>>> the following:
>>>
>>> 1. Create a perl script, say 'stats.perl'.
>>> 2. Add it to your project. This will typically end up in the 'Bundle 
>>> Resources' build phase which usually put's it's products into 
>>> 'Contents/Resources' inside of your built application.
>>> 3. Do the following somewhere in your script: 'tell main bundle to 
>>> set thePath to path for resource "stats" extension "perl"'.  This 
>>> will return the full POSIX path to your 'stats.perl' script that is 
>>> in your built application.
>>> 4. Pass that path to an execution of 'do shell script'. I'm not sure 
>>> how to invoke a perl script, but I think you get the idea.
>>>
>>> You can check out the 'path for' command for more variants. It 
>>> listed in the Application Suite.
>>
>>
>> Yes! This is working. I just changed the Hello World example with 
>> this script:
>>
>> on clicked theObject
>> tell main bundle to set thePath to path for resource "stats" 
>> extension "perl"
>> try
>> set thePath to "\"" & thePath & "\""
>> set r to do shell script thePath
>> display dialog r
>> on error msgError
>> display dialog msgError
>> display dialog thePath
>> end try
>> end clicked
>>
>> And put a stats.perl file in the Resources folder with this snippet:
>>
>> #!/usr/bin/perl
>>
>> use strict;
>>
>> my $r = scalar (localtime);
>>
>> print $r;
>>
>> And then build the Hello World app and its working. The only problem 
>> that I had was that I forgot to set executable bit on the stats.perl 
>> file.
>>
>> Wow, this is very very cool
>>
>
> AppleScript Studio list:
> 







Perl and AppleScript Studio

2001-12-17 Thread Emmanuel. M. Decarie

Hello,

I just had this conversation on the AppleScript Studio list with Tim
Bumgarner, the lead developer, and thought that some people on this
list might be interested.

If you want to use a little bit of AppleScript for manipulating the
UI, you could build easily Perl app with a nice Aqua interface.

>À (At) 23:36 -0500 17/12/01, Emmanuel. M. Decarie écrivait (wrote) :
>>
>>>*** 2. Can I put a Perl script or any other text file containing
>>>shell commands in the project that I could call from
>>>Application.applescript?
>>>
>>>Suppose I want to build an AS Studio app that will open a window
>>>to choose a file, and then pass the path to the file to a Perl
>>>script that will sort every words in the file alphabetically with
>>>the number of occurrences for each word, and then return back the
>>>stats to the user in a new window.
>>>
>>>- Could I embed the Perl script file in the project?
>>>- If so, how do I get the path to this file to be able to run it
>>>from Application.applescript (i.e do shell script "path in to my
>>>Perl script")
>>>
>>I don't have any experience with perl, but you should be able to do
>>the following:
>>
>>1. Create a perl script, say 'stats.perl'.
>>2. Add it to your project. This will typically end up in the
>>'Bundle Resources' build phase which usually put's it's products
>>into 'Contents/Resources' inside of your built application.
>>3. Do the following somewhere in your script: 'tell main bundle to
>>set thePath to path for resource "stats" extension "perl"'.  This
>>will return the full POSIX path to your 'stats.perl' script that is
>>in your built application.
>>4. Pass that path to an execution of 'do shell script'. I'm not
>>sure how to invoke a perl script, but I think you get the idea.
>>
>>You can check out the 'path for' command for more variants. It
>>listed in the Application Suite.
>
>Yes! This is working. I just changed the Hello World example with this script:
>
>on clicked theObject
>   tell main bundle to set thePath to path for resource "stats"
>extension "perl"
>   try
>   set thePath to "\"" & thePath & "\""
>   set r to do shell script thePath
>   display dialog r
>   on error msgError
>   display dialog msgError
>   display dialog thePath
>   end try
>end clicked
>
>And put a stats.perl file in the Resources folder with this snippet:
>
>#!/usr/bin/perl
>
>use strict;
>
>my $r = scalar (localtime);
>
>print $r;
>
>And then build the Hello World app and its working. The only problem
>that I had was that I forgot to set executable bit on the stats.perl
>file.
>
>Wow, this is very very cool
>

AppleScript Studio list:

--
~
Emmanuel Décarie - Consultant
   Programmation pour le Web - Programming for the Web
   UserLand Frontier  - Perl - JavaScript - AppleScript - HTML - XML
   http://www.scriptdigital.com

---> The Frontier Newbie Toolbox: