Joschi es war schön mit Dir, welcome Higgins

Ich habe mir vor einigen Tagen ein neues MacBook Pro zugelegt und schalte heute nach der Datenübertragung noch einmal mein altes Book an und staune nicht schlecht das just nach dem Kauf das Display eine defekte vertikale Pixelreihe aufweist. Joschi, danke das Du so lange durchgehalten hast, ich werde Dich in Ehren halten. Schon etwas krank, was für eine enge Bindung man mit seinem ersten MacBook Pro eingehen kann... Aber der kleine ist einfach cool!

Posted in Blafasel | 2 Comments

iCal: Arbeitszeiterfassung die 2.

Marko hat mich gebeten das Zeiterfassungs-Skript, dass ich mal vor einiger Zeit geschrieben habe, etwas zu erweitern, so dass auch einen Statistik für den gesamten Monat ausgegeben wird. Zudem ist in diese Version auch ein Growl-Status-Anzeige eingebaut, so dass das Skript nicht kommentarlos den Kalender befüllt. Ich habe das Skript mit 10.7 getestet, ich denke es sollte aber auch problemlos noch unter den letzten beiden System funktionieren (Die App müsste eine reine Intel App sein, da 10.7 nicht anderes mehr auszugeben versteht. Auf einem PPC müsste der AppleScript-Editor aber damit zurande kommen, also in dem Fall einfach neu als App speichern und man hat wieder eine CarbonApp) =)DOWNLOAD
iCal_Time-Recording v.1.2
191.69 kB (127 hits)

Posted in ical | Tagged , , | 7 Comments

OS X Lion: Fensterwiederherstellung für einzelne Programme sperren

defaults write com.apple.QuickTimePlayerX NSQuitAlwaysKeepsWindows -bool false via OS X Lion: Fensterwiederherstellung für einzelne Programme sperren « macnews.de.In der Library, unter Saved Application State werden alle Programme aufgeführt, bei denen ein solcher SavedState bereits gespeichert wurde =) also warum nicht ein kleines Skript:

--11.08.2011 little script to edit saved state settings for a single app instead of all apps

global myhome

tell application "Finder"

set myhome to POSIX path of (home as alias)

set theitems to name of every item of folder "Saved Application State" of folder "Library" of home

set theapps to {}

repeat with theitem in theitems

if (theitem as text) ends with ".savedState" then

set theapps to theapps & ((characters 1 through -12 of theitem as text) as text)

end if

end repeat

end tell

set theapp to (choose from list theapps with prompt "Which app with saved state?") as text

set theactions to {"Delete SavedState", "Disable SavedState", "Enable SavedState", "Freeze Saved State", "Defrost Saved State"}

set theaction to (choose from list theactions with prompt "Which action?") as text

if theaction = (item 1 of theactions) as text then

my deleteSavedState(theapp)

else if theaction as text = (item 2 of theactions) as text then

my disableSavedState(theapp)

else if theaction as text = (item 3 of theactions) as text then

my enableSavedState(theapp)

else if theaction as text = (item 4 of theactions) as text then

my freezeSavedState(theapp)

else if theaction as text = (item 5 of theactions) as text then

my defrostSavedState(theapp)

end if


on deleteSavedState(appName)

--moves avedState to user's trash folder and plays drag to trash sound

do shell script "mv " & myhome & "Library/'Saved Application State'/" & quoted form of appName & ".savedState ~/.Trash/;afplay /System/Library/Components/CoreAudio.component/Contents/SharedSupport/SystemSounds/dock/drag\\ to\\ trash.aif"

end deleteSavedState


on disableSavedState(appName)

--uses defaults write to disable saved state for this particular app

do shell script "defaults write " & appName & " NSQuitAlwaysKeepsWindows -bool false"

do shell script "afplay /System/Library/Components/CoreAudio.component/Contents/SharedSupport/SystemSounds/ink/InkSoundBecomeMouse.aif"

end disableSavedState

on enableSavedState(appName)

--uses defaults write to disable saved state for this particular app

do shell script "defaults write " & appName & " NSQuitAlwaysKeepsWindows -bool true"

do shell script "afplay /System/Library/Components/CoreAudio.component/Contents/SharedSupport/SystemSounds/ink/InkSoundBecomeMouse.aif"

end enableSavedState


on freezeSavedState(appName)

--changes user permissions to read only, so that savedStated is frozen

do shell script "chmod u-w " & myhome & "Library/'Saved Application State'/" & quoted form of appName & ".savedState"

do shell script "afplay /System/Library/Components/CoreAudio.component/Contents/SharedSupport/SystemSounds/ink/InkSoundBecomeMouse.aif"

end freezeSavedState

on defrostSavedState(appName)

--changes user permissions to read&write again, so that savedStated is not frozen any more

do shell script "chmod u+w " & myhome & "Library/'Saved Application State'/" & quoted form of appName & ".savedState"

do shell script "afplay /System/Library/Components/CoreAudio.component/Contents/SharedSupport/SystemSounds/ink/InkSoundBecomeMouse.aif"

end defrostSavedState

Update:

Ok, das hier ist nun wirklich eine schönere Lösung: http://www.tuaw.com/2011/07/26/dear-aunt-tuaw-help-me-fine-tune-session-window-restores/
Posted in defaults write, OS X, Things I add to a new system, Useful Snippets | Tagged , , | Leave a comment

Umlaute und Sonderzeichen in Datei- und Ordnernamen ersetzen

Das war der Auslöser und es hier meine Lösung dazu:

-- hubionmac.com 02.08.2011

-- ersetzt in einem Verzeichnis und allen Unterordnern Sonderzeichen (Umlaute) in Datei und Ordnernamen

-- es können so nur einzelne Sonderzeichen gegen Zeichenketten ersetzt werden ä ->ae

set replacements_list to {{"Ä", "Ae"}, {"ä", "ae"}, {"Ö", "Oe"}, {"ö", "oe"}, {"Ü", "ue"}, {"ü", "ue"}, {"/", "_"}}


set thefolder to choose folder

set thefiles_x to do shell script "find " & quoted form of (POSIX path of thefolder) & " -not -name \".*\""

-- Baut sich eine Liste aus Aliasen, damit die Pfadangaben auch noch funktionieren,

--wenn mal ein übergeordnetes Verzeichnis bereits vom Skript umbenannt wurde

set thefiles to {}

repeat with thefile in every paragraph of thefiles_x

set thefiles to thefiles & ((POSIX file thefile) as alias)

end repeat


repeat with thefile in thefiles

tell application "Finder"

set thefilename to name of thefile

set old_filename to thefilename

end tell

repeat with replacement in replacements_list

set badchar to ASCII number of ((item 1 of replacement) as text)

set thefilename_ascii to asciilist(thefilename)

if badchar is in thefilename_ascii then

set thefilename to my replace_string(thefilename, ASCII character badchar, (item 2 of replacement) as text)

end if

end repeat

if old_filenamethefilename then

tell application "Finder"

set name of thefile to thefilename

end tell

end if

end repeat


on replace_string(itemname, searchstring, replacestring)

set old_delimiter to AppleScript's text item delimiters

set AppleScript's text item delimiters to searchstring

set the item_list to every text item of itemname

set AppleScript's text item delimiters to replacestring

set this_text to the item_list as string

set AppleScript's text item delimiters to old_delimiter

return this_text

end replace_string


on asciilist(thestring)

set myoutput to {}

repeat with a in every character of thestring

set myoutput to myoutput & (ASCII number of a)

end repeat

return myoutput

end asciilist

Posted in Finder | Tagged , , , | 1 Comment

Airport Scanner

Wie bekomme ich den aktuellen Kanal der umliegenden Station heraus. AirportRadar, KisMac oder AP Grapher muss man erst mal haben und laden, womit es auch geht ist mit/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -sosxdaily hat auch noch diese Zeile hier zum Besten gegeben, um einen einfacheren Aufruf zu gewährleisten: sudo ln -s /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport /usr/sbin/airport Danach kennt das Terminal ein airport-Kommando =)
Posted in terminal | Tagged , , , , | Leave a comment

Library unter 10.7 wieder anzeigen lassen

Um nicht immer umständlich über "Gehe zu…" den Ordner öffnen zu müssen: chflags nohidden ~/Library
Posted in terminal, Things I add to a new system | Tagged , , , , | Leave a comment

Batch PNG Convert

Sehr nützliches sips-Skript mkdir pngs; sips -s format png *.* --out pngs Einfach in einem Verzeichnis mit z.B. eine Menge PSD-Dateien ausführen und man bekommt recht schnell eine PNG-Version dieser Dateien.
Posted in Nice2Know, terminal | Tagged , , , , | Leave a comment

Synology: DynDNS mal anders

Ich habe meine Synology NASs zur Zeit hinter einer Telekom-Leitung. D.h. ich habe alle 24 Stunden leider ein Zwangstrennung und der Router (Netgear :-( ) verpennt ab und an das DynDns-Update. Nun hat das NAS-System einen eingebauten DDNS-Client, nur steht nirgends, wie oft dieser Client ein Update durchführt. Nun folgender Tipipkg auf dem NAS installieren (hatte ich bereits) und dann über die Shell: ipkg update ipkg install inadyn Dann noch eine Konfigurationsdatei erstellen: vi /root/inadyn.conf mit dem Inhalt update_period_sec 1200 # Check for a new IP every 1200 seconds username hubionmac password 1skks9sjdj292 dyndns_system dyndns@dyndns.org alias blafasel.dyndns.orgund dann noch in in die /etc/rc.local eine den Aufruf für den Start einbauen: /opt/bin/inadyn --input_file /root/inadyn.conf & Neustart, fertig Ob das Funktioniert? Mal sehen =)optional kann man sich die Konfig-Datei auch sparen und den Aufruf direkt in die rc.local schreiben /opt/bin/inadyn --username blafaseuser --password blafasel --alias blafasel.dyndns.org --dyndns_system custom@dyndns.org --background
Posted in Nice2Know, synonlogy, terminal | Tagged , , | Leave a comment

Adressbuch: checkt ob eine Telefonnummer bereits vorhanden ist

Das ist nur als Beispiel gedacht, wie so eine Funktion aussehen könnte:

tell application "Address Book"

activate

set my_phone_2_check to text returned of (display dialog "Telefonnummer:" default answer "0")

set allp to people

set phone_numbers to value of every phone of people

repeat with i from 1 to count of phone_numbers

set current_phone_numbers to item i of phone_numbers

if (count of current_phone_numbers) > 0 then

repeat with phone_number_2_check in current_phone_numbers

set phone_number_2_check to phone_number_2_check as text

if phone_number_2_check starts with "+" then

set phone_number_2_check to ("0" & characters 4 through -1 of phone_number_2_check) as text

end if

if phone_number_2_check contains " " then

set phone_number_2_check to my replace_chars(phone_number_2_check, " ", "")

end if

if phone_number_2_check contains "-" then

set phone_number_2_check to my replace_chars(phone_number_2_check, "-", "")

end if

if phone_number_2_check contains "/" then

set phone_number_2_check to my replace_chars(phone_number_2_check, "/", "")

end if

if phone_number_2_check = my_phone_2_check then

set selection to item i of people

error "Die Nummer gibt es schon"

end if

end repeat

end if

end repeat

end tell

to replace_chars(this_text, search_string, replacement_string)

try

if this_text contains the search_string then

set AppleScript's text item delimiters to the search_string

set the item_list to every text item of this_text

set AppleScript's text item delimiters to the replacement_string

set this_text to the item_list as string

set AppleScript's text item delimiters to ""

end if

return this_text

on error msg

error "error on replace_chars" & return & msg

end try

end replace_chars

Posted in Address Book, Useful Snippets | Tagged , , | Leave a comment

ChronoSync: Nerven bis die Platte dran ist…

ChronoSync scheint ein sehr schönes Backup-Programm zu sein, schafft es aber nicht nachzufragen, ob man nicht auch mal die passende Festplatte für das Backup anschließen möchte. Stattdessen schlägt das Backup direkt fehl und man muss die Platte anschließend mounten und das Backup von Hand wieder anstoßen. Laut Support kann man sich eine entsprechende Abfrage per AppleSkript selber einbauen... Elgato fährt meiner Erinnerung nach die selbe Schiene: "Wenn Ihnen dieses (zugegebenermaßen grundlegende) Feature so wichtig sein sollte, können sie diese Funktion gerne selber per Skript einbinden." So lautete vor einigen Jahren die Antwort auf die Frage ob die Software den Rechner nicht auch ein/ausschalten könne. Aber da möchte ich gar nicht so negativ über diese Haltung herziehen, schließlich ist AppleSkript ja dafür da, dem User die Möglichkeit zu geben, eine Sofware um praktische Funktionen zu erweitern. Und AppleSkript-Support ist für eine Anwendung unter 40$ ja auch nicht gerade selbstverständlich. Um so besser, wenn es auch dem Naturell des Benutzer entspricht, den Feinschliff der gekauften Software selbst zu übernehmen ;-P

-- 24.05.2011 hubionmac.com

-- can be added as as a pref-sync script to a  ChronoSync-Job to ask the user

-- to connect a missing source/destination volume if needed

--https://discussions.apple.com/thread/3075920


tell application "ChronoSync"

set mysource to leftTargetPath of document 1

set mydesti to rightTargetPath of document 1

if mysource starts with "/Volumes/" then

set mydelimiter to AppleScript's text item delimiters

set AppleScript's text item delimiters to "/"

set sourceName to text item 3 of mysource

set AppleScript's text item delimiters to mydelimiter

else

tell application "Finder" to set sourceName to name of startup disk

end if

if mydesti starts with "/Volumes/" then

set mydelimiter to AppleScript's text item delimiters

set AppleScript's text item delimiters to "/"

set destiName to text item 3 of mydesti

set AppleScript's text item delimiters to mydelimiter

else

tell application "Finder" to set destiName to name of startup disk

end if

tell application "Finder" to set drivenames to name of every disk

set cancelbackup to false

if sourceName is not in drivenames then

repeat until 1 = 0

set myaction to button returned of (display dialog "Source disk (" & sourceName & ") is not mountet!" buttons {"Check again!", "Cancel Backup"} default button 1 giving up after 30)

if myaction = "Check again!" then

tell application "Finder" to set drivenames to name of every disk

if sourceName is in drivenames then

exit repeat

end if

else

set cancelbackup to true

exit repeat

end if

end repeat

end if

if cancelbackup is false then

if destiName is not in drivenames then

repeat until 1 = 0

set myaction to button returned of (display dialog "Destination disk (" & destiName & ") is not mountet!" buttons {"Check again!", "Cancel Backup"} default button 1 giving up after 30)

if myaction = "Check again!" then

tell application "Finder" to set drivenames to name of every disk

if destiName is in drivenames then

exit repeat

end if

else

set cancelbackup to true

exit repeat

end if

end repeat

end if

end if

if cancelbackup is true then error "Canceling"

end tell

Posted in AppleScript | Tagged , , , | Leave a comment
  • Seite übersetzen:


    Paypal for Pizza:




  • Kategorien


  • Letzte Kommentare

    • Niklas: Vielen Vielen Dank! So klappt es!
    • hubi: Servus Niklas, ich habe mir den Quellcode noch einmal angesehen und habe nun unter 10.7.3 einen Weg gefunden...
    • Niklas: Klingt super das Script. Leider bekomm ich immer folgende Fehlermeldung: error “„Mail“ hat einen Fehler...
    • Jürgen: Hallo Hubi, beim Abfragen von Kennworten gibt es noch eine böse Falle: Das Format, in dem security antwortet,...
    • hubi: Am einfachsten Du öffnest im AppleScript-Editor mal das Funktionsverzeichnis (unter Ablage) von iTunes. Ein...