ArtsAutosBooksBusinessEducationEntertainmentFamilyFashionFoodGamesGenderHealthHolidaysHomeHubPagesPersonal FinancePetsPoliticsReligionSportsTechnologyTravel

Automating the submission of India Bureau of Immigration (FRRO) Form C

Updated on December 18, 2014

The Problem

Form C (or C form) of the India Bureau of Immigration is a form that every foreigner staying in any hotel, guest house, etc. has to fill in with all the personal details. The staff of the guest house have to submit all that information to the authorities.

In the past you would just physically bring all the submitted forms over to the local police department, but now things are changing. You are now required to fill all the data into an online form on the FRRO website.

Basically, as a hotel owner, you've just been handed over a whole bunch of work that you need to do that doesn't bring you any benefit (who does it bring benefit to really?). And not only did FRRO not give you any API to work with or provide any way by which you could automate the said work, but also made the website as quirky and weird as possible. And what if you are somewhere in rural India where your internet connection barely works (for some reason works even worse when it rains)?


The Solution - Preparation

Here is something we can do. If you keep track of your visitors offline by means of a database or even an Excel file, you can automate the part of inputting the data into the website. This will take care of the issue of doing the same work twice and the issue of bad network connectivity, since you can input things offline any time, and do the online part automatically whenever the connection works.

For the purpose of this guide we will assume that you're using Excel for the sake of simplicity, but the solution can easily be modified for an ODBC compliant database.

Here is what you need to do to prepare the system:

1. A web browser - either Chrome or Firefox will do. I got everything working with Firefox and I'll assume you're also using it for the rest of this guide. Preferably your browser would be free from any plugins other than the ones mentioned in these instructions. You can get a portable version of Firefox from portableapps.com that you would use only for C Form automation and nothing else.

2. The following add-ons for the browser need to be installed: iMacros for automating the data entry, and Adblock Plus in order to block some content that prevents iMacros from doing its job.

What is iMacros and how does it work? It's a web automation plugin that allows you to automate routine tedious tasks on the web such as filling out forms and testing web sites. You can use iMacros to record a set of actions - a script and than play that script as many times as you want. The scripts are recorded in a simple to understand scripting language that can be easily edited. We are going to use iMacros to fill the form automatically from the Excel spreadsheet.

3. Set the date format on your computer to match the format on the C Form website, i.e. dd/mm/yyyy. To do that in Windows, go to Control Panel -> Region and Language, in Formats tab in the Short Date drop down box select dd/MM/yyyy, click OK. The reason we're doing this is so that Excel displays the dates the way the website expects them.

4. To go ahead with the next step, you need to download this zip file, that has the actual iMacros scripts, the spreadsheet, and a sample registration card that you can use. Unzip the file that you downloaded wherever convenient. Go to iMacros/Macros of the unzipped folder.

5. Login.iim is a handy little script that automates your login process. It opens the FRRO page and put's in your login credentials. In order for it to work you have to modify the script (do not use it if you don't want to store your password in a clear text file). Open the file with any text editor, replace 'YourLoginHere' with your actual FRRO login and 'YourPasswordHere' with your password.

6. The two files newFormCproceedingIndia.iim and newFormCproceedingInternational.iim are the main workhorse scripts that are doing all the work. They are almost identical except that they fill the last part of the form differently. They need to be customized in order to work - both in the same way. Open both in your favorite text editor and change the following: on line 9 change the location of the folder where you store the guest photos. Remember to use the double backslashes as in the example file.

7. Move everything in the iMacros folder to My Documents/iMacros folder.

8. Now here's a problem: the Datepicker javascript does not allow iMacros to enter the dates in any of the fields - they get blanked out right after entry. I'd call that a bug. To get around the problem we'll use the Adblock Plus add-on. While you're on the C Form page:

a. Click the ABP toolbar button

b. Select "Open blockable items..."

c. From the list below right click on "indianfrro.gov.in/frro/FormC/valid/datepickercontrol.js"

d. Choose "Block this item"

Refresh the page for the blocking to take effect and notice how the date-picker icons have disappeared.

Overview of the Process

The workflow will be roughly like this:

1. You enter all the data into the excel spreadsheet. You put all the photos you take into the folder. You enter the filenames of the pictures into the same spreadsheet.

2. From the spreadsheet you make two CSV files. One will include all people who's next destination is India, the other - International. That's the only simple way to do it. The C Form contains a radio button that has to be selected based on logic, and iMacros cannot handle it in a simple way.

3. You execute two iMacros scripts - one for each CSV file. The scripts will go through all the records and fill in the form, upload the picture and submit it.

The Process

Take a look at the 'Data Entry Spreadsheet.xlsx' file at the root of the unzipped folder. This is where you initially enter all the Form C data. If you already have some process in place, than this is only useful to you as an example, otherwise you can simply start using this one.

One important thing to not here is that the values you enter have to be exactly in the format that the online form expects. The dates have to be dd/mm/yyyy, sex has to be MALE or FEMALE and not M, m, or male or whaterver else; countries have to be exactly the ones that are available in the drop-down list in the form, same for states and districts; a few more rules such as 'passport expiry has to be more than passport issue date', etc. To help you with this I've put some validation into the spreadsheet as well as a few drop-down boxes in several places. Use them. The spreadsheet is far from perfect but should help you avoid a few issues. In the 'Common Destinations' tab I've entered a few combinations of Address-State-District that you can copy/paste into your 3 fields that include 'next destination'.

Make sure that in the 'Proceeding to' column you enter only INDIA or INTERNATIONAL and nothing else.

In the 'Picture file name (no extension)' enter the name of the photo file without extension. Make sure the pictures you take are not more than 50KB in size, otherwise the form will complain.

Step 1:

Enter all the data into the spreadsheet as described above. Once you entered all the data, move to next step.

Step 2:

Filter the records by 'Proceeding to' field. To do that go to column AJ, pull down the drop down list in first row, make sure only 'INDIA' is selected. Only records with INDIA will appear below. Copy all the records, paste them into My Documents\iMacros\Datasources\India.csv. Make sure you paste them starting from the second row, leaving the first row unchanged.

Repeat the same, but his time make sure only 'INTERNATIONAL' is selected and copy the records into International.csv in the same location.

Step 3:

Open the browser that you prepared and open a new tab, click on the iMacros button. In the sidebar select login.iim and press play. The FRRO page will open and your login and password will be entered. Enter the captcha manually (they really don't want you to automate this process for some reason), click 'Sign In', when the page loads click the 'Form C (Add/ Edit/ Individual Print)' link.

Now select the newFormCproceedingIndia.iim script in the sidebar. in the 'Max:' enter the number of records you have in the file (or any large number greater than the number of records you have). Click 'Play (Loop) '. Now you will be seeing the script entering all the fields from the CSV file into the form, uploading the picture and clicking 'Save and Continue' for each record.

Do the same with newFormCproceedingInternational.iim.

Problems on the way

Initially you're bound to run into a lot of problems. It'll take a while until you figure out what exactly has to go into each field, and when the format is not exactly right the form will complain.

The scripts as they are in the zip file are set to click OK on two dialog boxes during the form submission, and it doesn't matter what the dialog boxes are. This way it'll sometimes click OK on the error and you won't see what it is. So if you see that the form is filled out and the script is stopped - you have to look for the issue on the form and start again from the record that has the problem.

If you run into trouble, you can ask in the comments below.

Customization

Reading the scripts you'll see that the syntax is rather simple and self-explanatory. You just need to have correspondence between the column numbers and form fields. It's also quite straightforward to make it work with a database instead of a spreadsheet by following the online documentation available at the iMacros site.

© 2014 Dmitry Shvedov

Comments

    0 of 8192 characters used
    Post Comment

    No comments yet.

    Click to Rate This Article