473,378 Members | 1,138 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

controlling another application via VBA or javascript code in Excell & sending keystrokes & mouse clicks

I am running Excel2000 under WIN98 2nd edition, and I am writing a VBA
code (I will consider using javascript if I have to) that does the
following, at the user command:
1- Start MS Explorer and go to my website. Login (enter ID and
Password)
2- It will go and update some prices of some products that I sell
3- It will add new products or cancel some product

I already have someone who wrote me in JavaScript a web form (no
documentation what so ever) residing at my wensite, that I enter the
product ID then I press the enter key. Then it will take me to another
web form with multiple hyperlinks and buttons. Each is for certain
task, so I will click with the mouse (no keyboard shortcut, but focus
can be done with Tab key) on the hyperlink with price update. So it
takes me to another web form where there is a small box with the
price, so I click at it with the mouse and change the price. Then with
the mouse I click on a button "FINISHED" (there are three buttons,
none of which uses key board). This takes me to another web form where
I can select other tasks, such as change product limited time
discount, or some description etc. At the bottom of this form there
are two buttons "Cancel" "Update" so I click on "Update". All this is
to change one thing, I have to do this about 40 times a day since I
have added more products and I keep changing the prices or change time
driven special discounts, and others as needed.
I have read under DDE how to pass KEYSTROKES, which seems to be a
crude way, but might be ok. I know that if I pass the TAB key until
the button is highlighted, then send the "enter" keystroke, will work.
But this will not work with clicking on a hyperlink. I also, checked
sending mouse click with (x, y) coordinates, but I think it is not
reliable. There is also the timing issue whether the web form is
completely loaded or not, whether I send the keystrokes too fast. Or
even the wed form is taking too much time to load, where it is best to
terminate it and start another one.

So my question is, is there a way that I can reliably and effectively
get my task done. I read about OLE & ActiveX, and all they explain
about how to control my MS explorer, which is really not what I want.
I want to control the form (the code inside the web page), to make it
think I have clicked on this button or that hyperlink, or entered data
in a text box.

Sorry for the lengthy details.
Jul 23 '05 #1
1 3760
There is no real good way of doing this in JavaScript. Maybe through
the MS scripting host, but I'm not sure.

However if you have access to that webserver, it is not at all
weird to make a webpage that inserts the codes you want.

1. From Excel start IE and direct it to a webpage with the parameters
to insert. for example:

explore.exe http://www.mysite.com/enter.html?productId=xyz&price=1

2. Now enter.html will read those parameters and put them in a hidden
form. The form complies to the normal form you would use to enter
the values, except that this form would read the values that come
with the query (productId=xyz&price=1) and put them in the right fields.

This could easly be done with ASP, JSP, PHP and could even be done in
JavaScript.

3. After the page is complete you submit it to the page that would
normally store the input on the site after the submit.

Though ofcourse, there must be easier ways of doing this.

Good luck,
Vincent
Zaidan wrote:
I am running Excel2000 under WIN98 2nd edition, and I am writing a VBA
code (I will consider using javascript if I have to) that does the
following, at the user command:
1- Start MS Explorer and go to my website. Login (enter ID and
Password)
2- It will go and update some prices of some products that I sell
3- It will add new products or cancel some product

I already have someone who wrote me in JavaScript a web form (no
documentation what so ever) residing at my wensite, that I enter the
product ID then I press the enter key. Then it will take me to another
web form with multiple hyperlinks and buttons. Each is for certain
task, so I will click with the mouse (no keyboard shortcut, but focus
can be done with Tab key) on the hyperlink with price update. So it
takes me to another web form where there is a small box with the
price, so I click at it with the mouse and change the price. Then with
the mouse I click on a button "FINISHED" (there are three buttons,
none of which uses key board). This takes me to another web form where
I can select other tasks, such as change product limited time
discount, or some description etc. At the bottom of this form there
are two buttons "Cancel" "Update" so I click on "Update". All this is
to change one thing, I have to do this about 40 times a day since I
have added more products and I keep changing the prices or change time
driven special discounts, and others as needed.
I have read under DDE how to pass KEYSTROKES, which seems to be a
crude way, but might be ok. I know that if I pass the TAB key until
the button is highlighted, then send the "enter" keystroke, will work.
But this will not work with clicking on a hyperlink. I also, checked
sending mouse click with (x, y) coordinates, but I think it is not
reliable. There is also the timing issue whether the web form is
completely loaded or not, whether I send the keystrokes too fast. Or
even the wed form is taking too much time to load, where it is best to
terminate it and start another one.

So my question is, is there a way that I can reliably and effectively
get my task done. I read about OLE & ActiveX, and all they explain
about how to control my MS explorer, which is really not what I want.
I want to control the form (the code inside the web page), to make it
think I have clicked on this button or that hyperlink, or entered data
in a text box.

Sorry for the lengthy details.


Jul 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Kevin Lyons | last post by:
Hello, Can anyone assist me with what I am trying to do with the following code (six different scenarios to try to make the functionality work correctly)? I want to always (and ONLY) display...
3
by: Wayne | last post by:
I have a console application (ssh2.exe) that requires keystrokes to be sent to it after activating. I have worked that it needs to be started in it own thread, but capturing the process and...
4
by: Steven | last post by:
Hello, I have 3 files -- 1. mainform.aspx 2. mainform.aspx.cs 3. mouse.js mainform.aspx contains a image button ("zoominimgbut") which will exceute C# code, whenever the user clicks on it....
1
by: ljh | last post by:
I want to develop an application that can watch for and monitor any instance of Word 2000/2003. I need to be able to write an add-in menu for Word 2000/2003 and capture all keystrokes and mouse...
3
by: Gunnar Syren | last post by:
I'm trying to implement a macro feature in my application by recording and playing back keystrokes. At first I thought it would be enough to catch KeyDown in my main form, but I soon realized that...
2
by: ApexData | last post by:
Hello In order to control keyboard keystrokes in my application, I use the KeyPreview=Yes, OnKeyDown Events of every Form with great success. HOWEVER, these events are not available in REPORTS,...
12
by: Seth Bourne | last post by:
It is really painfull when migrating from Windows Application to Web Application. it's because web application has so many weakness which have the user to use 'more mouse' than 'keyboard' it self....
0
by: neonspark | last post by:
I'm buidling some simple macro functionality for my app so the users can record a sequence of keyboard inputs and replay them reliably via some menu. Originally, I used: protected override bool...
3
by: Kbalz | last post by:
Hello - I've tried to search this, but the word Focus in searching always returns lots of control focusing. I would like my C# Win App to minimize, and focus a program that is already running,...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.