Modificare la barra di stato di iChat

Va subito detto che non è farina del mio sacco, anzi i meriti vanno dati interamente a Enzo Borri. Ho solamente modificato le frasi al suo interno e il risultato lo potete vedere sulla barra di stato del mio contatto iChat. Vediamo...
Un piccolo tip per rendere più simpatico l'uso di iChat. Un grazie ancora al creatore dell' Applescript che provvede a rendere la barra di stato del noto software di messaging di Apple oltremodo interessante e cool. Qui sotto vi riporto il codice che dovrete copia-incollare in ScriptEditor l'applicazione che serve a creare gli script per pilotare numerose applicazioni Apple. Questo tip che vi permetterà di creare una vera e propria Applicazione per Mac OS X, serve a far variare il messaggio che compare nella status bar di iChat con una cadenza temporale.

Codice:

on run -- this is called opening the program
    global StatusList, NextStatusParagraph, NumberOfLines
    -- created 3 global variables
    set StatusList to ""
    -- StatusList will contain the list of the status messages
    set NextStatusParagraph to ""
    -- To keep track of the next status message to display
    set NumberOfLines to ""
    -- the total number of paragraps in the list (StatusList)
end run

on idle
    global StatusList, NextStatusParagraph, NumberOfLines
    -- I recall the same global variables
   
    if StatusList = "" then
        -- if StatusList is empty, this mean I must create the list.
        inizializeStatusList()
        -- inizializeStatusList puts all of the status messages
        -- inside the global variable called "StatusList"
        set NumberOfLines to count paragraphs in StatusList
        -- When I created the list of the status messages, I count the lins in it.
        -- This is useful to be able to add/remove status messages
        -- from the list without changing this part of code
        set NextStatusParagraph to random number from 1 to NumberOfLines
        -- Now, I must define wich one will be the first status message to show
    end if
   
   
    tell application "iChat"
        -- The commands to change the status message must be sent to iChat
        set status message to paragraph (NextStatusParagraph) of StatusList
        -- the status shown is the one in the paragraph whose number is contained in "NextStatusParagraph"
        if NextStatusParagraph ≥ NumberOfLines then
            -- if I shown the last status (the last paragraph)
            -- the counter indicate a number greater than the
            -- number of paragraph in the list then...
            set NextStatusParagraph to 1
            -- I start from back from the first status message
        else
            set NextStatusParagraph to NextStatusParagraph + 1
            -- otherwise, I set to show the message in the next paragraph
        end if
    end tell
   
    return 10
    -- after 10 econds, I change the message again so I set the delay to "10"
end idle

on inizializeStatusList()
    -- here I create the list of all of my status messages
    global StatusList
    -- First of all, I recall the global variable "StatusList"
    set StatusList to "Chi copia..." & return
    -- Now the variable "StatusList" contains only two lines of text;
    -- the first one is "MY FIRST STATUS MESSAGE" and a return character
    -- and the second one is empty
   
    set StatusList to StatusList & "è proprio un bischero" & return
    -- The second and the following line must be created using this code.
    -- This will append the new message in the list after the previous
   
    set StatusList to StatusList & "digli di smettere!"
    -- and the last message must ends this way; without a "return" at the end.
end inizializeStatusList

Come vedete basta modificare le scritte comprese tra virgolette "" con le vostre frasi personali. Un altro parametro che potete modificare è il numero di secondi che devono intercorrere tra un cambiamento e l'altro. In ogni caso io lascerei il valore preimpostato di 10 secondi, diminuendo si rischia di infastidire gli utenti iChat che hanno il tuo contatto. Una volta che avete apportato tutte le modifiche opportune salvate lo script in modo che se poi vorrete successivamente tornare a modificare le frasi lo potrete fare tranquillamente, e poi fate un Salva con nome, ma stavolta salvate il file come Applicazione non dimenticandovi di "chekkare" anche la voce Non Uscire. Fine adesso che abbiamo creato la nostra applicazione siamo pronti per usarla. Basta un doppio click e con iChat aperto vedrete la status bar cambiare voce ogni 10 secondi. Se chiudete l'applicazione iChat tornerà a funzionare normalmente.


Tip di: Niguli
Discussione sul forum