Sorry about another question, but I’m experimenting with the tutorials on this site, i’m trying to make speech scripts I use the speech stuff a lot on my Mac, so this script that I am working on will be a system info script with voice interaction. so here is what i got, i need help on the listen for parts I want it to be constantly running with a listen for continuously command.
set sysPro to do shell script "system_profiler" as string
set freeMem to (((do shell script "/usr/sbin/sysctl -n hw.usermem") / 1048576) as integer) & " MB free"
set modName to paragraph 5 of sysPro & " inch"
set cpuType to paragraph 7 of sysPro
set cpuSpeed to paragraph 8 of sysPro
set numCPU to paragraph 9 of sysPro
set l2Cache to paragraph 10 of sysPro
set memRam to paragraph 11 of sysPro
set busSpeed to paragraph 12 of sysPro
set bootRom to paragraph 13 of sysPro
set smcVer to paragraph 14 of sysPro
set serNum to paragraph 15 of sysPro
set sysv to "Apple's OS " & system version of (system info)
set inIP to "This computer's internal IP address is, " & IPv4 address of (system info)
set exIP to "This computer's external IP address is, " & word 25 of (do shell script "curl http://checkip.dyndns.org/ | grep 'Current IP Address'") as string
set cname to " The system's name is " & computer name of (system info)
set uptime to words of (do shell script "uptime | awk '{print $3, $4}'")
tell uptime
if item 2 is "mins" then
set msg_uptime to item 1 & " minutes"
else if item 2 is "hr" then
set msg_uptime to item 1 & " Hour"
else if item 1 is equal to "1" then
set msg_uptime to item 1 & " Hour " & space & item 2 & " minutes"
else
set msg_uptime to item 1 & " Hour's " & space & item 2 & " minutes"
end if
end tell
set proReport to cpuType & ", " & numCPU & ", " & cpuSpeed & ", " & l2Cache & ", " & busSpeed as string
set sysReport to modName & ", " & serNum & ", " & smcVer & ", " & bootRom & ", running, " & sysv & ", " & cname
set memReport to memRam & ", " & freeMem & ", on for, " & msg_uptime
set ipReport to inIP & ", " & exIP
--Folders and there sizes
on cal_per(x, y) -- Subroutine that calculates percent
if (x / y) * 100 is less than or equal to 0.1 then
return ((x / y) * 100 as real) & " %" as string
else
return ((x / y) * 100 as integer) & " %" as string
end if
end cal_per
-- Conversion table by Nigel Garvey
on convertByteSize(byteSize)
if byteSize is greater than or equal to 1.099511627776E+12 then -- Terabytes (2 ^ 40)
((byteSize / 1.099511627776E+12 div 0.01 / 100.0) as string) & " TB"
else if byteSize is greater than or equal to 1.073741824E+9 then -- Gigabytes (2 ^ 30)
((byteSize / 1.073741824E+9 div 0.01 / 100.0) as string) & " GB"
else if byteSize is greater than or equal to 1048576 then -- Megabytes (2 ^ 20)
((byteSize / 1048576 div 0.01 / 100.0) as string) & " MB"
else if byteSize is greater than or equal to 1024 then -- Kilobytes (2 ^ 10)
((byteSize div 1024) as string) & " K"
else
(byteSize as string) & " bytes"
end if
end convertByteSize
tell application "Finder"
set brain to path to speakable items from user domain --speakable items folder
repeat until (physical size of brain) is not missing value
delay 0.5
end repeat
set brain_size to get physical size of brain
set homeFolder to path to home folder --Home folder
repeat until (physical size of homeFolder) is not missing value
delay 0.5
end repeat
set home_size to physical size of homeFolder
set deskFolder to path to desktop folder
repeat until (physical size of deskFolder) is not missing value
delay 0.5
end repeat
set deskFolder_size to physical size of deskFolder
set docFolder to path to documents folder
repeat until (physical size of docFolder) is not missing value
delay 0.5
end repeat
set docFolder_size to physical size of docFolder
set movFolder to path to movies folder
repeat until (physical size of movFolder) is not missing value
delay 0.5
end repeat
set movFolder_size to physical size of movFolder
set musFolder to path to music folder
repeat until (physical size of musFolder) is not missing value
delay 0.5
end repeat
set musFolder_size to physical size of musFolder
set picFolder to path to pictures folder
repeat until (physical size of picFolder) is not missing value
delay 0.5
end repeat
set picFolder_size to physical size of picFolder
set appFolder to path to applications folder
repeat until (physical size of appFolder) is not missing value
delay 0.5
end repeat
set appFolder_size to physical size of appFolder
set utFolder to path to utilities folder
repeat until (physical size of utFolder) is not missing value
delay 0.5
end repeat
set utFolder_size to physical size of utFolder
set mainDisk to path to startup disk --Disks and sizes
repeat until (capacity of mainDisk) is not missing value
delay 0.5
end repeat
set mainDisk_cap to (capacity of mainDisk)
repeat until (free space of mainDisk) is not missing value
delay 0.5
end repeat
set mainDisk_free to (free space of mainDisk)
end tell
tell application "SpeechRecognitionServer"
set cmdDic to {"Report", "get size of", "get location of", "open"}
set sysDic to {"CPU Type", "CPU Speed", "Number of CPU's", "system Version", "Free memory", "Model", "Model type", "L2 cache", "Memory", "Total Memory", "Bus speed", "Boot Rom", "SMC Version", "Serial Number", "System Version", "OS Version", "IP", "Internal IP", "External IP", "System name", "Computer name", "up time", "Time on"}
set folderDic to {"speakable items folder", "home folder", "desktop folder", "Document Folder", "My Documents", "Movie Folder", "My Movies", "Music Folder", "My Music", "Picture Folder", "My Pictures", "Applications", "My Applications", "Utilities", "Utilities Folder", "Main Disk", "Hard Disk", "Hard Drive"}
set singularComm to {"just", "only"}
listen continuously for cmdDic
if cmd is "Report" then say "it works"
stop listening for identifier "stop"
end tell