Die neue Seite von Macxtreme ist online. Pures html5, etwas Javascript und WordPress im Hintergrund. Das ganze konnte Dank html5 Boilerplate in Recordzeit umgesetzte werden. THX!
.icns Icon-Dateien via Terminal erstellen
Für ein Skript, welches mir automatisch Partition mit Image-Dateien bespielt, brauchte ich einen Mechanismus, über den ich dynamisch VolumeIcons auf die fertigen Volumes anwenden konnte. Normalerweise würde ich hierfür
- Im Programm Vorschau ein entsprechendes Bilds (idealerweise 512x512px) öffnen, auswählen und kopieren
- Das gewünschte Objekt im Finder auswählen und mir die Information anzeigen lassen
- tab drücken und mit cmd+V das Bild aus der Zwischenablage als Icon festlegen
SVG Editor
Mails ins Postfach bewegen… 3.0
Da ich in letzte Zeit einige meiner Accounts auf Exchange umstellen musste, hat das Skript nicht mehr korrekt funktioniert. Deshalb hierzu eine kleine Anpassung.
-- MoveMailTo
-- Created by Hubi on 16.06.2009
--Änderung vom 07.12.2009
-- ->Unterordner können nu auch als Ziel genutzt werden
-- ->POP Accounts bzw. lokale Ordner können nun auch angesprochen werden.
-- Copyright 2009 hubionmac.com. All rights reserved. ;-)
-- Änderung vom 31.10.2013:
-- ->Unterstützung von Exchange Postfächern… diese haben zumindest unter 10.7 und 10.8 die Account Typ unknown
tell application "Mail"
set theSelection to selection
if theSelection ≠ {} then
try
set ac_name to (name of account of mailbox of (item 1 of theSelection))
set ac_typ to account type of account of mailbox of (item 1 of theSelection)
on error
--wenn eine Nachricht in einem lokalen Postfach ausgewählt wurde kann das nur schief gehen, also:
set ac_name to ""
set ac_typ to pop
end try
set t_mail to {}
if ac_typ = imap or ac_typ = unknown then
repeat with i from 1 to (count of every mailbox of account ac_name)
--set t_mail to t_mail & ((i & " " & name of mailbox i of account ac_name) as text)
set t_mail to t_mail & ((name of mailbox i of account ac_name & " (" & i & ")") as rich text)
end repeat
else if ac_typ = pop then
repeat with i from 1 to (count of every mailbox)
--set t_mail to t_mail & ((i & " " & name of mailbox i of account ac_name) as text)
set t_mail to t_mail & ((name of mailbox i & " (" & i & ")") as rich text)
end repeat
end if
set my_mailboxes to {"•••NEW•••"} & t_mail
set theaction to choose from list my_mailboxes default items {item 1 of my_mailboxes}
if theaction as rich text ≠ "false" then
if theaction as rich text = (item 1 of my_mailboxes) as rich text then
set new_mailboxname to text returned of (display dialog "New Mailbox" default answer "---New Mailbox ---")
if new_mailboxname as rich text ≠ "false" then
if ac_typ = imap then
tell account ac_name to set desti_box to (make new mailbox with properties {name:new_mailboxname})
else if ac_typ = pop then
make new mailbox with properties {name:new_mailboxname}
set desti_box to new_mailboxname
end if
end if
else
--set desti_box to mailbox ((first word of (theaction as text)) as integer) of account ac_name
if ac_typ = imap or ac_typ is unknown then
set desti_box to mailbox ((last word of (theaction as rich text)) as integer) of account ac_name
else if ac_typ = pop then
set desti_box to mailbox ((last word of (theaction as rich text)) as integer)
end if
end if
repeat with themessage in theSelection
move themessage to desti_box
end repeat
end if
else
display dialog "Nix ausgewählt zum verschieben" giving up after 1
end if
end tell
Big Red Button
Einen USB-Taster brauchte ich, mit dem ich eine Klingel realisieren konnte, die an verschiedenen Rechner einen Ton gleichzeit abspielt.
Das ganz noch dazu ohne in günstig und am liebsten ohne Java… fündig wurde ich beim Big Red Button von Dream Cheeky, für den man sich dank derrick via GitHub eine coolen USB-Treiber kompilieren konnte.
Ein wenig Applescript-Voodoo später ist er nun fertig.
[Download not found]
Das Skript überwacht den Knopf auch, d.h. wenn der Button vom Rechner entfernt wird, solange das Skirpt läuft, schlägt es Alarm =!) Siehe auch das Demo-Video
AppleScript als default application auch unter 10.8
Die Problemstellung war folgende:
Ich habe hier eine Warenwirtschaft, die Exporte immer als csv oder xml ausgibt.
Diese werden per Default von Excel geöffnet.
Das Problem:
Excel ist nun nicht die optimale Anwendung, um Dateien jenseits der 2MB Grenze schnell zu bearbeiten.
Die Lösung:
Ich lasse CSV-Dateien per Default nicht von Excel sondern von einem AppleScript öffnen, welches mit etwas PHP&Co die Auswertung im Bruchteil einer Sekunde erledigen kann ;-)
Wie macht man das?
AppleTouch Icon Droplet
Das ist ein einfaches Skript, das sips nutzt um alles passenden Größen der Apple-Touch-Icons für eine Website anzulegen.
Einfach als Droplet abspeichern, PNG draufziehen und als Ergebnis erhält man die entsprechend benannten Touch-Icons in der entsprechende Größe.
on open these
set allowedExtensions to {".png", ".jpg", ".pdf", ".gif", ".tif", "tiff"}
if (count of these) is 1 then
set this to item 1 of these
tell application "Finder" to set thisname to name of this
set this_posix to quoted form of POSIX path of this
set this_posix_folder to quoted form of (do shell script "dirname " & this_posix)
set myextension to (characters -4 through -1 of thisname) as text
if myextension is not in allowedExtensions then
error "This script does not work with " & myextension & "-files."
else
set imagewidth to last word of (do shell script "sips -g pixelWidth " & this_posix) as integer
set imageheigth to last word of (do shell script "sips -g pixelHeight " & this_posix) as integer
if imagewidth ≠ imageheigth then
error "The Image file should have the values for width and height. (" & imagewidth & "x" & imageheigth & ")"
else
if imagewidth < 144 then
display dialog "This Image is smaller than 144x144 pixel… well I will scale those blurry pixels" buttons {"OK"} default button {"OK"}
end if
do shell script "sips -s format png -Z 144 " & this_posix & " --out " & this_posix_folder & "/apple-touch-icon-144x144-precomposed.png"
(do shell script "sips -s format png -Z 144 " & this_posix & " --out " & this_posix_folder & "/apple-touch-icon-144x144-precomposed.png")
(do shell script "sips -s format png -Z 114 " & this_posix & " --out " & this_posix_folder & "/apple-touch-icon-114x114-precomposed.png")
(do shell script "sips -s format png -Z 72 " & this_posix & " --out " & this_posix_folder & "/apple-touch-icon-72x72-precomposed.png")
(do shell script "sips -s format png -Z 57 " & this_posix & " --out " & this_posix_folder & "/apple-touch-icon-57x57-precomposed.png")
(do shell script "sips -s format png -Z 57 " & this_posix & " --out " & this_posix_folder & "/apple-touch-icon-precomposed.png")
(do shell script "sips -s format png -Z 57 " & this_posix & " --out " & this_posix_folder & "/apple-touch-icon.png")
end if
end if
else
error "This script only works with on input file"
end if
end open
Automatischen Login bei FileVault 2 deaktivieren
Wenn man nicht möchte, dass nach dem Entschlüssen des FileVault Volumens auch direkt der entsprechende Nutzers eingeloggt wird, kann man das mit diesem Tip verhindern:
Edit /etc/authorization
Find the "system.login.console" array.
Find the "mechanisms" array within this.
Remove the line "builtin:forward-login,privileged".
Save and reboot.
dummy@apple.com gibt es nicht dolly schon ;-)
Ich habe die URL im Quellcode etwas verfälscht, damit nicht jeder gleich eine Post-Attacke auf den Server fährt… ist aber eine coole Skript-Lösung, um zu Prüfen, ob es eine Email-Adresse überhaupt existiert…
set thelist to every paragraph of "steve@apple.com
info@apple.com
dolly@apple.com
dummy@apple.com"
--set thelist to every paragraph of (get the clipboard)
set myoutput to {}
repeat with themail in thelist
if (themail as string) contains "@" then
set isvalid to my checkmail(themail)
set myoutput to myoutput & themail & tab & isvalid & return
end if
end repeat
tell application "TextEdit"
set newdoc to make new document
set text of newdoc to myoutput as string
activate
end tell
on checkmail(themail)
set thetest to do shell script "curl --data \"email=" & themail & "&Submit=Pr%C3%BCfen\" http://www.huwisoft.schweiz/includes/email-validator.php"
if thetest contains "EXISTIERT NICHT" then
return "EXISTIERT NICHT"
else
return "OK"
end if
end checkmail
Mail in Postfach 2.1
Das Skript via FastScripts erleichtert das Bewegen von Emails in Unterordner. Diese Version hat einen kleinen Bugfix, so dass auch mehrere Emails in einem Rutsch korrekt bewegt werden.
-- MoveMailTo
-- Created by Hubi on 16.06.2009
--Änderung vom 07.12.2009
-- ->Unterordner können nu auch als Ziel genutzt werden
-- ->POP Accounts bzw. lokale Ordner können nun auch angesprochen werden.
-- Copyright 2009 hubionmac.com. All rights reserved. ;-)
-- 20.06.2013 Bugfix... so it works with more than one selected mail using Mac OS 10.7
tell application "Mail"
set theSelection to selection
if theSelection ≠ {} then
try
set ac_name to (name of account of mailbox of (item 1 of theSelection))
set ac_typ to account type of account of mailbox of (item 1 of theSelection)
on error
--wenn eine Nachricht in einem lokalen Postfach ausgewählt wurde kann das nur schief gehen, also:
set ac_name to ""
set ac_typ to pop
end try
set t_mail to {}
if ac_typ = imap then
repeat with i from 1 to (count of every mailbox of account ac_name)
--set t_mail to t_mail & ((i & " " & name of mailbox i of account ac_name) as text)
set t_mail to t_mail & ((name of mailbox i of account ac_name & " (" & i & ")") as rich text)
end repeat
else if ac_typ = pop then
repeat with i from 1 to (count of every mailbox)
--set t_mail to t_mail & ((i & " " & name of mailbox i of account ac_name) as text)
set t_mail to t_mail & ((name of mailbox i & " (" & i & ")") as rich text)
end repeat
end if
set my_mailboxes to {"•••NEW•••"} & t_mail
set theaction to choose from list my_mailboxes default items {item 1 of my_mailboxes}
if theaction as rich text ≠ "false" then
if theaction as rich text = (item 1 of my_mailboxes) as rich text then
set new_mailboxname to text returned of (display dialog "New Mailbox" default answer "---New Mailbox ---")
if new_mailboxname as rich text ≠ "false" then
if ac_typ = imap then
tell account ac_name to set desti_box to (make new mailbox with properties {name:new_mailboxname})
else if ac_typ = pop then
make new mailbox with properties {name:new_mailboxname}
set desti_box to new_mailboxname
end if
end if
else
--set desti_box to mailbox ((first word of (theaction as text)) as integer) of account ac_name
if ac_typ = imap then
set desti_box to mailbox ((last word of (theaction as rich text)) as integer) of account ac_name
else if ac_typ = pop then
set desti_box to mailbox ((last word of (theaction as rich text)) as integer)
end if
end if
repeat with themessage in theSelection
move themessage to desti_box
end repeat
end if
else
display dialog "Nix ausgewählt zum verschieben" giving up after 1
end if
end tell