Forked from leohackin/rastrear_encomenda_correios_for_mac
Created
February 4, 2011 20:36
-
-
Save wbotelhos/811719 to your computer and use it in GitHub Desktop.
Rastreador de Encomendas dos Correios.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Created by Léo Hackin (leohackin at gmail.com), Jan 2011 | |
# This file is free software. You are free to use this file in any way you like | |
# However, if you change it you should note in this file that you did and who | |
# you are, you also need to change the version string if you do. That way | |
# I will not get support questions for software that is not entirely mine. | |
# rastreia_encomenda_correios v.0.1a for mac | |
# Script para rastreamento de encomenda dos Correios. | |
# O script verifica a cada 2 minutos se houve alguma | |
# movimentacao: em caso afirmativo, ele alerta o usuario | |
# com uma mensagem e abre o navegador para exibir o rastreamento | |
# | |
# --Necessário-- | |
# chmod +x ./<nomedoscript> (uma vez apenas) | |
# | |
# --Uso-- | |
# ./<nomedoscript> codigo_da_sua_encomenda | |
# ./rastreia_encomenda CP123456789US (exemplo) | |
# | |
if [ "$1" == "" ] | |
then | |
echo "Informe o codigo da encomenda" | |
exit 666 | |
fi | |
while true | |
do | |
curl -o novorastreamento.txt -d "P_LINGUA=001&P_TIPO=001&P_COD_UNI=$1" http://websro.correios.com.br/sro_bin/txect01$.QueryList? | |
V=`diff -uNr antigorastreamento.txt novorastreamento.txt` | |
if [ "$V" != "" ] | |
then | |
/usr/bin/osascript -e 'tell application "Finder"' -e "activate" -e "display dialog \"O rastreamento mudou! ;)\"" -e 'end tell' | |
if [ "$?" == "0" ] | |
then | |
open "http://websro.correios.com.br/sro_bin/txect01$.QueryList?P_LINGUA=001&P_TIPO=001&P_COD_UNI=$1" | |
fi | |
curl -o antigorastreamento.txt -d "P_LINGUA=001&P_TIPO=001&P_COD_UNI=$1" http://websro.correios.com.br/sro_bin/txect01$.QueryList? | |
fi | |
sleep 120 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment