There are problems with your use of single quotes and escape codes as well. Use :
Code: Select all
colAdapters = objWMIService\CreateEnumeration("ExecQuery('Select * from Win32_NetworkAdapter Where Index= $0027" + index_nic$ +"$0027')")
Code: Select all
colAdapters = objWMIService\CreateEnumeration("ExecQuery('Select * from Win32_NetworkAdapter Where Index= $0027" + index_nic$ +"$0027')")
Code: Select all
; Windows Vista only - per MSDN
; http://msdn.microsoft.com/en-us/library/aa390385(VS.85).aspx
; http://msdn.microsoft.com/en-us/library/aa390364(VS.85).aspx
;
; the adapter index used here is the one stored in the registry not the connection index for the adapter - NetLuidIndex
; HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}\<0000 thru how ever many sub keys - the one that contains your physical NIC adapter"
; its the value of NetLuidIndex for your adapter entry
XIncludeFile "COMate.pbi"
Procedure Enable_Adapter(NetLuidIndex.l)
Define.COMateObject objWMIService, Adapter
colAdapters.COMateEnumObject
strComputer.s = "."
Net_Luid_Index$ = Str(NetLuidIndex)
objWMIService = COMate_GetObject("winmgmts:\\" + strComputer + "\root\cimv2", "")
If objWMIService
colAdapters = objWMIService\CreateEnumeration("ExecQuery('Select * from Win32_NetworkAdapter Where Index= $0027" + Net_Luid_Index$ +"$0027')")
If colAdapters
Adapter= colAdapters\GetNextObject()
While Adapter
result.l = Adapter\Invoke("Enable()")
Adapter\Release()
Adapter = colAdapters\GetNextObject()
Wend
colAdapters\Release()
EndIf
objWMIService\Release()
EndIf
ProcedureReturn result ; if completed OK result returns 0
EndProcedure
Code: Select all
; Windows Vista only - per MSDN
; http://msdn.microsoft.com/en-us/library/aa390385(VS.85).aspx
; http://msdn.microsoft.com/en-us/library/aa390364(VS.85).aspx
;
; the adapter index used here is the one stored in the registry not the connection index for the adapter - NetLuidIndex
; HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}\<0000 thru how ever many sub keys - the one that contains your physical NIC adapter"
; its the value of NetLuidIndex for your adapter entry
XIncludeFile "COMate.pbi"
Procedure Disable_Adapter(NetLuidIndex.l)
Define.COMateObject objWMIService, Adapter
colAdapters.COMateEnumObject
strComputer.s = "."
Net_Luid_Index$ = Str(NetLuidIndex)
objWMIService = COMate_GetObject("winmgmts:\\" + strComputer + "\root\cimv2", "")
If objWMIService
colAdapters = objWMIService\CreateEnumeration("ExecQuery('Select * from Win32_NetworkAdapter Where Index= $0027" + Net_Luid_Index$ +"$0027')")
If colAdapters
Adapter= colAdapters\GetNextObject()
While Adapter
result.l = Adapter\Invoke("Disable()")
Adapter\Release()
Adapter = colAdapters\GetNextObject()
Wend
colAdapters\Release()
EndIf
objWMIService\Release()
EndIf
ProcedureReturn result ; if completed OK result returns 0
EndProcedure
SFSxOI wrote:Thank you srod, this is great. I'm having a lot of fun with it now that i'm getting used to it.
Code: Select all
XIncludeFile "COMate.pbi"
Define.COMateObject PDFObject
If OpenWindow(0, 0, 0, 640, 480, "COMate PDF-Demo") And CreateGadgetList(WindowID(0))
pdfObject = Comate_CreateObject("AcroPDF.PDF.1", WindowID(0))
If pdfObject
pdfObject\SetProperty("src = 'C:\test.pdf'")
pdfObject\Invoke("setShowToolbar(#True)")
pdfObject\Invoke("setView('FitH')")
pdfObject\Invoke("setPageMode('none')")
pdfObject\Invoke("setLayoutMode('SinglePage')")
While WaitWindowEvent() <> #PB_Event_CloseWindow : Wend
CloseWindow(0)
pdfObject\Release()
Else
MessageRequester("COMate -Acrobat PDF demo", "Couldn't create the ActiveX object!")
EndIf
EndIf
I think thats great news!! Does that mean you will be implementing the event sinks in the future? Or that you will not be implementing them? I think I am confused. This will allow the use of VBScripts calling PB functions?srod wrote:SFSxOI wrote:Thank you srod, this is great. I'm having a lot of fun with it now that i'm getting used to it.You're welcome.
The ActiveX stuff is now done (apart from the 'event sinks') which I will not add until later. I just need to update the help manual and then I will spend a few hours looking at the command parser to see if I can speed it up somewhat. When done I'll start collecting these examples of yours together and add them to the download - with full credit to yourself of course. Assuming you don't mind me making use of your code that is?
Code: Select all
XIncludeFile "COMate.pbi"
Procedure.s Monitor_Info()
Define.COMateObject objWMIService, Monitor
colMonitor.COMateEnumObject
strComputer.s = "."
Net_I_Index$ = Str(Interface_Index)
objWMIService = COMate_GetObject("winmgmts:\\" + strComputer + "\root\cimv2", "")
If objWMIService
colMonitor = objWMIService\CreateEnumeration("ExecQuery('Select * from Win32_DesktopMonitor')")
If colMonitor
Monitor= colMonitor\GetNextObject()
While Monitor
Debug "Screen Height = " + Str(Monitor\GetIntegerProperty("ScreenHeight"))
Debug "Screen Width = " + Str(Monitor\GetIntegerProperty("ScreenWidth"))
Monitor\Release()
Monitor = colMonitor\GetNextObject()
Wend
colMonitor\Release()
EndIf
objWMIService\Release()
EndIf
EndProcedure
Monitor_Info()
Code: Select all
DataSection
Mac_aUnk:
Data.s "5254AB", "E20C0F", "080089", "080002", "00C0EF", "000150"
Data.s "00E098", "00E081", "00E07D", "00E018", "004010", "00104B"
Data.s "00C04F", "00A0CC", "006008", "0040FF", "0019B9", "00067C"
Data.s "0010A4", "0004AC", "0000E1", "00A04B", "004027", "0006C1"
Data.s "000214", "0013F7", "001150", "000d88", "000C41", "000086"
Data.s "525400", "001310", "00045A", "000625", "001839", "009004"
Data.s "000F66", "001217", "0014BF", "0016B6", "00105A", "002061"
Data.s "00095B", "000FB5", "00146C", "00184D", "000D88", "00608C"
Data.s "00173F", "0030BD", "000E3B", "00055D", "00177C", "006094"
Data.s "000F3D", "001195", "001346", "0015E9", "004001", "006097"
Data.s "00179A", "0050BA", "0080C8", "001349", "00E08F", "00603E"
Data.s "00A0C5", "0004E2", "000BC5", "08008A", "08BBCC", "006052"
EndDataSection
Code: Select all
#Nb_MacUnk = 71
Dim Mac_aUnk.s(#Nb_MacUnk)
For k=0 To #Nb_MacUnk
Read Mac_aUnk(k)
Next
Code: Select all
Mac_aUnk(Random(#Nb_MacUnk))
Code: Select all
XIncludeFile "COMate.pbi"
Code: Select all
Restore Mac_aUnk
Code: Select all
; network system name
XIncludeFile "COMate.pbi"
Procedure.s CIM_Sys_Name()
Define.COMateObject objWMIService, SysName
colSysNames.COMateEnumObject
strComputer.s = "."
objWMIService = COMate_GetObject("winmgmts:\\" + strComputer + "\root\cimv2", "")
If objWMIService
colSysNames = objWMIService\CreateEnumeration("ExecQuery('Select * from CIM_NetworkAdapter')")
If colSysNames
SysName= colSysNames\GetNextObject()
While SysName
System_Name.s = SysName\GetStringProperty("SystemName")
SysName\Release()
SysName = colSysNames\GetNextObject()
Wend
colSysNames\Release()
EndIf
objWMIService\Release()
EndIf
ProcedureReturn System_Name
EndProcedure
Debug CIM_Sys_Name()
Code: Select all
peedy.Get("state", "Showing, Speaking,Moving,Hiding");
Code: Select all
; Define
XIncludeFile "COMate.pbi"
Global AgentType.s
Global AgentObject.COMateObject
Global GenieObject.COMateObject
; EndDefine
If ExamineDesktops()
cWidth=DesktopWidth(0)/2-50
cHeight=DesktopHeight(0)/4
EndIf
Procedure.l AgentInit(type.s)
#Quote$="'"
AgentType=#Quote$+"Genie"+#Quote$
AgentObject=COMate_CreateObject("Agent.Control.1")
AgentObject\SetProperty("Connected = #True")
AgentObject\Invoke("Characters\Load("+AgentType+")")
GenieObject=0
GenieObject=AgentObject\GetObjectProperty("Characters("+AgentType+")")
ProcedureReturn GenieObject
EndProcedure
Procedure AgentShow(nr)
Debug "Start "+Str(nr)
If GenieObject
GenieObject\Invoke("Show")
Delay(3000)
Debug "?"
Select nr
Case 1
GenieObject\Invoke("MoveTo("+StrU(300,#Word)+", "+StrU(100,#Word)+", 1000)")
Delay(2000)
GenieObject\Invoke("Play('This is the Text for Help Page 1')")
Delay(2000)
Case 2
GenieObject\Invoke("Play('Greet')")
Delay(5000)
Debug COMateClass_GetIntegerProperty(GenieObject,"State")
;Debug GenieObject\Invoke("Get('state')")
GenieObject\Invoke("Think('Hello, feel the Power!')")
Delay(5000)
GenieObject\Invoke("Play('Reading')")
Delay(2000)
GenieObject\Invoke("Play('This is the Text for Help Page 2')")
Delay(5000)
GenieObject\Invoke("Stop")
Case 3
GenieObject\Invoke("Speak('Blah blah.')")
Delay(2000)
GenieObject\Invoke("Play('This is the Text for Help Page 3')")
Debug "!"
EndSelect
GenieObject\Invoke("Play('Hide')")
EndIf
Debug "Ende "+Str(nr)
EndProcedure
Procedure AgentStop()
GenieObject\Release()
AgentObject\Release()
EndProcedure
AgentInit("Genie")
For i=1 To 3
AgentShow(i)
Next i
AgentStop()