Categories
Javascript

Extend Google Apps With Custom Scripts

Let’s get to the point straight way – we can extend the functionality of Google apps with our own scripts. Google allows us to create small scripts written in JS and attach these scripts to certain events (aka triggers) of the respective applications. When these events occur, the scripts are executed. For example, we can attach a script to the event when the user loads a document, or edits a spreadsheet or submits a form. The custom code we write allows the opportunity to do some extra processing. Thus it allows us to achieve a lot more than the default functionality. What are the common use cases?

— Adding our custom functions to spreadsheets
— Adding our own Menus to the user interface
— Creating Macros
— Do more with Forms: send customized messages
— Get sophisticated Gmail statistics
— Send out customized email messages to many people on the fly

and a lot more…

Google Developers Zone has it covered pretty nicely in the “Google Apps Script” section. Have a look yourself!

Just as a demonstration of what could be done, here’s a custom script I wrote to try it out. This script is for a form. It is attached to the “Form Submit” event of the form. When the form is submitted, my custom function gets an event. The event object has a “FormResponse” object which we can use to collect the field names and the values. Then we use “MailApp” object to send the submitted data to an email address:

We could do a lot more than that by adding a flick of our own imagination. Cool, no?

Categories
Javascript

Log to Firebug Console from Firefox Extensions

This is a quick and short post, mainly for self documentation. If you are working on a Firefox extension and want to do “console.log()” to Firebug, you need to use this instead –

You can’t directly use console.log() because your code doesn’t execute from within a “window” instance. If you get “Firebug” is undefined or some similar error messages, make sure that Firebug is installed and working properly.

Firebug needs to be running when you try to log the strings.

Categories
Javascript PHP Work

Avro Phonetic Plugin for WordPress

Rifat vai has released an awesome jQuery plugin which adds Avro Phonetic layout to your text inputs. I converted it into a WordPress Plugin. Hats off to Rifat vai for the awesome job!

How to use it?

Click on the download link below. It should show you the raw php source of the plugin file. Save it as “avro-phonetic.php” and upload the file to “wp-content/plugins/” directory. Now go to your “Plugins” page from WP Dashboard. Activate the plugin.

Download: https://raw.github.com/masnun/Avro-Phonetic-WP-Plugin/master/avro-phonetic.php

Github Repo: https://github.com/masnun/Avro-Phonetic-WP-Plugin

Official Page: http://torifat.github.com/jsAvroPhonetic/

Knows Issues:

  • Doesn’t work with the Visual Editor (TinyMCE) of WordPress. Please use the HTML editor.
  • Doesn’t show any visual clue of which language (English or Bangla) is active.

    It now shows a black box with language identification

    Thanks to the Avro team for the nice icons.

  • Ctrl + M toggles between Bangla and English. It’s your responsibility to let the users know how to use it. The plugin doesn’t have any fancy instructions displayed to the users.

    It now has a widget. Add the widget to your sidebar.

  • Forces to load jQuery 1.7.2 without caring if an older version is already loaded. Had to do this because wp_enque_script() was not loading jQuery on some themes/setup.

    Thanks to Mehdi vai, the loading is now done using JS after checking if a version is loaded already! 🙂

Contribute:
Feel free to fork the codes on Github and send me pull requests. If you’re not used to Git, send me the modifications over email. I shall merge them and commit. My email address is available on masnun.com 🙂

Have fun!