
Same goes for me... Beautiful work!! Now we are talking...

Thank you! Great stuff!!!!!
I was way from the forums sometime, sorry if i make a stupid questionaXend wrote:@Num3 Thanks.You are right.The file requester should keep the last directory you went to...I'm aware that I could do something more on the GUI side of the Interface Generator. Use a Menu and/or Toolbar... I thought it would be useful to publish the tool now, so it can be used. I'll work on improvement from now. Any other suggestions?
Code: Select all
; Interface generated by Interface Generator 1.0, Date 05/31/2004
; MSScriptControl, Microsoft Script Control 1.0
; Enumerations
Enumeration ; ScriptControlStates
#Initialized = 0
#Connected = 1
EndEnumeration
; DispInterfaces
Interface IScriptProcedure Extends IDispatch
get_Name(a)
get_NumArgs(a)
get_HasReturnValue(a)
EndInterface
Interface IScriptProcedureCollection Extends IDispatch
get__NewEnum(a)
get_Item(a,b,c,d,e)
get_Count(a)
EndInterface
Interface IScriptModule Extends IDispatch
get_Name(a)
get_CodeObject(a)
get_Procedures(a)
AddCode(a)
Eval(a,b)
ExecuteStatement(a)
Run(a,b,c)
EndInterface
Interface IScriptModuleCollection Extends IDispatch
get__NewEnum(a)
get_Item(a,b,c,d,e)
get_Count(a)
Add(a,b,c)
EndInterface
Interface IScriptError Extends IDispatch
get_Number(a)
get_Source(a)
get_Description(a)
get_HelpFile(a)
get_HelpContext(a)
get_Text(a)
get_Line(a)
get_Column(a)
Clear()
EndInterface
Interface IScriptControl Extends IDispatch
get_Language(a)
put_Language(a)
get_State(a)
put_State(a)
put_SitehWnd(a)
get_SitehWnd(a)
get_Timeout(a)
put_Timeout(a)
get_AllowUI(a)
put_AllowUI(a)
get_UseSafeSubset(a)
put_UseSafeSubset(a)
get_Modules(a)
get_Error(a)
get_CodeObject(a)
get_Procedures(a)
_AboutBox()
AddObject(a,b,c)
Reset()
AddCode(a)
Eval(a,b)
ExecuteStatement(a)
Run(a,b,c)
EndInterface
Code: Select all
object = CreateObject(ProgID)
Code: Select all
object\function()
Thanks for your answers!aXend wrote:As described in the documentation you can download COMLIB from http://home.planet.nl/~aXend/purebasic/COMLIB_demo.zip. This LIB contains the functionAfter that you can doCode: Select all
object = CreateObject(ProgID)
as found in the Interface.Code: Select all
object\function()
You have to find the meaning of the methods and properties in the manuals of MSScript. I can't help you with that.
Code: Select all
IncludeFile "msscript interface.pb" ;the interface i show in other post here
Debug object.IScriptControl = CreateObject("MSScriptControl.ScriptControl.1")
Debug object\_AboutBox()
Code: Select all
IncludeFile "MSScriptControl.pb" ; the Interface file
Structure SAFEARRAYBOUND
cElements.l; // The number of elements in the dimension
lLbound.l; // Lowerbound of the dimension
EndStructure
Structure SAFEARRAY
cDims.w; // Count of dimensions in this array.
fFeatures.w; // Flags used by the SafeArray routines documented below.
cbElements.l; // Size of an element of the array. Does not include size of pointed-To Data.
cLocks.l; // Number of times the array has been locked without corresponding unlock.
pvData.l; // Pointer to the data.
rgsabound.SAFEARRAYBOUND[1] ; // One bound for each dimension.
EndStructure
Global None.VARIANT
None\vt = #VT_ERROR
None\scode = #DISP_E_PARAMNOTFOUND
oScript.IScriptControl = CreateObject("MSScriptControl.ScriptControl")
Debug oScript
oScript\_AboutBox()
oScript\put_Language(Ansi2Uni("JScript"))
oScript\get_Language(@language.l)
Debug Uni2Ansi(language)
oScript\get_Timeout(@timeout.l)
Debug timeout
oScript\get_Modules(@oModules.IScriptModuleCollection)
Debug oModules
oModules\Add(Ansi2Uni("TestModule"),None,@oModule.IScriptModule)
Debug oModule
oModule\get_Name(@name.l)
Debug Uni2Ansi(name)
err.l = oModule\AddCode(Ansi2Uni("function Calc() {var x=4*4; return x;}"))
If err = #S_OK
numargs.l = 0
rgsabound.SAFEARRAYBOUND
rgsabound\cElements = numargs
rgsabound\lLbound = 0
*psa.SAFEARRAY = SafeArrayCreate_(#VT_VARIANT,1,rgsabound)
If oModule\Run(Ansi2Uni("Calc"),@*psa,@result.VARIANT) = #S_OK
Debug result\vt
Debug result\value
Else
Debug Hex(err)
EndIf
Else
Debug Hex(err)
EndIf
SafeArrayDestroy_(psa)
err.l = oModule\AddCode(Ansi2Uni("function MyStringFunction(Argu1,Argu2,Argu3) {return Argu1+', '+Argu2+' and '+Argu3;}"))
If err = #S_OK
numargs.l = 3
Dim vArgs.VARIANT(numargs-1)
vArgs(0)\vt = #VT_BSTR
vArgs(0)\bstrVal = Ansi2Uni("Vanilla")
vArgs(1)\vt = #VT_INT
vArgs(1)\lVal = 9999
vArgs(2)\vt = #VT_BSTR
vArgs(2)\bstrVal = Ansi2Uni("Espresso Chip")
rgsabound.SAFEARRAYBOUND
rgsabound\cElements = numargs
rgsabound\lLbound = 0
*psa.SAFEARRAY = SafeArrayCreate_(#VT_VARIANT,1,rgsabound)
For i = 0 To numargs-1
SafeArrayPutElement_(*psa,@i,@vArgs(i)) ; add arguments to SafeArray
Next
If oModule\Run(Ansi2Uni("MyStringFunction"),@*psa,@result.VARIANT) = #S_OK
Debug result\vt
Debug Uni2Ansi(result\value)
Else
Debug Hex(GetLastError_())
EndIf
Else
Debug Hex(err)
EndIf
SafeArrayDestroy_(psa)
oModule\get_Procedures(@oProcedures.IScriptProcedureCollection)
Debug oProcedures
oProcedures\get_Count(@count.l)
Debug count ; should be 2 because 2 procedures were added
For i = 1 To count ; !!! ATTENTION !!!: the counter starts at 1
item.VARIANT\vt = #VT_I4 ; this is the VARIANT type for the index
item\value = i ; this is the index
*item.pToVariant = item ; this cuts the VARIANT in 4 LONG values
; Get a Procedure object by passing the 4 LONG values
If oProcedures\get_Item(*item\a,*item\b,*item\c,*item\d,@oProcedure.IScriptProcedure) = #S_OK
oProcedure\get_Name(@name.l)
oProcedure\get_NumArgs(@args.l)
oProcedure\get_HasReturnValue(@retVal.l)
If retVal = #VARIANT_TRUE
retVal$ = "does"
Else
retVal$ = "doesn't"
EndIf
Debug "Procedure "+Uni2Ansi(name)+" takes "+Str(args)+" arguments "+" and "+retVal$+" return a value"
ReleaseObject(oProcedure)
Else
Debug Hex(GetLastError_())
EndIf
Next
ReleaseObject(oProcedures)
ReleaseObject(oModule)
ReleaseObject(oModules)
ReleaseObject(oScript)
Code: Select all
IncludeFile "msscript interface.pb" ;the one showed here before
object.IScriptControl = CreateObject("MSScriptControl.ScriptControl.1")
object\_AboutBox()
object\put_Language(Ansi2Uni("vbscript"))
object\ExecuteStatement(Ansi2Uni("msgbox " + Chr(34) + "hello msscript from PB" + Chr(34)))
object\ExecuteStatement(Ansi2Uni("Value = (3*3)+100:MsgBox Value"))
ReleaseObject(object)
Code: Select all
Set oWeb = CreateObject("Shell.Application")
Set Web = Web.Windows
Web.count
Web.Item(i).Document
First I had to change "Set Web = Web.Windows" to "Set Web = oWeb.Windows".Set oWeb = CreateObject("Shell.Application")
Set Web = Web.Windows
Web.count
Web.Item(i).Document
Code: Select all
oWeb.IShellDispatch = CreateObject("Shell.Application")
oWeb\Windows(@Web.Folder3)
Web\Items(@WebItems.FolderItems3)
WebItems\get_Count(@count.l)