Strict Standards: Declaration of plxFeed::prechauffage() should be compatible with plxMotor::prechauffage($mode = '', $motif = '', $bypage = '') in /var/www/sda/4/3/manuchap/pluxml/core/lib/class.plx.feed.php on line 490

Deprecated: Non-static method plxDate::microtime() should not be called statically, assuming $this from incompatible context in /var/www/sda/4/3/manuchap/pluxml/core/lib/class.plx.motor.php on line 56

Deprecated: Non-static method plxUtils::getGets() should not be called statically, assuming $this from incompatible context in /var/www/sda/4/3/manuchap/pluxml/core/lib/class.plx.motor.php on line 57

Deprecated: Non-static method plxUtils::mobileDetect() should not be called statically, assuming $this from incompatible context in /var/www/sda/4/3/manuchap/pluxml/core/lib/class.plx.motor.php on line 65

Warning: Cannot modify header information - headers already sent by (output started at /var/www/sda/4/3/manuchap/pluxml/core/lib/class.plx.feed.php:490) in /var/www/sda/4/3/manuchap/pluxml/core/lib/class.plx.utils.php on line 558

Warning: Cannot modify header information - headers already sent by (output started at /var/www/sda/4/3/manuchap/pluxml/core/lib/class.plx.feed.php:490) in /var/www/sda/4/3/manuchap/pluxml/core/lib/class.plx.utils.php on line 559

Deprecated: Non-static method plxDate::dateToIso() should not be called statically, assuming $this from incompatible context in /var/www/sda/4/3/manuchap/pluxml/core/lib/class.plx.motor.php on line 473

Warning: Cannot modify header information - headers already sent by (output started at /var/www/sda/4/3/manuchap/pluxml/core/lib/class.plx.feed.php:490) in /var/www/sda/4/3/manuchap/pluxml/index.php on line 54
<br /> <b>Deprecated</b>: Non-static method plxUtils::strCheck() should not be called statically, assuming $this from incompatible context in <b>/var/www/sda/4/3/manuchap/pluxml/core/lib/class.plx.show.php</b> on line <b>135</b><br /> Afficher votre statut ichat sur votre site. [maj] - Blog Notes


Deprecated: Non-static method plxUtils::strCheck() should not be called statically, assuming $this from incompatible context in /var/www/sda/4/3/manuchap/pluxml/core/lib/class.plx.show.php on line 390
Afficher votre statut ichat sur votre site. [maj]

Classé dans :
Deprecated: Non-static method plxUtils::strCheck() should not be called statically, assuming $this from incompatible context in /var/www/sda/4/3/manuchap/pluxml/core/lib/class.plx.show.php on line 467
Web | 0 commentaire(s)


Deprecated: Non-static method plxDate::dateIsoToHum() should not be called statically, assuming $this from incompatible context in /var/www/sda/4/3/manuchap/pluxml/core/lib/class.plx.show.php on line 421

Deprecated: Non-static method plxDate::getCalendar() should not be called statically, assuming $this from incompatible context in /var/www/sda/4/3/manuchap/pluxml/core/lib/class.plx.date.php on line 109

Deprecated: Non-static method plxDate::getCalendar() should not be called statically, assuming $this from incompatible context in /var/www/sda/4/3/manuchap/pluxml/core/lib/class.plx.date.php on line 110
04
09 | 11

Certains on peut être eu la curiosité de cliquer dans l'angle en haut à droite du blog et ont atterri sur mon site d'assistance. Si, avec la grosse ampoule qui indique si je suis connecté à internet. Pour que le site soit opérationnel il fallait que le statut sur le site corresponde à celui d'iChat de façon automatique.
J'ai pas mal galéré avant de trouver cette méthode qui n'est peut être pas la plus élégante mais ça fonctionne.
Au début j'ai essayé avec mon statut twitter, puis facebook sans succès. Et puis en regardant dans les préférences d'iChat: Alléluia! Il est possible d'exécuter un script applescript par évènement et donc quand on passe d'online à offline (et inversement).

Sur le site, la valeur du statut était codée en dur à offline (0) par défaut et j'oubliais tout le temps de le mettre à jour. Je l'ai donc modifié pour que cette valeur soit dans un fichier json à part:

statut.js (contenant une simple paire clé/valeur):

{ "value" : "0" }

Vu que je ne connais pas bien applescript j'ai opté pour un solution simple: créer deux scripts contenant une instruction en ligne de commande pour envoyer ce fichier par ftp (un pour online, un pour offline).
Donc voici les deux scripts.
Online:
using terms from application "iChat"
	on login finished
		set Source to "/Users/toto/Documents/mystatus/online/status.js"
		set Dest to "ftp.alwaysdata.com/www/"
		do shell script "curl -u ftpuser:ftppassword -T {" & quoted form of POSIX path of Source & "} " & Dest
	end login finished
end using terms from


Offline:
using terms from application "iChat"
	on logout finished
		set Source to "/Users/toto/Documents/mystatus/offline/status.js"
		set Dest to "ftp.alwaysdata.com/www/"
		do shell script "curl -u ftpuser:ftppassword -T {" & quoted form of POSIX path of Source & "} " & Dest
	end logout finished
end using terms from


Les lignes avant et après le commande shell sont là pour éviter l'erreur fatale 1708 qui vous affiche 15 fenêtres d'erreur en cascade façon windoze ;-)
Tout cela se fait de façon invisible et immédiate of course.


Partager cette page :

Identi.ca Twitter Digg Stumble Delicious Technorati Facebook


Ecrire un commentaire



Quelle est la cinquième lettre du mot ccelye ? :