Attach Applescript to a textfield

Hi,

how can I attach the following “Applescript” to a textfield?


tell application "Internet Connect" 
get bytes received of status 
       get bytes sent of status 
end tell

Can somebody give me a hint on how to solve this issue?

Thanks and best regards,

Stefan

textfield of what? the result of each line is an integer, if you need text, you must
coerce it to text or a string, like “get bytes sent of status as string”

Model: G5 dual 2,5 GHz
Browser: Safari 419.3
Operating System: Mac OS X (10.4)

Hi Stefan,

I want to display the status of the internet connection in
my application (GUI Application)


tell application "Internet Connect"
get bytes sent of status as string 
end tell

How can I tell AS to show the messages in my Appli?

Thanks for your response,

Stefan

something like that?

tell application "Internet Connect"
	set bytes_rec to bytes received of status as string
	set bytes_sent to bytes sent of status as string
end tell
display dialog "bytes received: " & bytes_rec & return & "bytes sent: " & bytes_sent

Model: G5 dual 2,5 GHz
Browser: Safari 419.3
Operating System: Mac OS X (10.4)

Hi Stefan,

thanks for your help - it works perfect - but now it the message is
poping up - to display it inside the appli I have to put it in a textfield?

Am I right?

Thanks for your help and time,

Stefan

it’s quite difficult to answer without knowing which application you’re talking about :wink:

Hi Stefan,

Since you wrote your app is a ‘GUI Application’ I guess you posted in the wrong forum part? Is it an AppleScript Studio/Xcode Application? Then you write something like this:


tell application "Internet Connect"
   set bytes_rec to bytes received of status as string
   set bytes_sent to bytes sent of status as string
end tell
set contents of text field "tf" of window "main" to ("bytes received: " & bytes_rec & return & "bytes sent: " & bytes_sent)

(Asuming you have a text field named “tf” on a window named “main”)

Dominik

Hi Dominik,

thanks for your assistance and for your help - this works great - the ammount
received and sended will now be displayed in the window - not there where I
want it to be displayed, but I will find out why soon…

I want to display it in a tab…

I will fix it - thanks again for your help…

Best regards,

Stefan

Maybe this is interessting for somebody:

If you have a tab then you have to do the following:


set content to text field "nameoftextfield" of tab view item "tabviewname" of tab view "tabviewname" of window "windowname" to Variable

Best regards,

Stefan