Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

ian36

macrumors newbie
Original poster
Mar 29, 2009
1
0
Hi I am new to programming with Applescript, I want to be able to message other people on my shared network I have a starting script which is :

tell application "Finder"
display dialog "My Message"
end tell

But this only makes a message on my screen, I would like ideally to have a message to other computers on my network pop up on their screen and very ideally have them have a reply box. Please anything will be appreciated.
 
Hope you don't mind me hijacking your thread somewhat, Ian, but I have a very similar question. :)

I'm looking to make a simple utility that'll let me write a short message which will pop up as a dialog/alert on another Mac on the local network. Sort of like a GUIfied "net send" for OS X. Even after using my trusty PowerBook for the last four years, I'm still quite new to AppleScript, and am only now beginning to explore its ways.

I'm approaching this from the angle of making an AppleScript application in Xcode, so that I can lay out my own UI as needed.

picture1bxa.png


My first problem (of many, I'm sure :rolleyes:) is that as soon as I "end editing" any of the first three text fields, I get an AppleScript Error like: Can't get «class texF» "toField". (-1728) The only code that deals with those three fields so far is that which tries to get the contents of each of them and set three corresponding variables (toName, fromName, messageContent) to those contents:

Code:
on end editing theObject
	if the name of theObject is "toField" then
		set toName to contents of text field "toField"
	else if the name of theObject is "fromField" then
		set fromName to contents of text field "fromField"
	else if the name of theObject is "messageField" then
		set messageContent to contents of text field "messageField"
	end if
end end editing

(The "button" stuff in the bottom half of the window is non-functional at this point, but I suppose their goal is evident.) Pretty much all the code in the script so far is stuff I've gleaned from various relevant-seeming online tutorials, so I can only assume I'm missing something. I've hooked up the text fields to the application script in IB, so hopefully it's not just an "unplugged wire". :p

Ultimately, I'm assuming I will end up having my application script call a shell script, which, in turn, will call a "display dialog" or somesuch on the remote computer using the above variables to fill in the dialog's contents, and the button fields (which will require some conditional stuff I have yet to learn how to do) to set the buttons' labels. If there's a better way to do it, I'll gladly use it. I expect I'll type in, say, an IP or user@computer string in the toField to give the shell script a destination for its dirty doings. I can provide the Xcode project if necessary. Does anyone have a helpful tip or two?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.