473,545 Members | 2,049 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3774
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
9148
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 in the status bar 'Symantec Corporation' whenever anyone mouses over (onMouseOver) my image or link OR when one clicks while holding the left mouse...
3
8953
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 sending the keystrokes escapes me at the moment. Is there any material online that describes the process of sending keystrokes to a console app?
4
10669
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. mainform.aspx.cs is the code behind for mainform.aspx. Mouse.js contains javascript code which needs to executed
1
1291
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 events done in Word also, for a training application. I am searching for all of the code that I can get my grubby little hands on that shows key...
3
5035
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 I needed to catch keystrokes in menues and other forms in my app as well. I realize I can implement a keyboard hook that catches keystrokes...
2
1477
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, opening up my application to ALL Function/Ctrl/Alt keystrokes that a user can fire and cause problems. In STARTUP I have Use Access Special Keys...
12
1829
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. it's really dont fit for Point of Sale System which is need faster data entry. is it anyway we can handle this ?? Thanks Seth
0
2725
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 ProcessCmdKey(ref Message msg, Keys keyData) To map "Keys" objects to their string constant, and stored them on a string Queue as they were...
3
10578
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, then send mouse clicks / keyboard interaction.. and when complete, restore my app, and focus it of course. My troubles are finding how to focus the...
0
7468
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7401
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
1
7423
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7757
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5972
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
4945
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
1
1884
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1014
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
704
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.