Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Applescript Studio Frustrations

Applescript Studio Frustrations
Thread Tools
Professional Poster
Join Date: Dec 2000
Location: Staffs, UK
Status: Offline
Reply With Quote
Dec 17, 2001, 10:24 AM
 
Please help. I've spent all day struggling with AppleScript studio. So far, I've managed to get a nice little app that lets me choose a file, and control a couple of sliders. But -- I have a few major problems, which are not helped by the documentation which is frustratingly lacking in anything remotely approaching detail
[*] How do I get a standard <font face = "courier">open panel </font> ? I can get an alert, attached sheet-style, but I cannot figure out how I'm supposed to get an open panel to work. The included examples only cover customised panels that have a nib file -- surely I don't need to do that for a standard open sheet ?[*]How do I get an <font face = "courier">image view</font> to display an image I specify through an open panel ? All I can get it to do is display images that are included in the nib file -- all other reference forms fail.
[*] How do I open create a new document window (this time, from a nib file). Again, I hopelessly failed to do this, and the docs, and examples, were zero help.
[*] What do I have to do to get properties saved between executions (as they are supposed to be) ? I swear this was working at one point.

I'm very frustrated right now, just trying to write a simple application I think I'm going to be better off writing the damned interface routines in Obj-C and just using AppleScript for the one piece of inter-app control that I am trying to do.

Someone at Apple really needs to overhaul the damned reference material for Applescript, because it's a real barrier to entry.
     
Fresh-Faced Recruit
Join Date: Dec 2001
Location: NJ, USA
Status: Offline
Reply With Quote
Dec 17, 2001, 04:54 PM
 
1. You should be able to use the "choose file" command...just tried it, works fine.

4. Properties should retain their value as long as you don't recompile the script.

Not sure about the other problems, I'm still experimenting like everyone else. If you haven't downloaded the AppleScript Studio PDF from Apple I'd suggest grabbing it.
I think we have to be a little patient, this is new ground for Apple as well as us. I'm sure there will be a proliferation of info on the 'net before too long.

Steve W
Windows SysAdmin by day, OS X maniac by night...
     
Professional Poster
Join Date: Dec 2000
Location: Staffs, UK
Status: Offline
Reply With Quote
Dec 18, 2001, 01:38 AM
 
Originally posted by swoodnj2:
<STRONG>1. You should be able to use the "choose file" command...just tried it, works fine.

4. Properties should retain their value as long as you don't recompile the script.
</STRONG>
Oh yeah, I can use <font face = "courier">choose file[/t] -- the point was how do I use [tt] open panel</font>, it's all there, but I just can't see how to use it.

Yes, properties should retain their values. They don't. That's my problem.
     
Mac Elite
Join Date: Oct 2000
Status: Offline
Reply With Quote
Dec 18, 2001, 02:11 AM
 
Originally posted by Gee4orce:
<STRONG>

Oh yeah, I can use <font face = "courier">choose file</font> -- the point was how do I use <font face = "courier">open panel</font>, it's all there, but I just can't see how to use it.</STRONG>
What's wrong with using <font face = "courier">choose file</font> ? It will return a file specification.
     
Fresh-Faced Recruit
Join Date: Dec 2001
Location: NJ, USA
Status: Offline
Reply With Quote
Dec 18, 2001, 06:51 AM
 
Will investigate the open panel, you are right, the "Building Applications with AppleScript Studio" PDF does mention that all of the panels are available...
Have you tried running a regular script from Script Editor to test properties? Just to rule out any potential problem..
property num : 1

tell application "Finder"
activate
display dialog "Increment property?"
if button returned of result = "OK" then
set num to num + 1
end if
display dialog "num is now: " & num as string
end tell

On my machine the value does increment every time as long as I don't recompile. I will whip up a project in AS Studio just to make sure I don't have the same problem. Is it a project with multiple scripts?
Not an expert, just enjoy Applescript lots...

Steve W
Windows SysAdmin by day, OS X maniac by night...
     
Grizzled Veteran
Join Date: Feb 2001
Location: Germany
Status: Offline
Reply With Quote
Dec 18, 2001, 09:16 AM
 
gee4orce, i'm having the very questions you do. in case you find something, please let us know, i'm also looking, reading and trying and my approach to this would have also been the same (using objective-c).

btw: "ass" is the german acronym for the active ingredient in aspirin, there even is a generic version of aspirin by that name.
funny, isn't is? one ass gives you headaches, the other one takes it...
     
Fresh-Faced Recruit
Join Date: Dec 2001
Status: Offline
Reply With Quote
Dec 18, 2001, 01:20 PM
 
Originally posted by Gee4orce:
<STRONG>Please help. I've spent all day struggling with AppleScript studio. So far, I've managed to get a nice little app that lets me choose a file, and control a couple of sliders. But -- I have a few major problems, which are not helped by the documentation which is frustratingly lacking in anything remotely approaching detail
[*] How do I get a standard &lt;font face=courier&gt;open panel &lt;/font&gt; ? I can get an alert, attached sheet-style, but I cannot figure out how I'm supposed to get an open panel to work. The included examples only cover customised panels that have a nib file -- surely I don't need to do that for a standard open sheet ?[*]How do I get an &lt;font face=courier&gt;image view&lt;/font&gt; to display an image I specify through an open panel ? All I can get it to do is display images that are included in the nib file -- all other reference forms fail.
[*] How do I open create a new document window (this time, from a nib file). Again, I hopelessly failed to do this, and the docs, and examples, were zero help.
[*] What do I have to do to get properties saved between executions (as they are supposed to be) ? I swear this was working at one point.

I'm very frustrated right now, just trying to write a simple application I think I'm going to be better off writing the damned interface routines in Obj-C and just using AppleScript for the one piece of inter-app control that I am trying to do.

Someone at Apple really needs to overhaul the damned reference material for Applescript, because it's a real barrier to entry.</STRONG>

Currently the standard Cocoa open and save panels are not available in Studio. As has been suggested you will need to use the 'choose ...' commands in the Standard Additions. Studio overrides the 'display dialog' command and adds an addition parameter that lets you attach to a window to present it as a sheet. There is also a new 'display alert' that does the same type of thing. Future Studio releases will provide access to more and more standard Cocoa dialogs, including the save and open panels, allowing you to present them as sheets where applicable.

There is a bug in the current shipping version of 'load image' in that it will only work with images that are part of the project. It has subsequently been fixed to allow you to specify any location via a full path. As to when this fix will be available, it's being determined. One work around is to add a delegate to your application in Objective-C and then use the 'call method' command to call your own methods.

For example you could have an Objective-C class:

<BLOCKQUOTE><font size="1"face="Geneva, Verdana, Arial">code:</font><HR><pre><font size=1 face=courier>
@interface MyAppDelegate : NSObject

- (NSImage *)loadImage NSString *)path;

@end
</font>[/code]

and instantiate one of these classes in your MainMenu.nib in Interface Builder setting this created object as the delegate of the application object.

Then from your script you could do the following

set theImage to 'call method "loadImage:" with parameter thePath

Which will call your 'loadImage' method where you do the work to return the image. But as I said this has been fixed and will be available in the next release.

I realize it can frustrating at times, especially when you run into road blocks on the very first things that you are trying to do. Stick with it, and keep asking questions, and we'll do what we can to answer them.

Thanks,

Tim Bumgarner
AppleScript Studio Tech-Lead

[gzl: removed the renegade smiley that crept into the code]

[ 12-23-2001: Message edited by: gorgonzola ]
     
Fresh-Faced Recruit
Join Date: Dec 2001
Location: NJ, USA
Status: Offline
Reply With Quote
Dec 18, 2001, 03:20 PM
 
I had the same problem with properties maintaining their values...If anyone gets anywhere let us know!

Steve W
Windows SysAdmin by day, OS X maniac by night...
     
Junior Member
Join Date: Sep 2000
Location: Milwaukee, WI
Status: Offline
Reply With Quote
Dec 18, 2001, 03:43 PM
 
Apple now has a mailing list dedicated to AppleScript Studio.

&lt;http://lists.apple.com/mailman/listinfo/applescript-studio&gt;

Also see: &lt;http://lists.apple.com/mhonarc/applescript-studio/&gt;

Nate
     
Professional Poster
Join Date: Dec 2000
Location: Staffs, UK
Status: Offline
Reply With Quote
Dec 19, 2001, 05:36 AM
 
Tim - thanks for the reply (and everyone else).

Yes - it is frustrating to run into roadblocks on the very first attempt at something. What's gets me is that these things are almost possible easily – the documentation even teases me with partial information on how to do them. Its a shame to hear that some things are broken already - but I suppose that explains the late release date of ASStudio.

I'm actually just trying to add an interface to a cutesy little desktop background randomiser. I wanted to let people select a directory (with a sheet dialog – hey this is Mac OS X right ?), save that setting, randomly change the desktop, and on a whim also display the current desktop image in a image view in the preferences window. Half of that just isn't going to happen right now...

On the other hand, I have two slider controls – one to set the maximum delay before changing the desktop, one to set the minimum. Obviously, I don't want the minimum to the greater than the maximum. I added a handler for the drag actions on the sliders, and moved the other slider if we try to pass it with the slider being dragged. This was so easy to do it was a joy, and actually works, moving the other slider in realtime (if a little jerkily) !
     
Grizzled Veteran
Join Date: Feb 2001
Location: Germany
Status: Offline
Reply With Quote
Dec 19, 2001, 09:39 AM
 
hey gee4orce, your e-mail address had permanent errors, so instead of sending it to you personally, i'll post it here:

the fact that you've had the exact same problems as i did in as studio had already made me suspicious -- the only difference in what we want to do is that i thought of a droplet onto which you drag an image file, a dialog pops up asking you for the placement (tile, crop,...) and then to hit ok to set the picture as desktop background.

well, i guess i'll just live without a preview for now (and wait for the next revision of as studio). but two other questions: do you know what all those different keys in ~/Library/Preferences/com.apple.desktop.plist are? i mean, they must be some sort of key to the screen resolution and monitor attached, but how do i interpret those numbers? any idea? (is that some sort of hash key?)

my other question is: do you want to read that file as text file and just replace the image paths or do you want to make it an nsdictionary and then set the objects to the keys ImageFilePath?

i think it would be a lot easier to do with an nsdictionary, but then again i think that doing the entire thing in cocoa would be a lot easier, i just finally want to get started with applescript.
     
Professional Poster
Join Date: Dec 2000
Location: Staffs, UK
Status: Offline
Reply With Quote
Dec 20, 2001, 02:43 AM
 
My email address works fine, thanks !

To change the desktop picture I used (paraphrasing from memory):

tell application "Finder" to set the desktop picture to ....

No need to muss with .plist files !
     
Mac Elite
Join Date: Oct 2000
Status: Offline
Reply With Quote
Dec 22, 2001, 12:17 AM
 
A couple questions...

1. How do I change the name of a window? "set name of window "whatever" to "..." " doesn't work.

2. How do I get the number of the currently selected row in a table view?

3. How do I create a new row in a table view? The row has two columms.

4. How can I have a drawer/toolbar in my window?

5. How do I set the selected row in a table view?

6. Is there a reference to what all these items are called?

7. Uhh.. has anyone made some good docs?

I appreciate any help..

synotic@mac.com
     
Fresh-Faced Recruit
Join Date: Dec 2001
Location: NJ, USA
Status: Offline
Reply With Quote
Dec 22, 2001, 08:25 AM
 
Originally posted by Synotic:
<STRONG>A couple questions...</STRONG>
1. How do I change the name of a window? "set name of window "whatever" to "..." " doesn't work.

Do you mean the name of the window or the title? If it's the title then this should work:

set the title of window "mainwindow" to "New Window Title"

4. How can I have a drawer/toolbar in my window?

There is a sample app that came with the latest dev tools called "Drawers". As far as a toolbar I was just wondering that myself, I think it may have to be done by calling a Cocoa method..for now.

HTH,

Steve W
Windows SysAdmin by day, OS X maniac by night...
     
Mac Elite
Join Date: Oct 2000
Status: Offline
Reply With Quote
Dec 22, 2001, 10:35 AM
 
1. Do you mean the name of the window or the title? If it's the title then this should work:

No.. I tried that... and again.. no luck.. no errors..

4. There is a sample app that came with the latest dev tools called "Drawers". As far as a toolbar I was just wondering that myself, I think it may have to be done by calling a Cocoa method..for now.

Thanks, looks fairly straightforward... how is the drawer connected to the View though? I didn't see anything in connections.


Also... how can (WHAT THE HELL&gt;&gt; I INSTALLED TYPE IT FOR MEX AND NOW CAPS WON"T GO OFF&gt;&gt; ) CHANGE THE CONTENTS OF THE STATIC TEXT? ALWAYS HAVING TO USE TEXT FIELDS FOR CHANGING DATA SEEMS UNPRACTICAL&gt;&gt;

[ 12-23-2001: Message edited by: Synotic ]
     
Senior User
Join Date: Mar 2001
Status: Offline
Reply With Quote
Dec 22, 2001, 01:16 PM
 
Originally posted by swoodnj2:
<STRONG>I had the same problem with properties maintaining their values...If anyone gets anywhere let us know!

Steve W</STRONG>
This is a known issue with applescript studio currently. It's in the release notes.

see " Script properties are not saved back into the application. Their values therefore do not persist between launches. If you want persistent storage of values, write them to a preferences file."

here: http://developer.apple.com/techpubs/...iptStudio.html
     
Mac Elite
Join Date: Oct 2000
Status: Offline
Reply With Quote
Dec 22, 2001, 03:19 PM
 
I am trying to recreate my old iDisk Mounter app that I made in OS 9, but I am getting errors when I try to add an item... can anyone help? here is its current form:

<BLOCKQUOTE><font size="1"face="Geneva, Verdana, Arial">code:</font><HR><pre><font size=1 face=courier>-- Application.applescript

(* ==== Properties ==== *)

property userIndex : <font color = blue>0</font>
property usersDataSource : {}

--will open is similar to the run event handler I think
on will open theObject
-- Set up the contactDataSource so that the rest will be simpler
set usersDataSource to data source of table view <font color = red>"users"</font> of scroll view <font color = red>"users"</font> of theObject

tell usersDataSource
make new data column at the end of the data columns with properties {name:<font color = red>"#"</font>}
make new data column at the end of the data columns with properties {name:<font color = red>"Name"</font>}
end tell
end will open

on clicked theObject
if name of theObject is <font color = red>"add"</font> then
set theName to contents of text field <font color = blue>5</font> of window of theObject
set thePass to contents of text field <font color = blue>6</font> of window of theObject
set theNum to ((length of usersDataSource) + <font color = blue>1</font>)

set theRow to make new data row at the end of the data rows of usersDataSource
getUserInfo(theWindow, theRow, theName, thePass, theNum)

my clearUserInfo(window of theObject)
end if
end clicked

on clearUserInfo(theWindow)
tell theWindow
set contents of text field <font color = blue>5</font> to <font color = red>""</font>
set contents of text field <font color = blue>6</font> to <font color = red>""</font>
end tell
end clearUserInfo

on getUserInfo(theWindow, theRow, theName, thePass, theNum)
tell theWindow
set contents of data cell <font color = blue>1</font> of theRow to theNum
set contents of data cell <font color = blue>2</font> of theRow to theName
end tell
end getUserInfo</font>[/code]

If anyone needs the actual file so that you can see the nib and such then I can upload it.
     
Fresh-Faced Recruit
Join Date: Dec 2001
Location: NJ, USA
Status: Offline
Reply With Quote
Dec 22, 2001, 03:22 PM
 
[QUOTE]Originally posted by iamnotmad:
<STRONG>

This is a known issue with applescript studio currently. It's in the release notes.

see " Script properties are not saved back into the application. Their values therefore do not persist between launches. If you want persistent storage of values, write them to a preferences file."

here: http://developer.apple.com/techpubs/...iptStudio.html</STRONG>[/QUOTE ]

Thanks, I'm one of THOSE PEOPLE that don't always read the release notes or the readme files.

Steve W
Windows SysAdmin by day, OS X maniac by night...
     
Fresh-Faced Recruit
Join Date: Dec 2001
Status: Offline
Reply With Quote
Dec 22, 2001, 08:18 PM
 
Originally posted by Synotic:
<STRONG>I am trying to recreate my old iDisk Mounter app that I made in OS 9, but I am getting errors when I try to add an item... can anyone help? here is its current form:

&lt;snip code&gt;

If anyone needs the actual file so that you can see the nib and such then I can upload it.</STRONG>
Why don't you send me your project, and I'll take a quick look at it. tbumgarner@pobox.com

[gzl: removed the quoting of the code, which came out a bit nasty. got to get around to fixing that... =) ]

[ 12-23-2001: Message edited by: gorgonzola ]
     
Mac Elite
Join Date: Oct 2000
Status: Offline
Reply With Quote
Dec 23, 2001, 03:44 PM
 
Originally posted by Tim Bumgarner:
<STRONG>

Why don't you send me your project, and I'll take a quick look at it.</STRONG>
done

Also, I am trying to make a Forum Viewer. But to retrieve the html of a site, I need to use Cocoa because I don't believe AppleScript can do it. I myself don't know any Cocoa so someone sent me a ".m" and ".h" I think those are header and class files.

Here is the contents of the .m file:

<BLOCKQUOTE><font size="1"face="Geneva, Verdana, Arial">code:</font><HR><pre><font size=1 face=courier>#import <font color = red>"MacNNCodeGetter.h"</font>


@implementation MacNNCodeGetter
+ (NSString*)getCode NSString *)url
{
return [NSString stringWithContentsOfURL:[NSURL URLWithString:url]];
}
@end</font>[/code]

and here is the contents of the .h file:

<BLOCKQUOTE><font size="1"face="Geneva, Verdana, Arial">code:</font><HR><pre><font size=1 face=courier>#import &lt;Foundation/Foundation.h&gt;


@interface MacNNCodeGetter : NSObject {

}
+ (NSString*)getCode NSString *)url;
@end
</font>[/code]

Looking at your example above, "getCode" would be the method right? Well I put those header and class files in my project, and then added the following to my application.applescript file:

<BLOCKQUOTE><font size="1"face="Geneva, Verdana, Arial">code:</font><HR><pre><font size=1 face=courier>-- Application.applescript

on clicked theObject
tell window of theObject
set contents of text field <font color = red>"textFieldForSource"</font> to (call method <font color = red>"getCode:"</font> with parameter <font color = red>"http:<font color = brown>//www.apple.com/index.html"</font>)</font>
end tell
end clicked</font>[/code]

I tried changing between "call method "getCode:"" and "call method "getCode"" with no luck both times, how do I set the contents of the text field to the source code of Apple.com?
     
Fresh-Faced Recruit
Join Date: Dec 2001
Status: Offline
Reply With Quote
Dec 23, 2001, 08:59 PM
 
Originally posted by Synotic:
<STRONG>done

Also, I am trying to make a Forum Viewer. But to retrieve the html of a site, I need to use Cocoa because I don't believe AppleScript can do it. I myself don't know any Cocoa so someone sent me a ".m" and ".h" I think those are header and class files.

Here is the contents of the .m file:

&lt;blockquote&gt;&lt;font size=1 face="Geneva, Verdana, Arial"&gt;code:&lt;/font&gt;&lt;hr&gt;&lt;pre&gt;& amp;lt;font size=1 face=courier&gt;#import &lt;font color=red&gt;"MacNNCodeGetter.h"&lt;/font&gt;


@implementation MacNNCodeGetter
+ (NSString*)getCode NSString *)url
{
return [NSString stringWithContentsOfURL:[NSURL URLWithString:url]];
}
@end&lt;/font&gt;&lt;/pre&gt;&lt;hr&gt;&lt;/blockquote&gt;

and here is the contents of the .h file:

&lt;blockquote&gt;&lt;font size=1 face="Geneva, Verdana, Arial"&gt;code:&lt;/font&gt;&lt;hr&gt;&lt;pre&gt;& amp;lt;font size=1 face=courier&gt;#import &lt;Foundation/Foundation.h&gt;


@interface MacNNCodeGetter : NSObject {

}
+ (NSString*)getCode NSString *)url;
@end
&lt;/font&gt;&lt;/pre&gt;&lt;hr&gt;&lt;/blockquote&gt;

Looking at your example above, "getCode" would be the method right? Well I put those header and class files in my project, and then added the following to my application.applescript file:

&lt;blockquote&gt;&lt;font size=1 face="Geneva, Verdana, Arial"&gt;code:&lt;/font&gt;&lt;hr&gt;&lt;pre&gt;& amp;lt;font size=1 face=courier&gt;-- Application.applescript

on clicked theObject
tell window of theObject
set contents of text field &lt;font color=red&gt;"textFieldForSource"&lt;/font&gt; to (call method &lt;font color=red&gt;"getCode:"&lt;/font&gt; with parameter &lt;font color=red&gt;"http:&lt;font color=brown&gt;//www.apple.com/index.html"&lt;/font&gt; )&lt;/font&gt;
end tell
end clicked&lt;/font&gt;&lt;/pre&gt;&lt;hr&gt;&lt;/blockquote&gt;

I tried changing between "call method "getCode:"" and "call method "getCode"" with no luck both times, how do I set the contents of the text field to the source code of Apple.com?</STRONG>
I took a quick look and it appears that you haven't hooked up the 'will open' event handler in your nib file. What you need to do is open the MainMenu.nib (from Project Builder) and then select the window object and then open the AppleScript information panel and check the 'will open' event handler of the 'window' category, and then check the 'Application.applescript'. Since this connection wasn't made in your nib, it wasn't being executed, therefore the data source wasn't being created.

Keep in mind that simply adding an event handler in your .applescript will not enable it to be called, you need the connection in Interface Builder.
     
Mac Elite
Join Date: Oct 2000
Status: Offline
Reply With Quote
Dec 24, 2001, 12:46 AM
 
Originally posted by Tim Bumgarner:
<STRONG>

I took a quick look and it appears that you haven't hooked up the 'will open' event handler in your nib file. What you need to do is open the MainMenu.nib (from Project Builder) and then select the window object and then open the AppleScript information panel and check the 'will open' event handler of the 'window' category, and then check the 'Application.applescript'. Since this connection wasn't made in your nib, it wasn't being executed, therefore the data source wasn't being created.

Keep in mind that simply adding an event handler in your .applescript will not enable it to be called, you need the connection in Interface Builder.</STRONG>
I did so.. but now, when it is launched, I get an error that the variable that I created doesn't exist.. usersDataSource I think.
     
Mac Elite
Join Date: Oct 2000
Status: Offline
Reply With Quote
Dec 24, 2001, 01:11 PM
 
Originally posted by Synotic:
<STRONG>I did so.. but now, when it is launched, I get an error that the variable that I created doesn't exist.. usersDataSource I think.</STRONG>
Okay, I just based my script on the "Without Data Source" example instead. now it works. I also (with help) got the source retrieving thing working.
     
Professional Poster
Join Date: Dec 2000
Location: UK
Status: Offline
Reply With Quote
Dec 29, 2001, 01:11 PM
 
Is AppleScript Studio available as a standalone download, I don't fancy downloading the 10.1 dev tools on my modem just to get A.S.S.

Look after my manor, or I will bum you, literally, to death.
     
Mac Elite
Join Date: Sep 2001
Location: The Land of Beer and Chocolates
Status: Offline
Reply With Quote
Dec 29, 2001, 02:09 PM
 
Originally posted by ajprice:
<STRONG>Is AppleScript Studio available as a standalone download, I don't fancy downloading the 10.1 dev tools on my modem just to get A.S.S.</STRONG>
It's a part of the DevTools , and it needs the other files to work . I guess you'll have to download the 200 MB file .
     
Grizzled Veteran
Join Date: Sep 2000
Location: Adelaide, Australia
Status: Offline
Reply With Quote
Dec 29, 2001, 03:35 PM
 
Originally posted by Synotic:
<STRONG>A couple questions...

2. How do I get the number of the currently selected row in a table view?

I appreciate any help..

synotic@mac.com</STRONG>
Hi

This is in the Tables examples. I was trying to do something similar
without tables.

Is it possible i I have a collection of lines
of text in a text window to know where the user clicks. I am
making an LDAP searcher and I can get the output in a text window but I want
a click on an email address to launch the email program. I guess I can make the whole thing into a table which is invisible to the
user but it seems I should be able to get the line number
of the line that is being clicked on .... maybe !

Thanks - Michael
     
Mac Elite
Join Date: Jul 2000
Location: Washington, DC
Status: Offline
Reply With Quote
Jan 20, 2002, 02:18 PM
 
Originally posted by Synotic:
<STRONG>I am trying to recreate my old iDisk Mounter app that I made in OS 9, but I am getting errors when I try to add an item... can anyone help? here is its current form:

&lt;BLOCKQUOTE&gt;&lt;code snip&gt;&lt;/BLOCKQUOTE&gt;

If anyone needs the actual file so that you can see the nib and such then I can upload it.</STRONG>
I am attempting to create a similar application that uses a table as a data source but have input come through a sheet containing various text fields and check boxes. I can compile, but I get all sorts of errors that I can't seem to track down (I think they are related to the 'tell window of theObject' ect and complication with the panel. How do I know when I need to tell the window to perform a set of actions or when to denote that an item is part of a window or panel (i.e. 'set the enabled of text field "someField" of panel window "thePanelName"')?

The AppleScript Studio examples don't seem to show me exactly when to use what.

How did it come to this? Goodbye PowerPC. | sensory output
     
Dedicated MacNNer
Join Date: May 2001
Location: Sierra Nevada Country
Status: Offline
Reply With Quote
Jan 22, 2002, 11:11 PM
 
I can't wait for Apple to release Transitional Integrated Tcl/Tk Studio... then we can have T.I.T.S. and A.S.S.
First there was man, then there was Macintosh
     
Mac Elite
Join Date: Jul 2000
Location: Washington, DC
Status: Offline
Reply With Quote
Jan 24, 2002, 05:19 AM
 
Originally posted by Synotic:
<STRONG>Okay, I just based my script on the "Without Data Source" example instead. now it works. I also (with help) got the source retrieving thing working.</STRONG>
Samre problem here. I guess I'll try and base mine on the "Without Data Source" example as well. Judging by the sample table apps, however, the without data source appears to be slower.

How did it come to this? Goodbye PowerPC. | sensory output
     
Lew
Senior User
Join Date: Dec 2001
Location: England, UK
Status: Offline
Reply With Quote
Jan 24, 2002, 07:01 AM
 
Originally posted by Jan Van Boghout:
<STRONG>

It's a part of the DevTools , and it needs the other files to work . I guess you'll have to download the 200 MB file .</STRONG>
There's also a segmented download available. You can download the disk image as 10MB chunks.
     
Junior Member
Join Date: Sep 2000
Location: Milwaukee, WI
Status: Offline
Reply With Quote
Jan 29, 2002, 10:16 PM
 
Originally posted by Synotic:
<STRONG>Okay, I just based my script on the "Without Data Source" example instead. now it works. I also (with help) got the source retrieving thing working.</STRONG>
Ack. Following along from posts above...

How did you do get the script to retrieve the content of the url?

I can get this to work:
getWebText.m
-----------------------

#import "getWebText.h"

@implementation getWebText
+ (NSString *)myGetWebText
{
return [NSString stringWithContentsOfURL:[NSURL URLWithString:@"http://homepage.mac.com/someMacAccount/test.txt"]];
}
@end
-----------------------

Seems I can't pass the url parameters from the script properly. Does anyone have working objective-c code for passing the url parameters(?)

This does not work:
return [NSString stringWithContentsOfURL:[NSURL URLWithString:url]];

[ 01-30-2002: Message edited by: n8910 ]
     
Mac Elite
Join Date: Oct 2000
Status: Offline
Reply With Quote
Jan 31, 2002, 12:52 AM
 
Originally posted by n8910:
<STRONG>

Ack. Following along from posts above...

How did you do get the script to retrieve the content of the url?

I can get this to work:
getWebText.m
-----------------------

#import "getWebText.h"

@implementation getWebText
+ (NSString *)myGetWebText
{
return [NSString stringWithContentsOfURL:[NSURL URLWithString:@"http://homepage.mac.com/someMacAccount/test.txt"]];
}
@end
-----------------------

Seems I can't pass the url parameters from the script properly. Does anyone have working objective-c code for passing the url parameters(?)

This does not work:
return [NSString stringWithContentsOfURL:[NSURL URLWithString:url]];

[ 01-30-2002: Message edited by: n8910 ]</STRONG>
do shell script "curl <A HREF="http://www.apple.com/index.html"" TARGET=_blank>http://www.apple.com/index.html"</A>

BTW, for anyone having problems with table views, use the "with data source" example. It is just more logical. Copy the code exactly, name the objects exactly, THEN, in the place where all the GUI items are available, click on the Applescript section at the top, drag a data source to your instances tab. Now select your table view.. double click on it, control click and drag to the data source, then in the Connections panel, press Connect.
     
Junior Member
Join Date: Sep 2000
Location: Milwaukee, WI
Status: Offline
Reply With Quote
Jan 31, 2002, 08:42 AM
 
[QUOTE]Originally posted by Synotic:
[QB]do shell script "curl <A HREF="http://www.apple.com/index.html"" TARGET=_blank>http://www.apple.com/index.html"</A>

Got it:

getHtmlTxt.m
--------------------------------------
#import "getHtmlTxt.h"

@implementation getHtmlTxt
+ (NSString *)getTxt : (NSString *)urlPath{
return [NSString stringWithContentsOfURL: [NSURL URLWithString:urlPath]];
}
@end
--------------------------------------

getHtmlTxt.h
--------------------------------------
#import &lt;Foundation/Foundation.h&gt;

@interface getHtmlTxt : NSObject {
}
+ (NSString *)getTxt : (NSString *)urlPath;
@end
--------------------------------------

AppleScript.applescript
--------------------------------------
on doWhatever kObject
tell window of kObject
set xyz to call method "getTxt:" of class "getHtmlTxt" with parameter "http://SomeServer/SomeCgi?SomeParameter"
set contents of text view "mTextView" of scroll view "mScrollView" to (xyz as string)
end doWhatever
--------------------------------------

AS-Studio is a beautiful thing! Thanks Apple!

[ 01-31-2002: Message edited by: n8910 ]
     
Junior Member
Join Date: Sep 2000
Location: Milwaukee, WI
Status: Offline
Reply With Quote
Jan 31, 2002, 02:03 PM
 
So - The next question is:

How would I go about loading images from a URL? I tried a few things, none of which seemed to work..
     
Addicted to MacNN
Join Date: Mar 2000
Location: London, UK
Status: Offline
Reply With Quote
Feb 1, 2002, 01:52 PM
 
See NSURLHandle, and then you can use NSImage's -initWithData: method.
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 03:06 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2