something about APPLE here: I am APPLE fans and like their products. By open this blog, I am not trying to BIAS toward APPLE company. Some of the fact below supported my decision. They introduced the computer MOUSE to the world. They changed the way we look at SMART Phone. They boosted up the use of 3G network. They were the first to use USB port as the main connection for computer system. They were the one who able to make a media centre to sync with every devices in your family. They made thing that work magically simple for us. Everything above and more to come... APPLE
Showing posts with label Script. Show all posts
Showing posts with label Script. Show all posts

Wednesday, January 13, 2016

Multiple speech shortcut on El capitan

As you can see, I am having 2 different voice in my preference but only one shortcut key to trigger.


Open "AUTOMATOR" 

Choose "Service"

Search for key word "Speak

"

and Drag it over to the workflow (change the voice if necessary)

"SAVE" the service into your preferred name

Go to "System Preference" -> "Keyboard" -> "Shortcut" -> "Services"
and choose the name for the saved service that we just created. (for my case is Canto)

Assign what ever shortcut combination as you wished. For my case is "option" + "command" + "c"

so I have the default shortcut running "English" and "Canto" for the new shortcut while reading Chinese 

Friday, June 27, 2014

Download multiple picture from internet using Terminal in Mac

I was doing this download magazine from a website for my sister. So that I can combine them into PDF using PC with script. But somehow the process was too long. Maybe I am suck in windows coding which I didn't have the ability to find out the combine PDF coding.
So last night I did some research and found out that MAC can perform the same. And with Automator, I can just combine all pictures into PDF using "New PDF from Images"

so let me share the code to download picture.


for single pic you use

curl -O http://img1.zazhimi.net/aazzmpic/1407/inred-14-07/001.jpg


but if you have multiple pics

curl -O http://img1.zazhimi.net/aazzmpic/1407/inred-14-07/[001-250].jpg


That is the only part you need to take care of when doing multiple images. 


Have a nice day

Monday, January 10, 2011

4 quicktime player on one screen

Today I am going to share this DIY project which feature 4 different Movies play on the same screen in different position so that can view it all in one shot.

First of all, position the screen to 4 different corner and grab the full properties of the screen by using the code below

tell application "QuickTime Player" to get the bounds of the first window

You will get a code something like this {0, 22, 660, 394} -- "full properties"

Grab the result and paste on the script below to fulfill the need of the code

set qtMovie1 to "Location of Movie 1"
set qtMovie2 to "Location of Movie 2"
set qtMovie3 to "Location of Movie 3"
set qtMovie4 to "Location of Movie 4"
tell application "QuickTime Player"

open qtMovie1

set the bounds of the front window to {"
full properties of Movie 1"}

open qtMovie2

set the bounds of the front window to {full properties of Movie 2}

open qtMovie3

set the bounds of the front window to {full properties of Movie 3}

open qtMovie4

set the bounds of the front window to {full properties of Movie 4}

-- if you wanted to play all, add in the below code
play documents

end tell

They were kind of lag on my almost 3 years old MacBook. But I am able to multi movie in 1 go... Greedy man

Saturday, January 8, 2011

Script for send email with attachment

I found the script below and modified some of the field. It was a fail script when I ran it at the first time. Then I found out the "as alias" which placed after the attachment field is a must. As the script has to duplicate the object and paste into the email. I am going to automate the script to mail attachment on my desktop to this blog. Safari has an option to save picture on desktop. That is a common task for me to execute as I save image when I browse around the web. Will post it once I able to run it smoothly.



set theSubject to "new subject"
set theBody to "this is the message body"
set theSender to "Simon"
set theName to ""
set theAddress to "receiver email address"
set theAttachment to "Macintosh HD:Users:Desktop:raina.jpg" as alias

tell application "Mail"
set newMessage to make new outgoing message with properties {subject:theSubject, content:theBody & return & return}
tell newMessage
set visible to true
set sender to theSender
make new to recipient at end of to recipients with properties {name:theName, address:theAddress}
tell content
make new attachment with properties {file name:theAttachment} at after the last paragraph
end tell
end tell
activate
end tell

Monday, January 3, 2011

FaceTime Script


How to enable auto answer for FaceTime… The right way

– Use FaceTime as a home surveillance system monitored from your iPhone4! – Check in on your pets while you're away!


After spending the last couple weeks to get an app finished and ready for the Mac App Store that is due to launch on Jan 6th 2011. I decided to do some homework to prep myself for the app approval process. Digging through the Apple Developer Forums and reading Apple Policies to make sure all my ducks were in a row.
Well as some of you know, my current solution to auto answer FaceTime calls includes AppleScripting, and more importantly "Access to assistive devices" to be enabled. This is not a problem because FaceTools and it's successor that I have been working on prompt the user to enable it, and Apple says no apps are to prompt the user for an Admin privilege.
So I began to dig into facetime to find a way around the whole AppleScript approach. I fired up the good ole' Terminal to start hacking away at the FaceTime.
I ran "strings /Applications/FaceTime.app/Contents/MacOS/FaceTime" and low an behold, to my surprise and frustration I found 2 little strings of text called "AutoAcceptInvites" and "AutoAcceptInvitesFrom"
Could it be? Why yes it is. Apple has included the ability to auto answer FaceTime calls, and not only that, but AutoAnswer calls from callers you specify. (Those little sneaks. I wish I would have checked the strings a month ago)
Turns out it's pretty easy to enable, and here's how:
1.) Open up the Terminal.app located in your /Applications/Utilities folder 2.) Type in the following to allow a specified caller for auto accept incoming calls:
defaults write com.apple.FaceTime AutoAcceptInvitesFrom -array-add <iPhone number, or AppleID>
phone number example: defaults write com.apple.FaceTime AutoAcceptInvitesFrom -array-add +15205551212 AppleID (email) example: defaults write com.apple.FaceTime AutoAcceptInvitesFrom -array-add stevejobs@apple.com

Good news!

Not all was lost! I have since began learning C, Objective-C, Cocoa, Xcode and AppleScript because of all of this, and plan on developing more applications now. Thank you to all the 5000+ people who have downloaded FaceTools! Your support has been awesome! R.I.P. FaceTools
All though it's no longer needed, I figured I would let you all download the AutoAnswer app I was working on. DOWNLOAD HERE

The application itself worked fine on my MAC but not my MUM's Mac Mini. I have difficulty to enable the auto answer. So I used the command line to add in the email address. It was working fine and for iPhone 4 which required handphone number. Please enter phone number with country code in front! (e.g. +65 for singapore) I am facing a problem when auto pick up the call for the very first time. The facetime dial tone kept ringing. I will have to find a way to stop the tone from kicking into the system once FaceTime activate.

Friday, December 31, 2010

Script for Airport on/off


I am looking for a script that run in AppleScript application to disable airport. And I found the script below which will enable you to turn the airport on/off whenever the opposite situation.



tell application "System Preferences"
reveal pane "Network"
activate
tell application "System Events" to tell process "System Preferences"
set theRow to row 1 of table 1 of scroll area 1 of window 1 whose value of static text 1 contains "Airport"
select theRow
if value of static text 1 of theRow contains "Off" then
click button "Turn AirPort On" of group 1 of window 1
else
click button "Turn AirPort Off" of group 1 of window 1
end if
keystroke "w" using {command down}
end tell
end tell



Then I have change something in there to make it my own script

The main objective of my script was to run Adobe After Effect without Internet Connection turn on as my AE cs5 is not original copy.

here I pasted my script

tell application "System Preferences"
reveal pane "Network"
activate
tell application "System Events" to tell process "System Preferences"
set theRow to row 1 of table 1 of scroll area 1 of window 1 whose value of static text 1contains "Airport"
select theRow
click button "Turn AirPort Off" of group 1 of window 1
keystroke "w" using {command down}
end tell
tell application "Adobe After Effects CS5"
activate
end tell
end tell


Most important, I have changed the saved script icon replaced with AE







What I did is to "Show Package Content" after right clicked on the ICON.



go to contents --> Resources --> and change the .icns file to the corresponding ICON

Close it and double click to launch it. The icon will change to the correct Picture.