Add a COM reference to c:\windows\system\shdocvw.dll
This will create a .NET reference Interop.shdocvw.dll (or something similar) that includes the appropriate types.
This content is closed to future replies and is no longer being maintained or updated.
Links may no longer function. If you have a similar request, please write a new post.
Your assistance will be great appreciated.
I have the following C# script that I want to run; however, I am received an error.
Your assistance will be great appreciated.
I have the following C# script that I want to run; however, I am received an error.
SHDocVw.ShellWindows shellWindows = new SHDocVw.ShellWindowsClass();
string filename;
foreach ( SHDocVw.InternetExplorer ie in shellWindows)
{
filename = Path.GetFileNameWithoutExtension( ie.FullName ).ToLower();
if ( filename.Equals( "iexplore" ) )
MessageBox.Show( "Web Site : {0}", ie.LocationURL );
if ( filename.Equals( "explorer" ) )
MessageBox.Show( "Hard Drive : {0}", ie.LocationURL );
}
I already added the "Microsoft Internet Controls" and "Microsoft Internet Controls" references, but I received the following error message:
Script is invalid.
The type or namespace name 'SHDocVw' cound not be found (are you missing a using directive or an assembly reference?)
Can someone please assist?
Hi,
The best way to do this is, create a .net component and add this method as public.
use this component dll as a reference to OpenSpan project and then you can have this public method available in OpenSpan automation.
Hi ManaR02,
Thank you for your reply. I am new to this. Can you please provide a quick guide on how to create a .net component in the studio?
Fiona
Fiona,
Go to Pega Robotics Online Help and search for "Choose Items". Look at "Adding Toolbox Items". It will seem confusing, but once you get through it, it is very easy to do.
It's amazing how much is there in Help, but hard to find if you don't know what you are looking for.
Ed
Your error indicates you are missing a reference to SHDocVw. I am not sure what object that is, but it appears to be a COM component based on a quick Google search. I've never tried referencing one from within a script, but you can try. You'll need to add a reference to all required external assemblies to the script component before you add the method. To do that,
It might also help if you can provide where you got the script code from as it might have some information on the references required.
Not sure exactly what it is that you are trying to accomplish with this Script, but did find the following in the Openspan Script Component Documentation: http://help.openspan.com/52/Components/Script.htm
The Using/Imports area lets you enter using directives for any referenced types to be used in the methods for this script. You must first add the assembly/assemblies you intend to use by completing the script's References property (in the Design Properties window). See the Script topic for details on the References property. Any referenced types must also be added to the References folder in Solution Explorer for the project. See the Using Project References topic for more information.
I also found this posting, which has the exactly code that is in your Script above:
https://www.codeproject.com/Questions/764857/How-to-get-current-active-IE-url-using-csharp
So, my assumption, is that you are attempting to extract the current, active Tab within an IE instance, correct..? If so, then as stated in this posting, it is not possible.
You may also find these additional postings of use:
Not sure exactly what it is that you are trying to accomplish with this Script, but did find the following in the Openspan Script Component Documentation: http://help.openspan.com/52/Components/Script.htm
The Using/Imports area lets you enter using directives for any referenced types to be used in the methods for this script. You must first add the assembly/assemblies you intend to use by completing the script's References property (in the Design Properties window). See the Script topic for details on the References property. Any referenced types must also be added to the References folder in Solution Explorer for the project. See the Using Project References topic for more information.
I also found this posting, which has the exactly code that is in your Script above:
https://www.codeproject.com/Questions/764857/How-to-get-current-active-IE-url-using-csharp
So, my assumption, is that you are attempting to extract the current, active Tab within an IE instance, correct..? If so, then as stated in this posting, it is not possible.
You may also find these additional postings of use:
https://stackoverflow.com/questions/4173982/c-sharp-how-to-get-current-url-from-the-ie
http://blog.likewise.org/2012/03/shdocvwshellwindows-and-iwebbrowser2-in/
For this last posting, the interesting thing mention here and something that you may have to do, is to generate an Interop Assembly in Visual Studio and also utilize (Reference) it.
Add a COM reference to c:\windows\system\shdocvw.dll
This will create a .NET reference Interop.shdocvw.dll (or something similar) that includes the appropriate types.
https://stackoverflow.com/questions/3345687/c-in-what-assembly-is-shdocvw-webbrowser-v1-defined
Thank you everyone! I think I figured something. I will try that out and let everyone know...
Please let us know how you have resolved it?
Question Solved
Question
Question
Question Solved
Question Solved
Question
Question
Question Solved
Question
Question
Pega Collaboration Center has detected you are using a browser which may prevent you from experiencing the site as intended. To improve your experience, please update your browser.