Skip to content

Instantly share code, notes, and snippets.

@kubrick06010
Last active March 27, 2022 13:46
Show Gist options
  • Select an option

  • Save kubrick06010/2210927 to your computer and use it in GitHub Desktop.

Select an option

Save kubrick06010/2210927 to your computer and use it in GitHub Desktop.
toalla for textual
-- Dalboz 2011
-- Toalla for Textual IRC Client Mac serás sodomizado
on textualcmd(nick1)
set chopea to words of nick1
set nick2 to item 1 of chopea
-- set repetir to item 2 of chopea
--repeat repetir times
ok(nick2)
--end repeat
end textualcmd
on ok(nick2)
set userHome to (short user name of (system info))
set destino to (("/Users/" & userHome & "/Library/Application Scripts/com.codeux.apps.textual/") & "toalla.txt")
--set comando to " https://raw.github.com/Dalboz/scripts-varios/master/toalla/toalla.txt -o " as string
set curler to "/usr/bin/curl" as string
set existe to "false" as boolean
tell application "Finder" to if exists destino as POSIX file then set existe to true
--if existe is false then
--do shell script curler & comando & (quoted form of destino)
--end if
set algo to read destino using delimiter "
"
set link to {"%1%", "%RNICK%", "%NETWORK%"}
set toalla to round {(random number from 1 to count algo)}
set textu to item toalla of algo
set largo to length of textu
set nick2 to replaceText(link, nick2, textu)
end ok
on replaceText(find, replace, subject)
set prevTIDs to text item delimiters of AppleScript
set text item delimiters of AppleScript to find
set subject to text items of subject
set text item delimiters of AppleScript to replace
set subject to "" & subject
set text item delimiters of AppleScript to prevTIDs
return subject
end replaceText
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment