Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

castingflame

macrumors newbie
Original poster
Dec 1, 2009
1
0
Hello everyone

I wish to Launch Firefox with a certain profile. Read some of the text on the web page. When certain html text conditions are correct quit Firefox then start all over with a different Firefox profile.

Which is the best Language for this type of operation on OSX.

I would prefer to use one language to achieve this. I have been using Applescript and cron to start and kill the browser sessions but as I can not read the screen quiting or killing the session is guess work.

I had some experience with Perl/Active Perl a few years back. Would this be a good choice?

Kind Reagrds

Paul
 
Hello everyone

I wish to Launch Firefox with a certain profile. Read some of the text on the web page. When certain html text conditions are correct quit Firefox then start all over with a different Firefox profile.

Which is the best Language for this type of operation on OSX.

I would prefer to use one language to achieve this. I have been using Applescript and cron to start and kill the browser sessions but as I can not read the screen quiting or killing the session is guess work.

I had some experience with Perl/Active Perl a few years back. Would this be a good choice?

Kind Reagrds

Paul

What do you mean 'profile' ?
Why not just write a firefox extension to do this?
 
Based on your desire to read the website html, you have 2 general options.
1. Download the web page with a simple HTTP client such as "wget" or using a scripting language that has an HTTP client capability. I'm sure Perl has that capability and so does Python.
2. Write a Firefox plugin that initiates the download of the website. I believe the language here is Javascript.

The difference between the two choices is that the Firefox plugin has access to the capabilities of Firefox such as Javascript execution. So if the website has dynamic elements written in Javascript which lead to more object downloads, then the Firefox plugin will have access to such downloads. Depending on what you are looking for in the website, the Firefox plugin architecture might provide the type of parsing you need automatically, e.g. return the number of DOM elements.

If you don't need the power of Firefox in the initial download, then I think the first approach is probably going to be quicker for implementation. You don't need to learn the whole Firefox plugin architecture, xpi packaging, and API.

If this is a long-term project where you might keep adding functionality, I think a plugin will be more powerful, but it does involve a steeper learning curve.

In either case, you'll need one scripting language to initiate the Firefox and I think it is mostly a personal preference on what to use. I'm sure that Perl is powerful enough. Personally, I don't like its syntax but I can't deny that it has a large user base and lots of libraries.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.