Haven't been able to find an answer for this online. I have copied to =
Clipboard a string like this:

http://www.website.com/archives/006514.html

and I want to find and return just the numerical part of the string:

006514

Can I do that with a .vbs file? =20

Re: Use .vbs file to find a string of numbers in the clipboard by Tom

Tom
Mon Oct 16 09:59:36 CDT 2006

Maybe something like this ...

s = getClipBoardText5
if s <> "" then
a = split(s, "/")
s = split(a(Ubound(a)), ".")(0)
end if
wsh.echo s

' Requires IE v5.0+
Function getClipBoardText5()
With CreateObject("htmlfile")
On Error Resume Next
getClipBoardText5 = .ParentWindow.ClipboardData.GetData("text")
end with ' htmlfile
End Function

Tom Lavedas
=============
http://members.cox.net/tglbatch/wsh

Larry wrote:
> Haven't been able to find an answer for this online. I have copied to Clipboard a string like this:
>
> http://www.website.com/archives/006514.html
>
> and I want to find and return just the numerical part of the string:
>
> 006514
>
> Can I do that with a .vbs file?


Re: Use .vbs file to find a string of numbers in the clipboard by Larry

Larry
Mon Oct 16 13:03:15 CDT 2006


Tom,

Thanks very much. I used your code as a basis, but I had to set it up a =
little differently, and got it to work. =20

But can you translate the code for me into English to explain how it =
derives the number from the Clipboard? Thanks again.

Dim oHtml
Set oHtml =3D CreateObject("htmlfile")
EntryNum =3D oHtml.ParentWindow.ClipboardData.GetData("text")

If EntryNum <> "" then
a =3D split(EntryNum, "/")
EntryNum =3D split(a(Ubound(a)), ".")(0)
end if
wsh.echo EntryNum

Larry



"Tom Lavedas" <tglbatch@cox.net> wrote in message =
news:1161010776.923357.40090@m7g2000cwm.googlegroups.com...
> Maybe something like this ...
>=20
> s =3D getClipBoardText5
> if s <> "" then
> a =3D split(s, "/")
> s =3D split(a(Ubound(a)), ".")(0)
> end if
> wsh.echo s
>=20
> ' Requires IE v5.0+
> Function getClipBoardText5()
> With CreateObject("htmlfile")
> On Error Resume Next
> getClipBoardText5 =3D .ParentWindow.ClipboardData.GetData("text")
> end with ' htmlfile
> End Function
>=20
> Tom Lavedas
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> http://members.cox.net/tglbatch/wsh
>=20
> Larry wrote:
> > Haven't been able to find an answer for this online. I have copied =
to Clipboard a string like this:
> >
> > http://www.website.com/archives/006514.html
> >
> > and I want to find and return just the numerical part of the string:
> >=20
> > 006514
> >=20
> > Can I do that with a .vbs file?
>

Got it by Larry

Larry
Tue Oct 17 09:42:01 CDT 2006

I found the explanation of the Split function and Ubound at Hey =
Scripting Guy's website. Fantastic. =20

Also, I've used this same code to change another .vbs file I had that =
ran a Word macro so that now the whole job is done by a couple of lines =
in the .vbs file itself instead of depending on Word to do it. =20

Thanks again for the help, this is great stuff. =20

Larry




"Larry" <larry328NOSPAM@att.net> wrote in message =
news:uVGsH7U8GHA.4620@TK2MSFTNGP02.phx.gbl...

Tom,

Thanks very much. I used your code as a basis, but I had to set it up a =
little differently, and got it to work. =20

But can you translate the code for me into English to explain how it =
derives the number from the Clipboard? Thanks again.

Dim oHtml
Set oHtml =3D CreateObject("htmlfile")
EntryNum =3D oHtml.ParentWindow.ClipboardData.GetData("text")

If EntryNum <> "" then
a =3D split(EntryNum, "/")
EntryNum =3D split(a(Ubound(a)), ".")(0)
end if
wsh.echo EntryNum

Larry



"Tom Lavedas" <tglbatch@cox.net> wrote in message =
news:1161010776.923357.40090@m7g2000cwm.googlegroups.com...
> Maybe something like this ...
>=20
> s =3D getClipBoardText5
> if s <> "" then
> a =3D split(s, "/")
> s =3D split(a(Ubound(a)), ".")(0)
> end if
> wsh.echo s
>=20
> ' Requires IE v5.0+
> Function getClipBoardText5()
> With CreateObject("htmlfile")
> On Error Resume Next
> getClipBoardText5 =3D .ParentWindow.ClipboardData.GetData("text")
> end with ' htmlfile
> End Function
>=20
> Tom Lavedas
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> http://members.cox.net/tglbatch/wsh
>=20
> Larry wrote:
> > Haven't been able to find an answer for this online. I have copied =
to Clipboard a string like this:
> >
> > http://www.website.com/archives/006514.html
> >
> > and I want to find and return just the numerical part of the string:
> >=20
> > 006514
> >=20
> > Can I do that with a .vbs file?
>