Identifying corresponding IE Tab using VBScript - vbscript

I am trying to write a VBScript for getting hold of a IE Tab which is already opened(After which i will get the Form ID and use it to post AJAX Post request with some data and update the server).
I know a possible method which would work for me , (i.e.) using the Title of every IE Tab i can match with my site name which i would like to get hold of and then get the corresponding IE Instance, but this is a performance issue for me.
So this is what i am planning to do , i can possibly create a local file from my Website with the process ID of my IE tab and any other detail required by the VBScript to grab this Tab among all other opened IE Tabs.
In My VBScript i would run through this file which was updated from my Web-page(Using a Applet since it should create the file in client side) , identify the parameters of the IE tab in which my Web-Page is displayed and then use those details to Get hold of the Corresponding IE Instance.
Please Help me in identifying which parameters i would need to update in my File (like process ID , etc..) so that VBScript would be able to recognize my web-page even without searching through all the open IE Instances.
Any sample example of the VBScript would be very much appreciated..
Thanks a bunch in Advance :)

Tabs of running Internet Explorer instances can be enumerated like this:
For Each ie In CreateObject("Shell.Application").Windows
If ie.document.location = "..." Then
'do stuff
Exit For
End If
Next
Why do you think performance would be an issue with this approach?

Related

List item URL target open in a new tab

Have one HTML and two PDF documents kept on the DB server for the APEX schema. These are accessed by clicking on a List item. Currently these work... however the documents open in the same tab. Want them to open in a new tab.
The URL target for the HTML document is...
&GBL_SERVER.&GBL_IMAGEPATH.mcs_faq.htm
URL targets for the PDF documents are...
&GBL_SERVER.&GBL_IMAGEPATH.PermitFees.pdf
&GBL_SERVER.&GBL_IMAGEPATH.Map14ft6in.pdf
All the URL targets use two different shared component Application Items, which are set with an Application Process - creating global items used in the URL link. These change dynamically depending if you are the development, test, or production server.
Have tried changing the URL target by adding JavaScript...
javascript:window.open("&GBL_SERVER.&GBL_IMAGEPATH.mcs_faq.htm.","_blank")
Have also tried going to the "User Defined Attributes" and adding... target="_blank"
Nothing I have done appears to be working. Perhaps the JavaScript syntax is not quite correct? Are there any suggestions what else should be looked at please? Thank you!
My URL comes from a database field. Idefined the data as
http://xxx.zzzzz.com/sss/" target="_blank

How to share data between two browser windows

In my web application I get some data from server. Then if user want's to see this data visualized in great detail I want to open second browser window and do it there. The problem is with passing the data to be visualized. I don't want to make second request to server. So all I have now is to append this data to the URL to be opened in second window. This of course works but the URL look ugly and the amount of data is very limited. Is there any other way to accomplish this?
You could use a session-value. Save the data into the session when retrieving it from the server, and read it when you open the second browser tab.

Scraping content from an AJAX/Javascript web page

I need to do some screen scraping on a web page where the content I need is generated by AJAX. On the initial page there is a table with 4 tabs. When you click on any of the tabs the content of the table changes. I need the content from the 3rd tab only.
I have used the google chrome 'Inspect Element' tool to see what the requests and post data was and I can get the information I need when I put the information (session id and a lot of other cookie data as well as post data) from the inspect element result into a PHP curl request. But this only works for the 30 minutes that the session lasts. Does anyone know of a way I can get to this information?
I wont reproduce the code here but I will point you to the answer.
Its within this book:
http://www.amazon.com/Webbots-Spiders-Screen-Scrapers-Developing/dp/1593273975/ref=dp_ob_image_bk
A must buy for someone doing what your doing.
In the end I used htmlunit to get the content I needed. I also found the HTMLUnit Scripter very useful to help generate the Java code required.

Firefox addon - is it possible to capture text/html from the webpage?

I have never wrote a firefox addon so I am wondering if this can be done. Is it possible to continually scan a webpage for certain text, and then if that text appears, capture it and save it to a file?
For example
Say a user is on amazon and adds a few items to their shopping cart.
They click checkout and fill in their details and click submit order.
When the order is processed the user is shown the text 'Order complete' and given a receipt of their purchase.
In this example I would like to keep scanning the webpage until 'Order complete' appears. Then I want to capture the html of the receipt and save it to a file.
Is this possible with a firefox addon?
From my experience as a Firefox user, this is definitely possible. As a matter of fact there are add-ons that do far more than that.
For example, Greasemonkey can actually act as a filter and change the content of a viewed webpage as specified by a user script. Zotero and AlertBox are able to selectively watch specific HTML elements for interesting information and act upon it.
It is also quite possible that there is an existing add-on that either does what you need already, or can be used as a basis for a custom add-on of your own - what you are asking for is not all that unusual...
You probably want to create your add-on with the Add-on SDK. You can then use the page-mod package to attach a content script to Amazon pages. The content script should check whether it got loaded into an order confirmation page - and send the HTML code of that page (probably document.body.innerHTML) back to the extension.
The extension then needs to write the data to a file. You need to use internal API for that, something like this:
var file = require("file");
var writer = file.open("c:\\foo\\bar.html", "w");
writer.writeAsync(data);
If you want the user to choose the file name, you can do this using chrome authority and nsIFilePicker component.

How do I share data across multiple browser tab or windows?

I m currently building a facebook style notification system for my site.
I m using long polling. So, the server sends data if its available and closes the connection.
Now the problem i m facing is that, i want it to share across all open tabs or windows of that browser.
I m using a cookie to detect if a tab is already executing the ajax call, so other tabs will not execute it until the operation of the first tab is complete.
Now what i want is, to have an effective way, so that i can show the data across all open tabs in the form or a small fb style popup box.
The goal is if the last active ajax call has some data, then a small popup box will show up on all open browser tab or windows.
As, a theory i may be able to do it via cookie, but i want to know if there is some better way to do that.
Thanks,
Anjan
Browsers don't let pages talk to other pages. You'd have to make an extension to get around the cookie.
If you're ok with the cookie idea, follow these examples:
For client side access
For PHP access
For NodeJS

Resources