Can not convert \”22.5\” to number

While writing a script to get some information from top of the command line into applescript
and compare the numbers I stumbled upon a problem.
While top returns 22.5 applescript on my mac sees a number as 22,5.
The mac I use has german as locale, looks like the locale of the command line isn’t the same
and uses us notation.
So I created a short snippet to convert a string from 22.5 to 22,5 which can than be converted
to a number in applescript.
  on dotStringNumber2commaStringNumber(stringNumber)

       set resultNumber to ""
       set char_list to every character of stringNumber
       set char_list_length to count char_list
       repeat with x from char_list_length to 1 by -1
                 set current to ( item (char_list_length - x + 1) of char_list) as string
                 if current = "." then set current to ","
                 set resultNumber to resultNumber & current
       end repeat
       return resultNumber

 end dotStringNumber2commaStringNumber
I know this isn’t the best solution but I haven’t found a simpler one, perhapsmsomebody else knows.

Check if file is older than X days

Today I needed a rule in hazel which was able to check if a file was older than X days.

While there are some options in hazel like before this year, I mistrusted them to work in
the correct way and I wanted to do some more applescript.
So I wrote a quick applescript to check if the file modified date is older than X days and than
return a true.

-- Set the age of files that you want to keep
set keepDays to (360)
tell application “Finder”
set modDate to modification date of theFile
if modDate is less than ((current date)) - keepDays * days then
return true
end if
end tell
— File is younger than keepDays
return false


Welcome to Mingle Mangle of My Mind…. the second incarnation.
After doing a lot of research in the last weeks I stumbled upon a nice blog article (which I forgot to pin as usual).
Contents of this article was mainly, that the blogger was using his blog not really to reach out to other people but to note down stuff he learned or found interesting.
He also explained that he mainly searches his blog first before going into the WWW because most of the time he found out he just forgot that he already did look into that matter already.
Also he came to the conclusion that perhaps somebody else (like me 🙂 ) was looking for that same information too.
So instead of using pinterest, evernote, pocket etc to write down and archive stuff, I thought I would try the same and by that even write stuff down in evernote.
We will see