Autopilot (for FB Airline Manager)

NOTE: The script no longer works, and the development was stopped

After being bored with Airline Manager in Facebook in which you have to keep watching your airplanes when they arrive to send them in another flight, I decided to write my own script to use with greasemonkey in FireFox to do that thing for me. Basically, you will need a computer that is connected to the internet and running for most of the time. Install Firefox and add the Greasemonkey add-on to it, then install my script in greasmonkey and enable it if it is not enabled by default. Now when you visit the flight section of the game under facebook you will see the Auto Pilot control box (shown below) in the left column. Simply set the time that you want the script to repeat the task then click on the button. That’s it, now just watch the script fly the first 10 ready airplanes and the count down will start to trigger the next run.

كثير منا يجد العاب الفيسبوك (Facebook) مملة بعد فترة من اللعب بسبب ان اسلوب اللعب يصبح متكر ورتيب ومن امثلتها لعبه مدير الطيران (Airline manager) اذ يجب عليك متابعه مئات من الطائرات وانتظار وصولها لكي تقوم بارسالها مرة اخرى في رحلة جديدة، فلذك السبب قمت ببرمجة برنامج صغير يعمل في متصفح الفايرفوكس (Firefox) تحت اضافة قريسمونكي (Greasemonkey). فاذا كنت من من يلعب هذه اللعبة وعندك جهاز متصل بالانترنت ويعمل بشكل مستمر فكل ما عليك هو تركيب متصفح الفايرفوكس واضافة القريسمونكي له ثم تحميل برنامجي فيه ومن ثم قم بقتح صفحة اللعبة من الفيسبوك واضغط على رابط الطيران (Flight) و سوف تجد ادوات التحكم ظاهرة في الجهه اليسرى من الصفحة كما تراها في الصورة التالية. قم بتحديد الزمن الذي تريدة لتكرار عملية الطيران ثم اضغط زر (Auto Pilot) فسيقوم البرنامج بارسال اول 10 طائرات جاهزة ثم سيكرر العملية بعد انقضاء العد التنازلي.

Here is an image showing the position on the control box in the page:

هذه الصوره توضح موقع ادوات التحكم في الصفحة:

Download the code from here: https://github.com/fduraibi/Autopilot

Change log:

1.2.14: (July/28/2011)

  • Updating the script to work with new AM changes

1.2.13: (July/27/2011)

  • Fix fly link.

1.2.12: (July/25/2011)

  • Allow more wait time (up to 999 minutes + 999 random minutes), using longer time + random makes it hard to get detected ;)
  • Fix: the control box might show up in a weird location and cannot be clicked.
  • Fix: Update fly link.
  • Fix: Reset the tank max to 999999999 since AM will not accept 1000000000 even it is the max as they say!

1.2.11: (July/21/2011)

  • New: Buying advertisement is now possible.
  • Redesign the way tasks are being done to prevent some tasks from starting before other finish.
  • Added two fields to change the lucky fuel price and the max fuel tank capacity.
  • User interface enhancements.
  • Better use of CSS to make the code smaller and looks neat.

1.2.10: (July/04/2011)

  • Enhanced fly function will not reload for every patch of aircraft.
  • New: Lucky Fuel, when the fuel price drops to 50 (which happens once a month) fill the tank.
  • New: Options box to tune some of the script features to your liking:
    • Autostart on page load.
    • Change the delay and random delay times.

1.2.9: (Jun/10/2011)

  • New: Titlebar for the controlbox which is used to move it.
  • Update: Coloring the box to make it look nicer.

1.2.8: (Jun/8/2011)

  • New: Fuel Rescue option, if fuel tank is empty the script will buy enough fuel to fly the aircraft, no matter what the price is.
  • New: Autopilot Controlbox is movable, and the position will be saved.
  • Fix: Pages fetched will use the same protocol as the main page (http or https).
  • Update: If for unknow reasons a page won’t load, the script will reload AM
  • Removed some unused code.


  • Added Cargo flights.
  • Script tested and works under Google Chrome using “tampermonkey” extension.
  • Fixed some compatibility with Google Chrome.
  • Small fix to allow running on secure Facebook page (https).
  • Increasing the delay and random delay between tasks, to help people with slow connections and make the script a bit harder to detect.


  • Server update check of the script is back.
  • Added Tooltips to explain the functionality of the controlbox.
  • Enhanced fly function (if there are more than 10 aircraft waiting it will fly them in the same run).
  • Small changes and fixes here and there.


  • Aircraft fly Fix (Thanks Olla)


  • Fixed the script after the game code was updated.
  • Removed the Check4Update function <– since this will be the last update (sorry guys, i would love to keep doing this but I have other stuff to do)
  • Included the developer code (all the code that I use for myself including the unused functions, debuging stuff)
    • If you open Firefox Error Console you can see the logs about what the script is doing, very helpful for debugging.
    • Buy airplanes and sell airplanes functions are there but need to be enabled and integrated to the controlbox.
    • Check4Update is still there but disabled, i will remove the file from my server later so the function will not be useful for this script but I kept the code for others to use if someone want to take over.


  • Fuel, now you can auto buy fuel by checking the fuel checkbox and setting the maximum amount needed and the highest price. It will check once every hour. (I found a way to fly the airplanes even with no fuel (negative amount) and was about to include it in the script but thought that would be cheating so I did not.)


  • Added ability to buy catering by selecting the type and amount, so it buys them before flying the airplanes. But you have to make sure that you put the right amount for the selected catering type (minimum and maximum) by following the values giving by the game otherwise it will not buy them. And when the catering finishes it will buy them again in the next round.


  • Added Note taker to keep notes about the game, like airport names, what to buy next…etc.
  • Fixed a bug in autoupdate if the version file on the server is not accessible.
  • Added a timeout for waiting loops so they will not loop forever in case a page did not load correctly.
  • Refresh (reload) the facebook page, including AM page, every 20 iterations to overcome a bug in AM (which i have no control over) that appears after keeping the script running for long time.


This version went through a restructuring of the code. In the previous versions I was injecting the whole code inside the AM page (AM iframe inside Facebook page to be precise) and because of that I was also storing the script settings as AM cookies. This approach is simple and makes interacting with the page easy, however, it makes it easy for AM admins to detect the script by either adding a function that searches for my functions or the entries in the cookies. In order to solve this problem I changed the way the script works. Now when you open the AM game under Facebook my script will be loaded twice, the first instance will load under Facebook frame and it will inject the AP Control box in that frame, which AM has no access to so they cannot detect it. The second instance will load under AM frame, however, it will not inject anything but rather will remain in Greasemonkey sandbox and that is also hidden from AM cannot be detected. The last thing is the settings which are now being stored in Firefox itself under GM settings using GM functions (GM_getValue & GM_setValue). The two script instances are working separately and cannot communicate with each other since they run under different domains (facebook.com & airlinemanager.activewebs.dk) as this is a security feature enforced by Firefox to prevent malicious websites from accessing other websites functions and variables. To overcome this obstacle I used the GM stored settings which are shared by both instances to communicate. In addition to all of that I added some randomization to the timer so executing the tasks will not happen at the exact intervals.

  • Replaced using (eval) which can be harmful with location.assign
  • Settings are not stored in AM cookies anymore.
  • No code injection in AM page.
  • Time randomization.
  • Repairs and C-Check have their own check box so you can do one and not the other.
  • Auto check for script update every 3 days.
  • The timer now loops every 5 seconds instead of every 1 second to reduce the load on the browser.

* Note:

  • I recommend removing the stored cookies by the older version (delete all cookies if you are not sure how).
  • Even with all of these precautions this automating script can still be detected by AM admin if they want to, even though I don’t expect them to do it but they can detect and close your AM account. (Farmville knows about the automation tools and the users who use them but they did not prevent/block them because it did not harm them, rather it might have increase their users by keeping the lazy ones like me.)
  • I expect this version to have many bugs, because I did many changes. Also there are still some changes that I wanted to do but decided to release this first and work later on these changes and whatever bugs you guys find.


  • More enhancement to the C-Check and Repair, it should miss less repairs and checks now. Basically I increased the waiting delay between tasks to give more time for the pages to load before starting the new one. If your internet connection is slow and the script does not work as it should then try increasing the delay by modifying this part of the script “fDelay=5000”, 5000 means 5 seconds, set the value to something suitable for your net speed.
  • Repairs and C-Checks will not work after the new AM update (April-08), so in order to keep using the script to fly airplanes uncheck the repair box, and kindly wait for the coming update.


  • Solved the problem of not working under Firefox 3.6.x.
  • Removed the dependency on jQuery.
  • Fixed a bug that causes the control box not to show if the airline is not AM trusted.
  • The C-Check and Repairs are not perfect and it get missed sometimes


  • Major change in how the script works.
  • Added the ability to repair airplanes and do C-Check before flying them.
  • Save control box settings in AM cookies.
  • Will load on all AM pages not just the Flight page.
  • Fixed the file name so it will install directly by greasmonkey
  • This version does not work with the new Firefox 3.6.x, I am trying to solve this issue.


  • Inisial release.

Disclaimer: The author of this script cannot be held responsible for any thing that might result from using this code, so use it at your own risk.

تنويه: المبرمج لن يتحمل مسئولية اي اضرار قد تنجم عن استخدام هذا البرنامج، فاستخدمة على مسؤليتك.