Applescript – folder and file counter

Posted by | Posted in Applescript, Code, OS X | Posted on 16-09-2010

set theFolder to (choose folder)
set thePath to POSIX path of theFolder
set fileCount to 0
set folderCount to 0
tell application "Finder"
	set theFileList to every item in folder theFolder
	repeat with x in theFileList
		if not character 1 of ((name of x) as string) is equal to "." then
			if kind of x is equal to "Folder" then -- "folder" depends fromĀ  the finder language 
				set folderCount to folderCount + 1
			else
				set fileCount to fileCount + 1
			end if
		end if
	end repeat
end tell
 
display dialog "There are " & folderCount & " folders andĀ  " & fileCount & " files in " & thePath

Applescript – Change folder color based on size

Posted by | Posted in Applescript, Code, OS X | Posted on 16-09-2010

property theFile : missing value
property theFolder : "test"
property thePosixPath : "/Users/user/Desktop/"
property theAliasPath : "Users:USER:Desktop:"
property theSize : missing value
 
tell application "Finder"
	set theSize to do shell script "du -s -k " & thePosixPath & theFolder & " |awk '{print $1}'"
	if theSize > 700000 then
		set label index of (folder theAliasPath & theFolder) to 2
	end if
end tell

Randomly Choose A Buddies’ Status Message As Your Own – OS X – Applescript

Posted by | Posted in Applescript, Code, OS X | Posted on 10-11-2009

tell application "iChat"
tell application "iChat" to set messagelist to get status message of every buddy
where status is not offline
set msglistcount to count messagelist
set theMessageList to {}
repeat with x from 1 to msglistcount
if item x of messagelist is not "" then
copy item x of messagelist to end of theMessageList
end if
msglistcount = msglistcount - 1
end repeat
set newStatus to some item of theMessageList
set status message to "i'm in your internets stealing your status messages : " & newStatus
end tell

Join the mailing list

Check your email and confirm the subscription