Ir para conteúdo
  • Cadastre-se

Novos Posts do MM direto no Desktop


Posts Recomendados

Fala galera! Não sabia onde postar isso no fórum, aí resolvi postar aqui mesmo.
 

Pra quem gosta de personalizar o desktop, criei um mini script para pegar os últimos post do Macmagazine e deixar fixado no desktop. 
 

Estou usando o Geektools, que achei sem querer na net.

Os posts são atualizados a cada 30min (da para personalizar o tempo de refresh, fonte e cor). Quem quiser é só pedir!
 

Print do desktop, para mostrar como que fica:

http://s29.postimg.org/y1b9c0rsn/Screen_Shot_2014_03_10_at_13_27_10.png

 

 

 

Abraço!!!

Editado por Lucas Maciel
Link para o comentário
Compartilhar em outros sites

Detalhe: ainda estou começando com essa coisa de AppleScript.

 

Esse código daí requer que o safari tenha pelo menos uma aba aberta!
 

Amanhã vou dar uma reformulada no funcionamento. Se tiver alguém aqui que tenha a manha no assunto, sinta-se livre para

 

fazer qualquer modificação!!!

Link para o comentário
Compartilhar em outros sites

Desculpa aí, não colou da primeira vez.

 

tell application "Safari"

set URL of tab 1 of window 1 to "http://www.macmagazine.com.br/"

delay 5

set myurl to get URL of tab 1 of window 1

 

set tab1text to get text of tab 1 of window 1

 

repeat until (offset of "Últimas Notícias" in tab1text) is 0

set the_offset to offset of "Últimas Notícias" in tab1text

set tab1text to items (the_offset + 17) thru (count tab1text) of tab1text as string

end repeat

end tell

 

set textoCompleto to ""

repeat with i from 1 to 20

set tab2text to paragraph i of tab1text

if length of tab2text is greater than 80 then

if length of tab2text is not greater than 250 then

set textoCompleto to textoCompleto & tab2text & linefeed & linefeed

end if

end if

end repeat

return textoCompleto

Link para o comentário
Compartilhar em outros sites

Achei interessante aquele controle de banda no canto superior direito...

 

Como colocou ele ali?

 

 

Outro Script:

EN1 = Wireless     EN0 = Cabo Ethernet

 

INTERFACE=en1;  
 
SAMPLE_A=(`/usr/sbin/netstat -bI "$INTERFACE" | awk "/$INTERFACE/"'{print $7" "$10; exit}'`);
 
sleep 1;
 
SAMPLE_B=(`/usr/sbin/netstat -bI "$INTERFACE" | awk "/$INTERFACE/"'{print $7" "$10; exit}'`);
 

BANDWIDTH_USAGE=(`echo "2k ${SAMPLE_B[0]} ${SAMPLE_A[0]} - 1024 / p" "${SAMPLE_B[1]} ${SAMPLE_A[1]} - 1024 / p" | dc`);echo "Download: ${BANDWIDTH_USAGE[0]} KBps \nUpload: ${BANDWIDTH_USAGE[1]} KBps"; 

 

 

Link para o comentário
Compartilhar em outros sites

Outro Script:

EN1 = Wireless     EN0 = Cabo Ethernet

 

INTERFACE=en1;  
 
SAMPLE_A=(`/usr/sbin/netstat -bI "$INTERFACE" | awk "/$INTERFACE/"'{print $7" "$10; exit}'`);
 
sleep 1;
 
SAMPLE_B=(`/usr/sbin/netstat -bI "$INTERFACE" | awk "/$INTERFACE/"'{print $7" "$10; exit}'`);
 

BANDWIDTH_USAGE=(`echo "2k ${SAMPLE_B[0]} ${SAMPLE_A[0]} - 1024 / p" "${SAMPLE_B[1]} ${SAMPLE_A[1]} - 1024 / p" | dc`);echo "Download: ${BANDWIDTH_USAGE[0]} KBps \nUpload: ${BANDWIDTH_USAGE[1]} KBps"; 

 

Muito obrigado, vou testar o script.

Link para o comentário
Compartilhar em outros sites

Consegui dar uma melhorada no código!!! 

 

Agora não precisa mais do safari estar aberto,

 

e ele fecha a nova aba que ele abriu, para ler o site, automaticamente.

 

 

Bem legal kra!
Esse do mac magazine é rss?

 

Não é não cara..... é buscando linha por linha o texto do site mesmo.

Link para o comentário
Compartilhar em outros sites

Novo código, como prometido.

 

 

 

tell application "Safari"

if windows is {} then

make new document with properties {URL:"http://www.macmagazine.com.br"}

else

set theURL to "http://www.macmagazine.com.br"

tell window 1 to set current tab to make new tab with properties {URL:theURL}

end if

delay 3 -- qualquer problema, altere para 5

set closeTab to "MacMagazine" as string

 

set tab1text to get text of current tab of window 1

 

repeat until (offset of "Últimas Notícias" in tab1text) is 0

set the_offset to offset of "Últimas Notícias" in tab1text

set tab1text to items (the_offset + 17) thru (count tab1text) of tab1text as string

end repeat

close (every tab of window 1 whose name is equal to closeTab)

end tell

 

set textoCompleto to ""

repeat with i from 1 to 20

set tab2text to paragraph i of tab1text

if length of tab2text is greater than 40 then

if length of tab2text is not greater than 250 then

if tab2text does not contain "às" then

set textoCompleto to textoCompleto & tab2text & linefeed & linefeed

end if

end if

end if

end repeat

return textoCompleto

Editado por Lucas Maciel
Link para o comentário
Compartilhar em outros sites

Participe do debate

Você pode postar agora e se registrar depois. Se você tem uma conta, entre agora para postar com ela.

Visitante
Responder este tópico…

×   Você colou conteúdo com formatação.   Remover formatação

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Limpar editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Quem Está Navegando   0 membros estão online

    • Nenhum usuário registrado visualizando esta página.



×
×
  • Criar Novo...