Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Automate Chrome Extension through VFP9

Status
Not open for further replies.

ashnam10

Programmer
Jul 18, 2007
24
0
0
IN
Hello All,

I have a chrome extension which automates login and certain functionalities in a website.

Would like to call this extension through VFP 9 ie. user presses command button and chrome extension is run.

I am new to chrome extension calling and any pointers would be very helpful.

I call other VB.NET exe using shellexecute is it possible to do same with extension?

Please guide.

Thanks in advance.
 
Almost by definition, it is not possible to answer this question. There is no standard API or command-line parameter for an extension to be automated. It might be possible for someone to write an extension that is capable of being automated, but there is nothing to say that the author of this particular extension has done that. In short, you would need the cooperation of the author of the extension to make this possible.

You would do better to forget about automating the extension, and instead to focus on your overall goal. You say the extension automates login and performs certain other functions in a site. I suggest you look for other ways of automating those functions. For example, it might be possible to do it through scripting, using SendKeys() to programmatically enter the required keystrokes.

Also, are you obliged to use Chrome? In fact, do you need any sort of user interface for the functionality you want to perform? If not, it might be possible to do it through the Microsoft Web Browser ActiveX control, which is certainly possible to automate.

In short, tell us what you final goal is, and we might be able to suggest how to achieve it.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Hello,

Thanks for your response and I am sorry for the confusion.

Our in house VFP 9 application automates certain web functionalities which works proper in chrome.

so we are getting a customized chrome extension developed which we need to call through our this application.

Have already used web browser ActiveX control which performs almost all functionalities based on web site performance in IE. So chrome is required.

What we require is to create a method to call to run this chrome extension.

I hope i am able to explain myself

Thanks and Regards

 
So the important point is that you have some control over the development of the extension. That makes a big different.

In that case, it should certainly be possible to automate the extension, but you would have to build that functionality into the design of the extension. It is not a VFP issue.

It's true that it is possible to programmatically launch Chrome and have it load an extension automatically. There is a command-line parameter for that. But loading an extension is not the same as running (or activating) it.

I suggest you have a talk with the extension's developer. He or she is the only person who can provide the functionality you need. And I stress that it is not a VFP issue. If the developer doesn't know VFP, that shouldn't make any difference.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Hello,

Thanks for your help and pointing in the right direction.

So I will need the command line parameter to launch chrome and load extension automatically. But for activating/running will contact with the developer. If you have any ideas about how to go about activating it , that would be very helpful.

Thanks and Regards,

 
OK, so to launch Chrome automatically, you should use ShellExecute(). You mentioned that you already know how to do that using VB. The method in VFP is very similar. If you would like more details and an example of the code, see
To load the extension(s), you will need to pass a command-line parameter, which you do in the fourth parameter to ShellExecute(). I think the parameter you want is --load-extension. You would follow this by the filename and path of the extension. So, for example, if you extension is at c:\dev\myextension, you would pass the following as the fourth parameter to ShellExecute:

[tt]--load-extension=c:\dev\myextension[/tt]

However, there is also a command-line parameter called --load-apps, which - as its name suggests - loads one or more Chrome apps. And there is one called --load-and-launch-app, which loads an app and then launches it. To be honest, I'm not sure what the difference is between a Chrome extension and a Chrome app, but it's possible that an app might serve your needs better.

All these parameters follow the same format. In each case, you provide the filename and path of the exension or app in question.

Please note that my knowledge of this area is entirely theoretical. I have never actually used any of this stuff.

Mike



__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Another thought ....

Do you want to run this extension as part of an in-house application, that is, where you have control over the software installed on the users' computers?

If so, are you sure that you need to load the extension programmatically? It should be sufficient to install it just once via the Chrome interface. After that, it will remain in place every time you launch Chrome. You would still need to use ShellExecute() to launch Chrome itself, but you should need no special action to load the extension.

Another possibility would be to install the extension in the usual way, and then to set up a shortcut for it on the user's desktop. Any Chrome extension (or app?) can have its own desktop shortcut, which can itself be executed via ShellExecute().

Of course, this won't apply if you are distributing the application to users where you have no control over their systems' configuration.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Hello,

Thanks but you are correct I need to distribute this app so it would be difficult as will have no control on user system configuration.

But will try the previous shellexecute and load apps approach

Thanks very much again your inputs are valuable.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top