473,394 Members | 1,893 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,394 software developers and data experts.

How to import tyle library?

Hi!
I'm not sure whether this is the right forum but I don't know of any better one.
The problem is this:
I've just started to use microsoft powershell for accessing COM objects.
Now, powershell is a .net program and does some interop stuff.
I've got two programs I want to access (CAD programs).
Both can be readily customized using VBScript, but I'd like to
have the command prompt capabilities of powershell.
Now, with one program, everything works perfect, but with the other,
VBScript and powershell give different results.
Here's the VBScript program:
set App=getobject(,"ViewDraw.Application")
set View=App.ActiveView
App.AppendOutput "Output",View.Query(128,0).Count

and here the equivalent powershell program:
$App=[System.Runtime.InteropServices.Marshal]::GetActiveObject("ViewDraw.Application")
$View=$App.ActiveView
$App.AppendOutput("Output",$View.Query(128,0).Coun t)

The VBScript correctly executes the Query and gives the proper result
but the powershell script outputs nothing.

What I also saw is that for /some/ objects (like $App), powershell
has type info, but for others (notable the collection) it doesn't.
Is there a way I can tell powershell the rest of the types?
Here's the output for an object the powershell has type info about:
PS R:\$App
Documents : {System.__ComObject}
Visible : True
Application : System.__ComObject
FullName : C:\Mentor\2005EXP\SDD_HOME\wv\win32\bin\viewdraw.e xe
Name : DxDesigner
Parent : System.__ComObject
Interactive : True
ActiveView : System.__ComObject
ClientAdvisorFlags : 880260
ActiveViewHandle : 6031506
CommandBars : System.__ComObject
CurrentProject :
Q:\projects_test\hetzer\D2594-andreas\WGS01\schem\d2594wgs01\
PrimaryDirectory :
Q:\projects_test\hetzer\D2594-andreas\WGS01\schem\d2594wgs01
StatusBarText : For Help, press F1
BusyCursor : False
Version : 2005.1.0
Addins : {System.__ComObject, System.__ComObject,
System.__ComObject, System.__ComObject...}
ViewBaseSession : System.__ComObject
SynchronizesViewBase : True
OptionLevel :
CommandLineArguments :
SourceDocuments : {}
ProjMan : System.__ComObject
SilentMode : 0
LicenseMode : 1
ShellCmd : System.__ComObject
Cookies : System.__ComObject
ActiveDocument : System.__ComObject
Flows : {Library Manager Central Library, Expedition PCB,
DxBoardLink}
HTMLDocuments : {}
QueueSelectEvents : False
Project : System.__ComObject
CnsFileString :
w:\MGC_ADMIN_HOME\share\2005_SP1\standard\isis\ces _expedition.cns

And here for one it hash't:
PS R:\$V=$App.ActiveView
PS R:\$V

Viewport Block
TopBlock
-------- -----
--------
System.__ComObject System.__ComObject
System.__ComObject

Can I make the types known to powershell?
By the way, when I open the vb editor in Excel and load "ViewDraw.Application"
in "Extras->References" I can see the members and properties of the View
object perfectly well.

Lots of Greetings!
Volker
--
For email replies, please substitute the obvious.
Feb 2 '07 #1
0 1201

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

Similar topics

4
by: Steve Holden | last post by:
I'm trying to load module code from a database, which stores for each module its full name, code, load date and a Boolean indicating whether it's a package or not. The following simple program:...
5
by: Steve Holden | last post by:
This is even stranger: it makes it if I import the module a second time: import dbimp as dbimp import sys if __name__ == "__main__": dbimp.install() #k = sys.modules.keys() #k.sort() #for...
0
by: plb | last post by:
All: I am struggling with an import problem... In my package, myapp, there is a module called logging. This module, naturally, imports the standard library module logging. However, when I...
3
by: Davide Bedin | last post by:
I have a "library" schema with the simple and complex types I commonly use in other schemas and then several other schemas, maybe created by other developers, that import/include the library...
7
by: Lance | last post by:
Is there any way to create an import alias that applies to the entire project? For example, lets say that I want "VB" to represent Microsoft.VisualBasic throughout my entire project. Is there...
6
by: Alexandre Badez | last post by:
Hye everyone, I'm would like to do something a bit tricky. I would like when I do something like to create a __init__ package's (here calle my_package) file witch make an action when we try to...
0
by: Frank Aune | last post by:
Hello, I have a python library package 'Foo', which contains alot of submodules: Foo/: __init__.py module1.py: class Bar() class Hmm() module2.py
9
by: rsoh.woodhouse | last post by:
Hi, I'm trying to work out some strange (to me) behaviour that I see when running a python script in two different ways (I've inherited some code that needs to be maintained and integrated with...
4
ChrisWang
by: ChrisWang | last post by:
Dear all, I am reading the book "Core Python Programming". In the chapter talking about modules, it says the modules should follow this ordering: import Python Standard Library modules ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
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,...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...

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.