Re: Scripting Bridge Questions

2015-06-25 Thread Dave

 On 25 Jun 2015, at 12:34, Sandor Szatmari admin.szatmari@gmail.com 
 wrote:
 
 I wrote an interface to a third party app using the Scripting Bridge.  It 
 worked pretty good but I had to test the SBApplication object for nil before 
 accessing it.  Periodically it would return nil unexpectedly.  Don't know if 
 that was a bug in the app's implementation or something I was doing wrong.  
 But other than that it worked great.
 
 I did what you described, first use sdef and sdp to create the header.  
 Include the header and then create an instance of SBApplication using the 
 third party app's bundle identifier 'com.name.whatever'.  I have definitely 
 seen apps that are broken too.  They support AppleScript but not fully or 
 something so the scripting bridge is broken for them.
 
 Sandor Szatmari

That’s the problem, “sdef and/or “sdp barf when I try to generate the header 
file and without the header file you are pretty much dead in the water.

Cheers
Dave


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Scripting Bridge Questions

2015-06-25 Thread Dave

 On 25 Jun 2015, at 13:33, Bill Cheeseman wjcheese...@gmail.com wrote:
 
 
 On Jun 25, 2015, at 8:09 AM, Dave d...@looktowindward.com wrote:
 
 That’s the problem, “sdef and/or “sdp barf when I try to generate the 
 header file and without the header file you are pretty much dead in the 
 water.
 
 
 I haven't noticed a specific description of the failure you're experiencing. 
 Do you get a partial header file, or a header file that contains errors or 
 that causes errors in your Scripting Bridge implementation? I have found in 
 the past that I can manually edit header files generated by sdef/sdp, at 
 least by removing irrelevant declarations that aren't needed or that cause 
 problems, and when I do it right the edited header files work with Scripting 
 Bridge.
 

I get this error:

sdp: enumerator of enumeration e183: missing required name attribute.

and an (very) incomplete file, e.g. most of it is missing.

All the Best
Dave


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Scripting Bridge Questions

2015-06-25 Thread Dave

 On 25 Jun 2015, at 14:48, Bill Cheeseman wjcheese...@gmail.com wrote:
 
 
 On Jun 25, 2015, at 9:13 AM, Dave d...@looktowindward.com wrote:
 
 I get this error:
 
 sdp: enumerator of enumeration e183: missing required name attribute.
 
 
 Can you generate the sdef file separately, then manually edit it to supply 
 the missing required 'name' attribute, and then run sdp on the edited sdef 
 file? You will presumably have to give more than a little thought to what the 
 missing name attribute should be, but maybe you'll hit pay dirt.

I’m looking into doing that now, but I can’t seem to find an editor that will 
open it, at the moment it’s ONE giant line of text, I renamed it to .xml and 
tried to open in XCode - same.

Cheers
Dave



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Scripting Bridge Questions

2015-06-25 Thread Dave
On further investigation, the App doesn’t have an .sdef, so, the “sdef” tool, 
must generate it from the old style ‘aete’ resources. So, the fault could be in 
either “sdef” or “sdp”.

I’ve trying to look at the output from “sdef” but it’s in a horrible format - 
no line endings, so it’s hard to read. If I try to open it as an xml in XCode 
all I get is a one HUGE line of text and XCode struggles to deal with it (slow 
as a very slow thing on a cold morning).

Cheers
Dave

 On 25 Jun 2015, at 14:29, Dave d...@looktowindward.com wrote:
 
 
 On 25 Jun 2015, at 14:24, Jean-Daniel Dupas mail...@xenonium.com wrote:
 That just means you wrote an invalid sdef file in the first place. 
 
 Really? No kidding?!?!? lol
 
 The .sdef file comes with the App I am trying to generate the header file 
 for!
 
 
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/dave%40looktowindward.com
 
 This email sent to d...@looktowindward.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Scripting Bridge Questions

2015-06-25 Thread Jean-Daniel Dupas

 Le 25 juin 2015 à 15:13, Dave d...@looktowindward.com a écrit :
 
 
 On 25 Jun 2015, at 13:33, Bill Cheeseman wjcheese...@gmail.com wrote:
 
 
 On Jun 25, 2015, at 8:09 AM, Dave d...@looktowindward.com wrote:
 
 That’s the problem, “sdef and/or “sdp barf when I try to generate the 
 header file and without the header file you are pretty much dead in the 
 water.
 
 
 I haven't noticed a specific description of the failure you're experiencing. 
 Do you get a partial header file, or a header file that contains errors or 
 that causes errors in your Scripting Bridge implementation? I have found in 
 the past that I can manually edit header files generated by sdef/sdp, at 
 least by removing irrelevant declarations that aren't needed or that cause 
 problems, and when I do it right the edited header files work with Scripting 
 Bridge.
 
 
 I get this error:
 
 sdp: enumerator of enumeration e183: missing required name attribute.
 
 and an (very) incomplete file, e.g. most of it is missing.
 

That just means you wrote an invalid sdef file in the first place. 


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Scripting Bridge Questions

2015-06-25 Thread Dave
Hi,

Is the source code of “sdp” available anywhere? Just a thought.

All the Best
Dave


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Scripting Bridge Questions

2015-06-25 Thread Bill Cheeseman

 On Jun 25, 2015, at 8:09 AM, Dave d...@looktowindward.com wrote:
 
 That’s the problem, “sdef and/or “sdp barf when I try to generate the 
 header file and without the header file you are pretty much dead in the water.


I haven't noticed a specific description of the failure you're experiencing. Do 
you get a partial header file, or a header file that contains errors or that 
causes errors in your Scripting Bridge implementation? I have found in the past 
that I can manually edit header files generated by sdef/sdp, at least by 
removing irrelevant declarations that aren't needed or that cause problems, and 
when I do it right the edited header files work with Scripting Bridge.

-- 

Bill Cheeseman - b...@cheeseman.name

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Scripting Bridge Questions

2015-06-25 Thread Bill Cheeseman

 On Jun 25, 2015, at 9:13 AM, Dave d...@looktowindward.com wrote:
 
 I get this error:
 
 sdp: enumerator of enumeration e183: missing required name attribute.


Can you generate the sdef file separately, then manually edit it to supply the 
missing required 'name' attribute, and then run sdp on the edited sdef file? 
You will presumably have to give more than a little thought to what the missing 
name attribute should be, but maybe you'll hit paydirt.

-- 

Bill Cheeseman - b...@cheeseman.name

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Scripting Bridge Questions

2015-06-25 Thread Dave

 On 25 Jun 2015, at 14:24, Jean-Daniel Dupas mail...@xenonium.com wrote:
 That just means you wrote an invalid sdef file in the first place. 

Really? No kidding?!?!? lol

The .sdef file comes with the App I am trying to generate the header file 
for!



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Scripting Bridge Questions

2015-06-25 Thread Willeke
Hi,

Can you open the dictionary in Scripteditor?
Is the application launched when you run sdef or open the dictionary in 
Scripteditor?

 I can’t seem to find an editor that will open it
Try Xcode or TextWrangler with soft wrap switched on in the preferences. Or 
Sdef Editor, ignore the warnings and save as….

Willeke
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Scripting Bridge Questions

2015-06-25 Thread Jean-Daniel Dupas

 Le 25 juin 2015 à 15:57, Dave d...@looktowindward.com a écrit :
 
 
 On 25 Jun 2015, at 14:48, Bill Cheeseman wjcheese...@gmail.com wrote:
 
 
 On Jun 25, 2015, at 9:13 AM, Dave d...@looktowindward.com wrote:
 
 I get this error:
 
 sdp: enumerator of enumeration e183: missing required name attribute.
 
 
 Can you generate the sdef file separately, then manually edit it to supply 
 the missing required 'name' attribute, and then run sdp on the edited sdef 
 file? You will presumably have to give more than a little thought to what 
 the missing name attribute should be, but maybe you'll hit pay dirt.
 
 I’m looking into doing that now, but I can’t seem to find an editor that will 
 open it, at the moment it’s ONE giant line of text, I renamed it to .xml and 
 tried to open in XCode - same.
 

You can pretty format it using xmllint command line tool.

xmllint --pretty 1 yourfile.xml  your_formatted_file.xml

 Cheers
 Dave
 
 
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/mailing%40xenonium.com
 
 This email sent to mail...@xenonium.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Scripting Bridge Questions

2015-06-25 Thread Dave

 On 25 Jun 2015, at 17:14, Jean-Daniel Dupas mail...@xenonium.com wrote:
 
 
 You can pretty format it using xmllint command line tool.
 
 xmllint --pretty 1 yourfile.xml  your_formatted_file.xml
 

I knocked up a utility to do it but thanks anyway.

Once I could see where the problem was, I fixed the output from “sdef” quite 
easily and then ran this file through “sdp”, e.g.

sdef .app  .txt

// reformat and edit .txt

and then:

cat .txt | sdp -fh --basename App

When I included the generated header file in my project, here were a few 
duplicate definitions which I fixed and it compiled ok!

That was a really good hack!

Many Thanks to everyone that helped on this.

All the Best
Dave



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Scripting Bridge Questions

2015-06-25 Thread Dave

 On 25 Jun 2015, at 00:30, Graham Cox graham@bigpond.com wrote:
 
 
 On 24 Jun 2015, at 9:22 pm, Dave d...@looktowindward.com wrote:
 
 I was wondering if I should just give up now and forget using the Bridge or 
 if there’s any chance that I might get a usable header file generated 
 somehow. My instincts tell me to give up, but if anyone knows better or they 
 know a better solution I’d really appreciate a pointer…..
 
 
 Scripting Bridge worked for me to implement a programmatic interface to Mail. 
 Long time since I did it, forget what, if any, issues I had, but don’t recall 
 any particular problems.

Yes, it seems to work with all Apple Apps I’ve tested with, (which is all it 
mentions in the examples), but not with third party apps.

It probably is also dependant when when the application was created too.

Dave


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Scripting Bridge Questions

2015-06-24 Thread Dave
Hi All,

I’m doing some investigative work using the Scripting Bridge:

https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/ScriptingBridgeConcepts/ScriptingBridgeConcepts.pdf

The first step is to use the “sdef” and “sdp” terminal commands to generate 
header files that can be included in your project. From my experimentation I’ve 
come to the conclusion that it will only work on a subset of AppleScriptable 
applications, in that when you run the “sdp command it gives errors and leaves 
you with an incomplete header file.

I can’t seem to find any documentation apart from the “man” page.

I was wondering if I should just give up now and forget using the Bridge or if 
there’s any chance that I might get a usable header file generated somehow. My 
instincts tell me to give up, but if anyone knows better or they know a better 
solution I’d really appreciate a pointer…..

Thanks a lot, All the Best
Dave


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Scripting Bridge Questions

2015-06-24 Thread Graham Cox

 On 24 Jun 2015, at 9:22 pm, Dave d...@looktowindward.com wrote:
 
 I was wondering if I should just give up now and forget using the Bridge or 
 if there’s any chance that I might get a usable header file generated 
 somehow. My instincts tell me to give up, but if anyone knows better or they 
 know a better solution I’d really appreciate a pointer…..


Scripting Bridge worked for me to implement a programmatic interface to Mail. 
Long time since I did it, forget what, if any, issues I had, but don’t recall 
any particular problems.


—Graham



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com