Some AppleScript help over here

5 posts / 0 new
Last post
Offline
Last seen: 17 years 10 months ago
Joined: Nov 1 2004 - 08:41
Posts: 15
Some AppleScript help over here

I am not AppleScript literate, so if someone could please help me with this little script I wrote for "ircle", the program I use for IRC

tell application "ircle 3.1 Am. English Carbon"
set ch to currenttarget
set n to numberofusers of ch
set counter to (???)
set u to nickname of user counter of ch
set obj to argstring
if obj = "" then
set obj to "a large trout"
end if
do "/me smacks " & u & " around a bit with " & obj
end tell

I want the script to choose a random user. "n" is the number of users in the selected channel. What do I need to set "counter" to if I want a random integer between 1 and "n"?

Tiger G5 Kid's picture
Offline
Last seen: 18 years 1 month ago
Joined: Dec 20 2003 - 10:38
Posts: 134
thru

try:

set counter to (1 thru n)

Offline
Last seen: 17 years 10 months ago
Joined: Nov 1 2004 - 08:41
Posts: 15
nope

It didn't work. Got the syntax error message "a thru:n can't go after this 1"

anyone else? Beee

edit: proper syntax is
set counter to integers 1 thru n
but that's not what I want. I want counter to be ONE integer BETWEEN 1 and n

another edit:
I also tried
set counter to integer is less than n
returned the error "can't make integer into a number, date, or text

Tiger G5 Kid's picture
Offline
Last seen: 18 years 1 month ago
Joined: Dec 20 2003 - 10:38
Posts: 134
bingo - scripting additions dictionary

set counter to (random number from 1 to n)

Offline
Last seen: 17 years 10 months ago
Joined: Nov 1 2004 - 08:41
Posts: 15
bwahaha

Hell yes man, that totally worked Biggrin

Thanks a bunch. ^_^

Log in or register to post comments