Wednesday 22 October 2014

Getting Started with AppleScript

In our last blog "Introduction to AppleScript", we discussed what is apple script and how it's useful for Mac users. Now it's time to learn how to write the AppleScript.

Getting Started with AppleScript:

To create an AppleScript, open the application "AppleScript Editor" from your application folder (Application --> utilities --> AppleScript Editor ). A simple window containing a large text field with a strip of buttons along the top.






You can see, AppleScript Editor window divided into three part. Lets understand what each each part indicate.

Top Part :
Top part contain four buttons. As their name show they are use to compile, build, record and run the script.



Middle Part:
Middle part contain the text field, where we write our script. When you start writing, the colour of text is normal. After you are done entering the code, click on the "Compile" or "Run" button from top. If your syntax is correct, your code will automatically format and colorize. If you have made an error, Script Editor will highlight the problematic area and give you a message about what it thinks might have gone wrong.




You can get the information of colours displayed in your compiled code by going to Script Editor -->Preferences --> Formatting. You can change the default colours and use your own colours.



Bottom Part:

Bottom of your Script Editor window is like a debug log. Once you run the script, bottom event log tells you what the result was, what event is happening.




Now, Its time to learn some basic command

tell Block:

The tell tells an app to do something. Most commands in AppleScript are located inside a "tell block". It's called a "tell block" because you are "telling" a given application what you want it to do.

For example:

tell application "Safari" to close every window
or
tell application "Safari"
      close every window

end tell

The "tell application...." means that the computer tells an app to do something. The part after "ApplicationName" is what the app will do. Here it is "close every window". End tell means it will end the tell block and quit.

say command:
The say command is something that makes your Mac talk!

Syntax:     say "Rupesh"

"Rupesh" is what your Mac will say. If you run the script, you will hear a manly voice saying the word. If you type something like "Rueewssaart", Mac voice will say it letter by letter.

Creating "Hello  Rupesh" script:

As, I said it's very much easier and you have no need some extra programming skills for it. You have to think like you are telling a person A to pass the message of some task to another person B in normal english.

For example, How you pass a message to display a chart with text "Hello Rupesh" from person A to B.  Here Person A is your system & person B is application you want to communicate using script to display chart with some text.

You personally meet to person A so, no need to indicate person A in message. Now pass the message in daily communication english language.

You probably say this to Person A:

         tell the person "B" to display the chart "Hello rupesh"

Yes, you wrote a script. You just need to convert it in technical terms. Technically, Person is an application, chart is an dialog. So,  your message will looks like this:

        tell application "Finder" to display dialog " Hello Rupesh"

Copy this and paste in your script editor textField area. Now compile & then run the script. You will see a dialog will open with "Hello Rupesh".




Now, use your smartness and create your own script with more application like, mail, safari,textEdit etc. In our next blog we will learn about variables, operators & some more useful command in AppleScript.



Tuesday 21 October 2014

Introduction to AppleScript

Now a days, Computer makes our life easier by reducing the time and complexity of work completion. For example, In older day's, records were saved on paper's and mostly task related to updating, searching etc, was very time consuming and complex. After the introduction of computer, it’s become much easier to update, searching,indexing of the record.

Sometimes while working on the computer work we perform the same series of tasks again & again. For example, if you want to change the name of 1000's of file in a folder or want to change the extension of 100 files, you'll soon realise how much time-consuming and stressful repetitive task.

Here, you start thinking that isn't there an easier way?

Yes, it's called "Script". For Macintosh, it's called “Applescript”.

Whats is AppleScript:

AppleScript is a powerful scripting language that comes built-in with the Macintosh Operating System. It’s introduced in 1992. AppleScript is an English-like language used to write script files for Macintosh Operating System. If you are not using a computer that is running on Mac OS, you will not be able to use AppleScript.

In one line you can say "AppleScript is the language of automation for Mac OS"

Principle use of AppleScript:

The principal use for AppleScript is the automation of tasks that are normally repetitious and time consuming. Apple script helpful to automate & control the actions of the computer and the applications that run on it.

AppleScript is much more than just a macro-language, which simply repeats your recorded actions, AppleScript can "think", can make decisions based on user-interaction or by parsing and analysing data, documents or situations.

For more you can say "Apple script is an language interface for MAC, MAC can be automated and controlled using  AppleScript, which is an integral part of the Macintosh operating system.

How much it’s useful for mac user:

AppleScript has proven to be the best tool for making life with a computer a productive experience. It’s provide a lot of things.

AppleScript can be helpful to user in many way. Some of them are:

  • To create shortcuts for complex tasks like naming files, resetting preferences and many more from their day-to-day Mac experience.
  • To perform repetitive tasks, retrieving data and files from remote servers.
  • To create easy-to-use automation tools, AppleScript can automate much of what we do.
  • Schedule time to time repetitive task.
  • To make user time spent of the computer more productive.
  • To save user time and money.

The best part about AppleScript is that you don't have to be a genius programmer to use it. In fact, you don't have to have any programming experience whatsoever.
Lets start with some basics of AppleScript. In our next blog "Getting started with AppleScript", we will learn some basic command and create our first Hello script. 

Monday 13 October 2014

What's new in iOS 8 for user (Part - 2)

In our last post  What's new in iOS 8 for user, we discussed about some new features, introduce in apple recent release of iOS (iOS 8). As, This is the biggest  release in apple history that have a lots of new features. Here we are describing some more feature's which were not included in our last post.

Share Last Location before battery dies:

Apple Find my iPhone is most popular app and useful to track your device, But if your battery goes to dies, you can not track it.
In iOS 8 apple added a new feature for this. Now in iOS 8, Find my iPhone can send the last known location of your device to iCloud before battery dies.

To enable this feature, perform these steps:
 1) Open Settings -- > Tap iCloud ( You must be logged in with iCloud ID)
 2) Tap iCloud  ---> Find my iPhone ---> Turn on the option for Send Last Location



Upgraded iMessage app:

iOS 8 iMessaging is enhanced up-to a high level. Apple added the group messaging feature like in the What’sApp. You can now name the group chat, add new Contacts to the chat, use Do Not Disturb on a per-conversation basis to keep yourself from having to deal with tons of notifications, even share your location with the group for an hour, all day or indefinitely.

Here are the some of new features of iMessage app:

1) Group messaging - You can create a group, add/ remove people into group, leave the group, do not disturb option also available when you have no time or not want to message from that group. You can turn on by switching the do not disturb button.
2) Send a voice message( Recorded/Audio messaging) - Touch and hold with your thumb to record your message, then swipe up to send it.
3) Send a video message -Tap the camera button and select video mode in camera & send it.
4) Share your location -Tap to choose how long you’d like to share your location.
5) Send multiple photo or video

To use these feature's , You need to enable iMessage with apple id or associated phone number in message setting.





Make the Photo's invisible:

Sometimes, you may not want to display all of your photos in the Photos app. Before iOS 8 you need to download some application to secure the private photo from other. For those photos, iOS 8 can now hide them from view, allowing you to still keep them around.

How to do that:
 1) Open the photo app.
 2) Navigate to the photo that you'd like to have hidden,
 3) Tap and hold on it until a menu appears.
 4) Tap the Hide button in the menu that appears above the photo.

You hidden photos still visible to other user in the Albums tab. You can unhide them by:
 1) Navigating to one of the Albums containing it,
 2) Tapping and holding on the photo
 3) Select unhide.



Improved Spotlight Search:

Apple has also improved its Spotlight tool, Spotlight no longer restricts results just to stuff on your device, such as contacts or apps. It searches for files and information on the device, the web. The tool now considers the answer, uses context to provide the most relevant choices. 

When searching for a person, item or term, a Wikipedia snippet will appear. The new Spotlight identifies hot topics and knows what’s trending.




Predictive Keyboard's:

In iOS 8, Apple has added support for more third-party keyboards and improved its own keyboard to add predictive text using quick type feature in keyboard. Now, keyboard try to predict what word you are trying to type based on your past conversations and writing style. It also adjusts based on the person you’re communicating with.

Now with quick type keyboard distinguish between informal languages uses in the Messages app, for example and more formal language when using the Mail app.



It can do this in lots of different languages. Supported languages include English optimised for the US, UK, Canada and Australia; French; German; Italian; Portuguese optimised for Brazil; Spanish; and Thai. And Simplified Chinese, Traditional Chinese and Japanese Kanji input continue to feature predictive input.

Continuity:

Apple wants you to be able to seamlessly switch between multiple Apple devices. With iOS 7 you can already pick up iMessages on multiple devices -- such as an iPad, iPhone and Mac With iOS 8 and OS X Yosemite, you’ll be able to do more wonderful things than ever before.

Now you can start writing an email, during free time like traveling and start the same mail when you reach in office or home on your mac, It's not only with mail, it with all most common app Mail, Safari, Pages, Numbers, Keynote, Maps, Messages, Reminders, Calendar and Contacts. This happens automatically when your devices are signed in to the same iCloud account.

Now you can do the same with SMS and phone calls on different devices as long as they running iOS 8 or OS X Yosemite on the same Wi‑Fi network. Incoming calls show the caller’s name, number and profile picture. Just click or swipe the notification to answer, ignore or respond with a quick message.



Family Sharing:

In iOS 8, Apple introduce a new concept family sharing to bring harmony in user family’s digital life.

With Family Sharing:
-Up to six people in a family can share purchases from iTunes, iBooks and the App Store without sharing accounts. 
-Up to six people can join a shared family stream to automatically share photos, calendars and reminders.

Family purchases can be paid with the same credit card and Children in the family will have to ask their parents’ permission if they want to buy apps or media with the shared credit card.



Health App:

The new Health app on iOS 8 features a dashboard showing all the user’s health and fitness data. Health app is designed to let you take control of your personal health and fitness data in a central hub. 
It can pull in stats from third-party fitness apps so you can monitor your activity, calorie intake, sleep and vitals in one place and blood type and allergy information can be accessed from the Lock Screen, in case of an emergency.