Arquivos da categoria 'applescript'
Alterar o formato da Captura de ecra
O formato por defeito da Captura de ecra é o PNG mas, por vezes precisamos de alterar para outros (ex. PDF). Pode-se dar uma visita ao Terminal, mas para simplificar escrevi esta Applescript:
[Abrir script no Script Editor - Mac Only]
set FileExtension to {"pdf", "png", "jpeg", "eps", "tiff", "psd", "gif", "pict", "bmp", "tga", "sgi", "exr", "jg2"}
sortFileExtension(FileExtension)
set grabFormat to (choose from list sortFileExtension with prompt "Escolha o formato:" cancel button name "Cancel" without multiple selections allowed and empty selection allowed)
if grabFormat is not false then
chooseFormat(grabFormat)
end if
on chooseFormat(grabFormat)
try
do shell script "defaults write com.apple.screencapture type" & space & grabFormat
do shell script "killall SystemUIServer"
display dialog "Formato da captura de ecra: " & grabFormat buttons {"OK"} with icon 1
on error
display dialog "Ocorreu um erro. Tente de novo."
end try
end chooseFormat
on sortFileExtension(FileExtension)
set old_delims to AppleScript’s text item delimiters
set AppleScript’s text item delimiters to {ASCII character 10}
set list_string to (FileExtension as string)
set new_string to do shell script "echo " & quoted form of list_string & " | sort -f"
set sortFileExtension to (paragraphs of new_string)
set AppleScript’s text item delimiters to old_delims
return sortFileExtension
end sortFileExtension
6 coment⳩os
Sincronizar o Address Book com Google Contacts
Como é do conhecimento geral, com a actualização para o 10.5.3, o Address Book tem uma preferência para sincronizar com o Google Contacts. Apenas tem um senão, é preciso ter um iPhone/iPod. Mas existe um “hack” para contornar essa situação. “Hack” esse que envolve a criação de uma plist. Para facilitar esse trabalho, escrevi uma pequena Applescript.
ATENÇÃO, ESTA SCRIPT É SÓ PARA QUEM NÃO TEM UM iPhone/iPod!
tell application “System Events”
set the parent_dictionary to make new property list item with properties {kind:record}
set the plistfile_path to “~/Library/Preferences/com.apple.iPod.plist”
set this_plistfile to make new property list file with properties {contents:parent_dictionary, name:plistfile_path}
set theDevice to make new property list item at end of property list items of contents of this_plistfile with properties {kind:record, name:”Devices”}
set theRed to make new property list item at end of property list items of contents of theDevice with properties {kind:record, name:”red-herring”}
make new property list item at end of property list items of contents of theRed with properties {kind:string, name:”Family ID”, value:”10001″}
end tell
Abrir script no ScriptEditor [OS X only].
2 coment⳩os
Applescript I
Uma pequena script da minha biblioteca em Applescript para quem precisa de ver as “man pages”.
set theCommand to (text returned of (display dialog “Comando UNIX:” default answer “” buttons {”OK”, “Cancel”} default button 1)) as string
set myManPage to (do shell script “man “ & theCommand & ” | perl -pe ’s/.\\x08//g’”)
tell application “TextEdit”
activate
make new document at the beginning of documents
set the text of the front document to myManPage
end tell
Abrir a Applescript no Script Editor. [Mac only]
Sem coment⳩os
