Mombu the Microsoft Forum

Go Back   Mombu the Microsoft Forum > Microsoft > Interfacing my scripting language to WSH?
User Name
Password
REGISTER NOW! Mark Forums Read




Reply Bookmark and Share
1 6th August 00:11
dos-man 64
External User
 
Posts: 1
Default Interfacing my scripting language to WSH?



I've just figured out how to create and use WSH objects in VB 5 PRO. I

(http://www.savefile.com/projects/808766665)

I guess I'm wondering what files does the end user need to have in
order to use it?

I'm also wondering where did I get the type library?
Was it installed by one of my many companion CDs, or does it come with
VB 5? I don't have a lot of experience using type libraries. I
actually prefer to write programs that don't require additional files,
registering of activex controls, etc. Less headaches.
  Reply With Quote


 


2 6th August 00:11
joe fawcett
External User
 
Posts: 1
Default Interfacing my scripting language to WSH?



WScript comes with Windows, unless your customers are running older versions
such as Windows 95/98 you can normally rely on version 5.6 being present.

--

Joe Fawcett (MVP - XML)
http://joe.fawcett.name
  Reply With Quote


 


3 6th August 00:11
jakob bohm
External User
 
Posts: 1
Default Interfacing my scripting language to WSH?


WSH is included with Internet Explorer 6.0 or later and thus with any
Windows version that includes Internet Explorer 6.0 or later.


The type library for every component that has one (from almost any
vendor) is installed as part of that software and listed in the registry.

So when the end user installs Windows, Internet Explorer, Media Player,
Office, or any other product that has a scriptable object, that type
library is also installed, no extra installation step needed.

Windows itself also contains interfaces for listing the available type
libraries and the functions / objects they provide.

If you have the Microsoft Platform SDK or Visual Studio, the tool
"OLE/COM object viewer" will show you all the interfaces and type
libraries on a computer, but this is just a help lookup tool, it is not
needed to actually use those interfaces. In the type library view of
the OLE/COM object viewer, it is the "dispinterfaces" that can be used
from scripts, while the "ISomething" interfaces can be used from C++
programs.


--
Jakob Bøhm, M.Sc.Eng. * jb@danware.dk * direct tel:+45-45-90-25-33
Netop Solutions A/S * Bregnerodvej 127 * DK-3460 Birkerod * DENMARK
http://www.netop.com * tel:+45-45-90-25-25 * fax:+45-45-90-25-26
Information in this mail is hasty, not binding and may not be right.
Information in this posting may not be the official position of Netop
Solutions A/S, only the personal opinions of the author.
  Reply With Quote
4 6th August 00:11
richard mueller [mvp]
External User
 
Posts: 1
Default Interfacing my scripting language to WSH?


My recollection is that if I want to use early binding with the
Scripting.Dictionary or Scripting.FileSystemObject objects in VB6 I must
include a reference to "Microsoft Scripting Runtime", which is scrrun.dll. I
also recall that VB5 did not support functions like StrReverse, InStrRev,
Replace, Split, Join, and Round. I've used the Wscript.Network and
Wscript.Shell objects in VB (late binding), but the Wscript object functions
like Timer, Sleep, and Echo are not available.

--
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--
  Reply With Quote
5 6th August 00:11
dos-man 64
External User
 
Posts: 1
Default Interfacing my scripting language to WSH?


I, myself, still use 98. Yes, I'm a diehard.

I'm actually not sure which Windows versions my scripting language
will and won't run on.
Unfortunately, I don't have the time or the resources to test it out
(and my other programs)
on every version of windows. I've given up on that. Would be a mammoth
effort.
  Reply With Quote
6 6th August 00:11
mr_unreliable
External User
 
Posts: 1
Default Interfacing my scripting language to WSH?


Yes, but VB5 versions of those functions can be found
(already coded), on various sites. The attachment was
found on the freeVBCode site.

cheers, jw

' this version from freeVBCode, by Jay Duhon (not dated, downloaded 04Aug07)

'Split Split a string into a variant array.
'
'InStrRev Similar to InStr but searches from end of string.
'
'Replace To find a particular string and replace it.
'
'Reverse To reverse a string.

Public Function InStrRev(ByVal sIn As String, ByVal _
sFind As String, Optional nStart As Long = 1, _
Optional bCompare As VbCompareMethod = vbBinaryCompare) _
As Long

Dim nPos As Long

sIn = Reverse(sIn)
sFind = Reverse(sFind)

nPos = InStr(nStart, sIn, sFind, bCompare)
If nPos = 0 Then
InStrRev = 0
Else
InStrRev = Len(sIn) - nPos - Len(sFind) + 2
End If
End Function

Public Function Join(Source() As String, _
Optional sDelim As String = " ") As String

Dim nC As Long
Dim sOut As String

For nC = LBound(Source) To UBound(Source) - 1
sOut = sOut & Source(nC) & sDelim
Next

Join = sOut & Source(nC)
End Function

Public Function Replace(ByVal sIn As String, ByVal sFind As _
String, ByVal sReplace As String, Optional nStart As _
Long = 1, Optional nCount As Long = -1, _
Optional bCompare As VbCompareMethod = vbBinaryCompare) As _
String

Dim nC As Long, nPos As Long
Dim nFindLen As Long, nReplaceLen As Long

nFindLen = Len(sFind)
nReplaceLen = Len(sReplace)
If (sFind <> "") And (sFind <> sReplace) Then
nPos = InStr(nStart, sIn, sFind, bCompare)
Do While nPos
nC = nC + 1
sIn = Left(sIn, nPos - 1) & sReplace & _
Mid(sIn, nPos + nFindLen)
If nCount <> -1 And nC >= nCount Then Exit Do
nPos = InStr(nPos + nReplaceLen, sIn, sFind, _
bCompare)
Loop
End If

Replace = sIn
End Function

Public Function Reverse(ByVal sIn As String) As String
Dim nC As Long
Dim sOut As String

For nC = Len(sIn) To 1 Step -1
sOut = sOut & Mid(sIn, nC, 1)
Next nC

Reverse = sOut
End Function

Public Function Split(ByVal sIn As String, _
Optional sDelim As String = " ", _
Optional nLimit As Long = -1, _
Optional bCompare As VbCompareMethod = vbBinaryCompare) _
As Variant

Dim nC As Long, nPos As Long, nDelimLen As Long
Dim sOut() As String
If sDelim <> "" Then
nDelimLen = Len(sDelim)
nPos = InStr(1, sIn, sDelim, bCompare)
Do While nPos
ReDim Preserve sOut(nC)
sOut(nC) = Left(sIn, nPos - 1)
sIn = Mid(sIn, nPos + nDelimLen)
nC = nC + 1
If nLimit <> -1 And nC >= nLimit Then Exit Do
nPos = InStr(1, sIn, sDelim, bCompare)
Loop
End If

ReDim Preserve sOut(nC)
sOut(nC) = sIn

Split = sOut
End Function
  Reply With Quote
7 6th August 00:11
richard mueller [mvp]
External User
 
Posts: 1
Default Interfacing my scripting language to WSH?


On May 22, 2:25 am, "Joe Fawcett" <joefawc...@newsgroup.nospam> wrote:

I, myself, still use 98. Yes, I'm a diehard.

I'm actually not sure which Windows versions my scripting language
will and won't run on.
Unfortunately, I don't have the time or the resources to test it out
(and my other programs)
on every version of windows. I've given up on that. Would be a mammoth
effort.

-----------

VBScript will run on Win9x clients (Windows 95 and Windows 98) if either
DSClient or WSH is installed. I assume either of these installs the
scrrun.dll I mentioned earlier. VBScript (and scrrun.dll) comes with all
Windows OS's after that, as far as I know. I still keep Win95 and Win98
clients for testing.

--
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--
  Reply With Quote
8 6th August 00:11
dos-man 64
External User
 
Posts: 1
Default Interfacing my scripting language to WSH?


Did you try creating your own "virtual" timer using GetTickCount( )?
What about using
the SleepEx( )? Obviously echo( ) is a huge problem, just because VB
is anti-console.

Well, this is going very well. I've already added 18 wsh functions
(some are more
useful than others.) There are probably around 30 that should be
added. I just created
a make believe wsh "object", and then use the stack for passing
parameters and return
values. The code is more lengthy than what would be typical for the
language, but not
as cryptic.

wsh.browsefolder()
-------------------------

stack element 0: title of the dialog
stack element 1: affects type of files displayed
stack element 2: starting directory
stack element 3: return value

*firstarg = ("Choose a folder"); // title
*firstarg.push("0");

*secondarg = ("1"); // folders only
*secondarg.push("1");

*thirdarg = ("C:\Windows"); // start in
*thirdarg.push("2");

wsh.browsefolder(); // display dialog

*returned.pop("3"); // return value
*returned.if[ne]("");
{
app.print("Folder ~\*returned~ was selected.");
}
  Reply With Quote
9 6th August 00:11
jakob bohm
External User
 
Posts: 1
Default Interfacing my scripting language to WSH?


VB is not VBScript, it is its own language, with its own (different)
versions of VB/VBScript builtin functions such as StrReverse, InStrRev
etc. These functions are not accessed via a Type library in either
language but are part of the language interpreter/compiler itself. Thus
VB5, VB6, VBA, VBScript etc. each have their own definitions and
implementations of these functions, even if running on the same computer
with the same scripting runtime installed.

When importing a type library into your program, the notation and
convenience is different for VB and vbscript: In VB you specify the
installed DLL which provides both the API and its type library, or you
write endless lists of Declare and Const statements. In VBScript you
either specify the Name (or GUID) of the type library in a .wsf file or
write endless lists of Const statements.

Here is an example of referencing the WScript runtime and one of the
database APIs from a VBScript stored in .wsf format:
<?xml version="1.0" encoding="iso8859-1" ?>
<job id="myscriptname" args="mydefaultarg">
<?job error="false" debug="false" ?>
<reference guid="{420B2830-E718-11CF-893D-00A0C9054228}" version="1.0"/>
<reference guid="{EF53050B-882E-4776-B643-EDA472E8E3F2}" version="2.7"/>
<script language="VBScript">
<![CDATA[
' VBScript code goes here
]]>
</script>
</job>


--
Jakob Bøhm, M.Sc.Eng. * jb@danware.dk * direct tel:+45-45-90-25-33
Netop Solutions A/S * Bregnerodvej 127 * DK-3460 Birkerod * DENMARK
http://www.netop.com * tel:+45-45-90-25-25 * fax:+45-45-90-25-26
Information in this mail is hasty, not binding and may not be right.
Information in this posting may not be the official position of Netop
Solutions A/S, only the personal opinions of the author.
  Reply With Quote
10 6th August 00:11
paul randall
External User
 
Posts: 1
Default Interfacing my scripting language to WSH?


VB is not VBScript, it is its own language, with its own (different)
versions of VB/VBScript builtin functions such as StrReverse, InStrRev
etc. These functions are not accessed via a Type library in either
language but are part of the language interpreter/compiler itself. Thus
VB5, VB6, VBA, VBScript etc. each have their own definitions and
implementations of these functions, even if running on the same computer
with the same scripting runtime installed.

When importing a type library into your program, the notation and
convenience is different for VB and vbscript: In VB you specify the
installed DLL which provides both the API and its type library, or you
write endless lists of Declare and Const statements. In VBScript you
either specify the Name (or GUID) of the type library in a .wsf file or
write endless lists of Const statements.

Here is an example of referencing the WScript runtime and one of the
database APIs from a VBScript stored in .wsf format:
<?xml version="1.0" encoding="iso8859-1" ?>
<job id="myscriptname" args="mydefaultarg">
<?job error="false" debug="false" ?>
<reference guid="{420B2830-E718-11CF-893D-00A0C9054228}" version="1.0"/>
<reference guid="{EF53050B-882E-4776-B643-EDA472E8E3F2}" version="2.7"/>
<script language="VBScript">
<![CDATA[
' VBScript code goes here
]]>
</script>
</job>

For me, guids don't seem to stick in my head, so creating references like
this is a as big a pain as writing the endless lists of constants. Besides,
why can't the computer create the endless list as executable statements and
execute them?

Groups.google.com for the following:
"TLBINF32.DLL must be present"

This search should find a reply I posted which includes a function that
silently executes statements to define the constants and returns a list of
those constants, with a call like:
MsgBox DefineConstants("InternetExplorer.Application")

-Paul Randall
  Reply With Quote
Reply


Thread Tools
Display Modes


Some other forums that might be of your interest : Access internet, Access security, Access install and configure, Excel setup, Desktop operating system, Server operating systems, Desktop products and technologies, Frontpage add-ins, Frontpage general questions, Frontpage server extensions, Frontpage extensions unix, Office intranets, Office general questions, Office setup, Outlook install and configure, Outlook interop, Outlook team folders, Powerpoint general questions, Powerpoint for mac, Microsoft project general, Word setup networking, Scripting remote, Scripting vb script, Scripting wsh, Windows application compatibility, Windows server scripting, Windows server setup, Windows server networking, Windows server general, Windows server dns, Windows server clustering, Windows server active directory, Windows msi, Windows group policy, Windows file system, Windows terminal services, Windows 64bit edition, Software update services, Windows 2000 active directory, Windows 2000 advanced server, Windows 2000 app compatibility, Windows 2000 command prompt, Windows 2000 dns, Windows 2000 fax, Windows 2000 file sys and svcs, Windows 2000 general, Windows 2000 group policy, Windows 2000 hardware, Windows 2000 multimedia, Windows 2000 netware, Windows 2000 networking, Windows 2000 printing, Windows 2000 ras/routing, Windows 2000 registry, Windows 2000 security, Windows 2000 setup, Windows 2000 deployment, Win2000 term srvr applications, Windows 2000 remote desktop, Windows application compatibility, Windows server scripting, Windows application compatibility, Windows nt app. compatibility, Windows nt dns, Windows nt domain, Windows nt general, Windows nt protocols general, Windows nt ras, Windows nt routing, Windows nt setup, Windows nt tcp/ip, Terminal server connectivity, Terminal server setup, Windows programmer controls, Windows programmer misc, Windows programmer nt kernel mode, Windows programmer tools mfc, Windows programmer win32, Microsoft related in newsgroups, Comp microsoft windows, Comp os windows xp, Os windows xp, Os windows-xp, Alt microsoft windows, Alt microsoft windows me, Alt microsoft windows w2k, Alt microsoft windows xp, Uk microsoft windows (comp-os), Alt winsock programming, Comp databases ms access, Comp databases paradox, Wine windows emulator, Pegasus mail ms windows, Eudora mail ms windows, Windows xp basics discussion, Windows xp customizing, Windows xp general discussion, Windows xp hardware, Windows xp help and support, Windows xp networking discussion, Performance and maintenance, Windows xp security and administration, Windows xp setup and deployment, Windows xp working remotely, Windows 95 dial-up networking, Windows 95 general, Windows 95 networking, Windows 98 modems, Windows 98 general, Windows 98 internet, Windows 98 networking, Windows 98 performance, Windows 98 setup, Radius, Internet explorer nt, Internet explorer rights management, Internet explorer security, Internet explorer 6 browser, Internet explorer 6 ieak, Internet explorer 6 outlook express, Internet explorer 6 setup, Internet explorer 5.5 add-ons, Internet explorer 5.5 browser, Internet explorer 5.5 outlook express, Internet explorer 5.5 setup, Internet explorer 5 browser, Internet explorer 5 general, Internet explorer 5 outlook express, Microsoft project general, Microsoft project server, Microsoft project developer, Visio network design docs, Visio troubleshooting, Visio installation, Visio createshapes, Servers, Application center administration, Application center cluster load bal., Application center health monitor, Application center network load balanc., Application center setup, Application center usage, Biztalk server general, Biztalk server admin, Biztalk server admintools, Biztalk server application integration, Biztalk server edi_flatfiles, Biztalk server framework, Biztalk server library, Biztalk server new user, Biztalk server orchestration, Biztalk server, Biztalk server sdk, Biztalk server setup, Biztalk server xml tools, Biztalk server xlangs, Biztalk server non-xml, Biztalk accelerator financial services, Biztalk accelerator hipaa, Biztalk accelerator hl7, Biztalk accelerator rosettanet, Biztalk accelerator suppliers, Commerce server analysis, Commerce server business desk, Commerce server campaigns, Commerce server catalog, Commerce server data warehousing, Commerce server deployment, Commerce server general, Commerce server (sdk), Commerce server solution sites, Commerce server userprofile mgmt, Cms general, Cms evaluation, Data protection manager, Exchange server clients, Exchange server administration, Exchange server clustering, Exchange server connectivity, Exchange server design, Exchange server development, Exchange server miscellaneous, Exchange server setup and installation, Exchange server tools, Outlook calendaring, Outlook contacts, Outlook fax, Outlook general, Outlook install and configure, Outlook interop, Outlook non-microsoft utilities, Outlook new users, Outlook printing, Outlook program add-ins, Outlook programming: forms, Outlook programming: vba, Outlook team folders, Host integration server general, Isa server general, Isa server clients, Isa server configuration, Isa server education, Isa server enterprise, Isa server publishing, Isa server sdk, Isa server vpn, Isa server wish list, Live communications server general, Live communications server developer, Microsoft crm, Microsoft crm deployment, Microsoft crm developer, Mom general discussion, Mom management pack, Mom management pack active directory, Mom management pack exchange, Mom management pack iis, Mom management pack sql server, Mom reporting, Mom security, Mom setup and upgrades, Mom user interface, Mom workgroup edition, Microsoft site server analysis, Microsoft site server commerce, Microsoft site server general, Microsoft site server knowledgemgr, Microsoft site server publishing, Microsoft site server search, Sharepoint - setup and administration, Sharepoint - design and customization, Sharepoint - development and programming, Sharepoint - general q&a and discussion, Windows small business server 2003, Small business server 2000, Small business server 4.x, Sql server clients, Sql server clustering, Sql server connection issues, Sql server data mining, Sql server data warehousing, Sql server dts, Sql server english query, Sql server full-text searching, Sql server jdbc driver, Sql server migration assistant, Sql server msde, Sql server new users, Sql server notification services, Sql server olap, Sql server ole db, Sql server ole db and olap, Sql server (odbc), Sql server programming, Sql server replication, Sql server reporting services, Sql server security, Sql server security tools, Sql server, Sql server 2000 windows ce edition, Sql server setup, Sql server tools, Sql server xml, Sql server xml view mapper, Sms admin, Sms inventory, Sms miscellaneous, Sms setup, Sms software distribution, Sms software update management, Sms tools, Windows storage, Windows file system: general, It tasks and topics, Windows server: clustering, Windows 2000 advanced server, Windows nt server 4.0, enterprise, Sql server clustering, Windows file system: general, Windows 2000 file system and services, Windows nt file system, Windows server dfs and frs, Windows storage, Iis ftp, Iis general, Iis security, Iis smtp and nntp, Internet server index server, Internet server misc, Mmc, Windows sdk: isapi-dev, Windows: group policy, Software update services, Windows installer (msi), Windows update, Windows 2000: group policy, Windows 2000: installer (msi), Windows 2000: registry, Windows 2000: deployment, Windows xp: configuration mgmt, Windows xp: performance & maint., Windows xp: deployment, Windows xp: wmi, Platform sdk: msi, Windows server scripting, Win32 programmer: wmi, Windows me: system tools, Pocket pc general, Pocket pc activsync, Pocket pc developer networking, Pocket pc ebooks, Pocket pc developer, Pocket pc marketplace, Pocket pc multimedia, Pocket pc phone edition, Pocket pc wireless, Smartphone, Smartphone developer, Portable media center, Windows server: (dns), Windows server: ipsec, Windows server: networking, Windows 2000: dns, Windows 2000: networking, Windows 2000: networking, Windows 2000: ras routing, Windows 2000 and macintosh, Windows 2000 and netware, Windows xp: messenger, Windows xp: networking and the web, Windows xp: working remotely, Device driver development, Win32 programmer: networks, Win32 programmer: tapi, .net jscript, .net scripting, Internet explorer 4 scripting, Ie 5 programming dhtml scriptlets, Internet explorer scripting, Internet explorer sdk scripting jscript, Internet explorer sdk scripting vb script, Scripting debugger, Scripting hosting, Scripting jscript, Scripting remote, Scripting scriplets, Scripting vb script, Scripting virus discussion, Scripting wsh, Security crypto, Security general, Security hfnetchk, Security mbsa, Security toolkit, Security virus, Windows update general, .net security, Access security, Iis security, Isa server general, Sql server security, Sql server security tools, Windows 2000 security, Windows sdk: security api, Windows server security general, Windows xp security, Windows installer msi, Windows server migration, Windows server setup, Windows 2000 deployment, Windows 2000 installer msi, Windows 2000 setup, Windows 2000 upgrade, Windows 2000 windows update, Windows update, Windows xp deployment, Windows nt setup, Biztalk server setup, Commerce server deployment, Exchange setup and installation, Isa server configuration, Office setup, Sharepoint portal server installation, Sharepoint portal server portal config, Small business server setup-config., Sql server setup, Terminal server setup, Virtual server, System builder, Technet discussions, Technet magazine, Technet talks, Technet how-to needs, Technet how-to feedback, Windows terminal services, 2000 terminal services: applications, 2000: installer, 2000: remote desktop, Xp: remote desktop, Nt terminal server: applications, Nt terminal server: clients, Nt terminal server: connectivity, Nt terminal server: domain, Nt terminal server: hardware, Nt terminal server: miscellaneous, Nt terminal server protocols: rdp, Nt terminal server protocols: tcpip, Nt terminal server: setup, Nt terminal server: user, Mcdba, Mcsa, Mcse, Mcp general, Certification networking, Skills assessment, Windows server update services, Update services, Windows xp deployment, Windows xp configuration mgmt, Windows update, Windows 2000 windows update, Mom sdk, Windows vista general discussion, Windows vista hardware, Windows vista installation, Windows vista help & support, Windows vista networking, Windows vista security, Windows vista mail, Windows vista games, Windows vista performance maintenance, Microsoft


Copyright © 2006 SmartyDevil.com - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -
666