Is it possible in a .vbs file to remove all paragraph marks and line =
breaks from a string of characters that has been copied to the =
Clipboard? =20

Larry

Re: Removing paragraph marks from the clipboard contents by \

\
Fri Oct 13 14:56:56 CDT 2006

> Is it possible in a .vbs file to remove all paragraph marks and line breaks
from a > string of characters that has been copied to the Clipboard?

This will remove carriage returns, line feeds, and form feeds from clipboard
data. It is easily modified to do any kind of editing you want.

'----------clipedit.vbs-------------
Set IE = CreateObject("InternetExplorer.Application")
IE.Navigate("about:blank")
data=IE.document.parentwindow.clipboardData.getData("text")

'edit clipboard data
data=replace(data,chr(13),"")
data=replace(data,chr(10),"")
data=replace(data,chr(12),"")

IE.document.parentwindow.clipboardData.setData "text", data
IE.Quit
'-------------------------------------
--
Crash



Re: Removing paragraph marks from the clipboard contents by Larry

Larry
Sat Oct 14 02:21:37 CDT 2006

Thanks much, but can you tell me what IE has to do with it? At the time =
I run the .vbs file, the text I want to edit is already in the =
clipboard. I'm just altering what's in the Clipboard. =20

""Crash" Dummy" <dvader@deathstar.mil> wrote in message =
news:uiv$9Gw7GHA.1188@TK2MSFTNGP05.phx.gbl...
> > Is it possible in a .vbs file to remove all paragraph marks and line =
breaks
> from a > string of characters that has been copied to the Clipboard?
>=20
> This will remove carriage returns, line feeds, and form feeds from =
clipboard
> data. It is easily modified to do any kind of editing you want.
>=20
> '----------clipedit.vbs-------------
> Set IE =3D CreateObject("InternetExplorer.Application")
> IE.Navigate("about:blank")
> data=3DIE.document.parentwindow.clipboardData.getData("text")
>=20
> 'edit clipboard data
> data=3Dreplace(data,chr(13),"")
> data=3Dreplace(data,chr(10),"")
> data=3Dreplace(data,chr(12),"")
>=20
> IE.document.parentwindow.clipboardData.setData "text", data
> IE.Quit
> '-------------------------------------
> --=20
> Crash
>=20
>

Re: Removing paragraph marks from the clipboard contents by Larry

Larry
Sat Oct 14 02:50:46 CDT 2006


I've combined the code you gave me with some further code and now I've =
got a .vbs file does what I want. The script is for running a broken =
URL. I select the broken URL, copy it, then run the .vbs file with =
Winkey and it loads the web page. =20

I still don't understand what IE has to do with it and would love to =
understand.

Here's the script. =20

Set IE =3D CreateObject("InternetExplorer.Application")
IE.Navigate("about:blank")
webaddress=3DIE.document.parentwindow.clipboardData.getData("text")

'edit clipboard data
data=3Dreplace(data,chr(13),"")
data=3Dreplace(data,chr(10),"")
data=3Dreplace(data,chr(12),"")

IE.document.parentwindow.clipboardData.setData "text", webaddress
IE.Quit

Dim ws
Set ws =3D WScript.CreateObject("WScript.Shell")
ws.Run webaddress





""Crash" Dummy" <dvader@deathstar.mil> wrote in message =
news:uiv$9Gw7GHA.1188@TK2MSFTNGP05.phx.gbl...
> > Is it possible in a .vbs file to remove all paragraph marks and line =
breaks
> from a > string of characters that has been copied to the Clipboard?
>=20
> This will remove carriage returns, line feeds, and form feeds from =
clipboard
> data. It is easily modified to do any kind of editing you want.
>=20
> '----------clipedit.vbs-------------
> Set IE =3D CreateObject("InternetExplorer.Application")
> IE.Navigate("about:blank")
> data=3DIE.document.parentwindow.clipboardData.getData("text")
>=20
> 'edit clipboard data
> data=3Dreplace(data,chr(13),"")
> data=3Dreplace(data,chr(10),"")
> data=3Dreplace(data,chr(12),"")
>=20
> IE.document.parentwindow.clipboardData.setData "text", data
> IE.Quit
> '-------------------------------------
> --=20
> Crash
>=20
>

Re: Removing paragraph marks from the clipboard contents by \

\
Sat Oct 14 07:27:10 CDT 2006

> I still don't understand what IE has to do with it and would love to
understand.

I don't know why, but that is the only way I know of to access the clipboard
from a script.
http://msdn.microsoft.com/workshop/author/dhtml/reference/objects/clipboarddata.asp
--
Crash



Re: Removing paragraph marks from the clipboard contents by Larry

Larry
Sat Oct 14 08:13:09 CDT 2006


But IE doesn't open or anything when I run the script. Yet the script =
seems to create an IE window. =20

Perhaps the code=20

Set IE =3D CreateObject("InternetExplorer.Application")
IE.Navigate("about:blank")

creates an IE window that is not visible? Yes, I see that's the case, =
because when I add

IE.visible =3D True

That makes a new blank IE window appear. But I still don't understand =
this next line. What is this line doing? I understand about getting =
the text from the clipboard, but what does the IE window have to do with =
it? The clipboard is not dependent on the IE window, the clipboard =
exists by itself. So why does it need the IE window to get text from =
the clipboard?

data=3DIE.document.parentwindow.clipboardData.getData("text")



""Crash" Dummy" <dvader@deathstar.mil> wrote in message =
news:%23CeXTw47GHA.4708@TK2MSFTNGP05.phx.gbl...
> > I still don't understand what IE has to do with it and would love to
> understand.
>=20
> I don't know why, but that is the only way I know of to access the =
clipboard
> from a script.
> =
http://msdn.microsoft.com/workshop/author/dhtml/reference/objects/clipboa=
rddata.asp
> --=20
> Crash
>=20
>

Re: Removing paragraph marks from the clipboard contents by Larry

Larry
Sat Oct 14 09:13:25 CDT 2006


I guess the idea is that the clipboardData property or method needs some =
object to work off of, so it uses IE.document.parentwindow, even if the =
IE document window actually has nothing to do with what the script is =
doing. It's needed for syntax reasons, not for anything real. That's =
my guess at the moment.

My question is, are there any other objects that could accomplish the =
same purpose, so that it wouldn't be necessary to open an IE window? So =
that instead of=20

data=3DIE.document.parentwindow.clipboardData.getData("text")

we had something like this:

data=3D[object].clipboardData.getData("text")

I ask this because the opening of the IE window causes the selection on =
which I'm working (the selection is normally a broken URL in an e-mail) =
to be unhighlighted, then highlighted again and I want to prevent that =
from happening. =20



"Larry" <larry328NOSPAM@att.net> wrote in message =
news:O6rbUK57GHA.3264@TK2MSFTNGP04.phx.gbl...

But IE doesn't open or anything when I run the script. Yet the script =
seems to create an IE window. =20

Perhaps the code=20

Set IE =3D CreateObject("InternetExplorer.Application")
IE.Navigate("about:blank")

creates an IE window that is not visible? Yes, I see that's the case, =
because when I add

IE.visible =3D True

That makes a new blank IE window appear. But I still don't understand =
this next line. What is this line doing? I understand about getting =
the text from the clipboard, but what does the IE window have to do with =
it? The clipboard is not dependent on the IE window, the clipboard =
exists by itself. So why does it need the IE window to get text from =
the clipboard?

data=3DIE.document.parentwindow.clipboardData.getData("text")



""Crash" Dummy" <dvader@deathstar.mil> wrote in message =
news:%23CeXTw47GHA.4708@TK2MSFTNGP05.phx.gbl...
> > I still don't understand what IE has to do with it and would love to
> understand.
>=20
> I don't know why, but that is the only way I know of to access the =
clipboard
> from a script.
> =
http://msdn.microsoft.com/workshop/author/dhtml/reference/objects/clipboa=
rddata.asp
> --=20
> Crash
>=20
>

Re: Removing paragraph marks from the clipboard contents by \

\
Sat Oct 14 10:42:16 CDT 2006

> My question is, are there any other objects that could accomplish the same
> purpose, so that it wouldn't be necessary to open an IE window?

This is the only way I know. If there is another way using a different object, I
don't know what it is. Unless someone more knowledgeable than me jumps in with
an alternative, you are stuck with IE. Search the Microsoft site. Maybe you can
find something there.
--
Crash



Re: Removing paragraph marks from the clipboard contents by Miyahn

Miyahn
Sat Oct 14 21:57:58 CDT 2006

"Larry" wrote in message news:%23t51As57GHA.2364@TK2MSFTNGP02.phx.gbl

> My question is, are there any other objects that could
> accomplish the same purpose, so that it wouldn't be
> necessary to open an IE window?

Only for 'GetData',

Dim oHtml
Set oHtml = CreateObject("htmlfile")
WScript.Echo _
oHtml.ParentWindow.ClipboardData.GetData("text")

Both for 'SetData' and 'GetData',use HTA.

I am using the following hta to add file/folder's
context menu, 'Copy FullPath'.

<!-- FileName:CopyPath.hta -->
<hta:application ID="HTA" windowstate="minimize">
<script language=vbs>
Const TKey1 = "HKCR\*\shell\CopyPath\"
Const Tkey2 = "HKCR\Directory\shell\CopyPath\"
Const sMenu = "Copy &FullPath"
Dim Arg, pPath
Arg = Mid(HTA.commandLine, Len(document.urlunencoded) + 4)
If Arg = "" Then
pPath = document.urlunencoded
Reg_UnReg TKey1, sMenu, pPath, False
Reg_UnReg TKey2, sMenu, pPath, True
Else
Me.clipboarddata.setdata "Text", Arg
End If
Me.Close
'
Sub Reg_UnReg(Key, Menu, Path, PopUp)
Dim ENo
With CreateObject("WScript.Shell")
.SendKeys "{F10}{ESC}", True
On Error Resume Next
.RegRead Key
ENo = Err.Number
On Error GoTo 0
If ENo <> 0 Then
.RegWrite Key, Menu
.RegWrite Key & "command\", "mshta """ & Path & """ %L"
If PopUp Then .PopUp "Added to context menu.", 1
Else
.RegDelete Key & "command\": .RegDelete Key
If PopUp Then .PopUp "Deleted from context menu.", 1
End If
End With
End Sub
</script>

--
Miyahn
Microsoft MVP for Microsoft Office - Excel(Jan 2006 - Dec 2006)
https://mvp.support.microsoft.com/profile=e971f039-a892-426c-9544-83d372c269b4

Got it! by Larry

Larry
Sun Oct 15 14:44:17 CDT 2006


Miyahn,

Thank you very much. It works. The blinking off and on of the selected =
broken url does not occur now. I think it occurred before, somehow, =
because of the IE application that was being created. For whatever =
reason (who knows what it is), when the created object is "htmlfile", =
instead of "InternetExplorer.Application", that blinking does now occur. =
=20

So now I have this:

Dim oHtml
Set oHtml =3D CreateObject("htmlfile")
webaddress=3DoHtml.parentwindow.clipboardData.getData("text")

instead of this:

Set IE =3D CreateObject("InternetExplorer.Application")
IE.Navigate("about:blank")
webaddress=3DIE.document.parentwindow.clipboardData.getData("text")

[followed by the code that removes the para marks and line breaks from =
the selection.]

Larry


"Miyahn" <HQF03250@nifty.ne.jp> wrote in message =
news:%23zDHWYA8GHA.3960@TK2MSFTNGP05.phx.gbl...
> "Larry" wrote in message news:%23t51As57GHA.2364@TK2MSFTNGP02.phx.gbl
>=20
> > My question is, are there any other objects that could
> > accomplish the same purpose, so that it wouldn't be=20
> > necessary to open an IE window?
>=20
> Only for 'GetData',
>=20
> Dim oHtml
> Set oHtml =3D CreateObject("htmlfile")
> WScript.Echo _
> oHtml.ParentWindow.ClipboardData.GetData("text")
>=20
> Both for 'SetData' and 'GetData',use HTA.
>=20
> I am using the following hta to add file/folder's
> context menu, 'Copy FullPath'.
>=20
> <!-- FileName:CopyPath.hta -->
> <hta:application ID=3D"HTA" windowstate=3D"minimize">
> <script language=3Dvbs>
> Const TKey1 =3D "HKCR\*\shell\CopyPath\"
> Const Tkey2 =3D "HKCR\Directory\shell\CopyPath\"
> Const sMenu =3D "Copy &FullPath"
> Dim Arg, pPath
> Arg =3D Mid(HTA.commandLine, Len(document.urlunencoded) + 4)
> If Arg =3D "" Then
> pPath =3D document.urlunencoded
> Reg_UnReg TKey1, sMenu, pPath, False
> Reg_UnReg TKey2, sMenu, pPath, True
> Else
> Me.clipboarddata.setdata "Text", Arg
> End If
> Me.Close
> '
> Sub Reg_UnReg(Key, Menu, Path, PopUp)
> Dim ENo
> With CreateObject("WScript.Shell")
> .SendKeys "{F10}{ESC}", True
> On Error Resume Next
> .RegRead Key
> ENo =3D Err.Number
> On Error GoTo 0
> If ENo <> 0 Then=20
> .RegWrite Key, Menu
> .RegWrite Key & "command\", "mshta """ & Path & """ %L"
> If PopUp Then .PopUp "Added to context menu.", 1
> Else
> .RegDelete Key & "command\": .RegDelete Key
> If PopUp Then .PopUp "Deleted from context menu.", 1
> End If
> End With
> End Sub
> </script>
>=20
> --=20
> Miyahn
> Microsoft MVP for Microsoft Office - Excel(Jan 2006 - Dec 2006)
> =
https://mvp.support.microsoft.com/profile=3De971f039-a892-426c-9544-83d37=
2c269b4

One more point by Larry

Larry
Sun Oct 15 14:47:25 CDT 2006

Also, the SetData was not needed, only the GetData. GetData moves the =
data from the clipboard to a data object, and it doesn't need to be =
moved back again to the clipboard, since I simply run the webpage from =
the (cleaned up) data object. =20



"Miyahn" <HQF03250@nifty.ne.jp> wrote in message =
news:%23zDHWYA8GHA.3960@TK2MSFTNGP05.phx.gbl...
> "Larry" wrote in message news:%23t51As57GHA.2364@TK2MSFTNGP02.phx.gbl
>=20
> > My question is, are there any other objects that could
> > accomplish the same purpose, so that it wouldn't be=20
> > necessary to open an IE window?
>=20
> Only for 'GetData',
>=20
> Dim oHtml
> Set oHtml =3D CreateObject("htmlfile")
> WScript.Echo _
> oHtml.ParentWindow.ClipboardData.GetData("text")
>=20
> Both for 'SetData' and 'GetData',use HTA.
>=20
> I am using the following hta to add file/folder's
> context menu, 'Copy FullPath'.
>=20
> <!-- FileName:CopyPath.hta -->
> <hta:application ID=3D"HTA" windowstate=3D"minimize">
> <script language=3Dvbs>
> Const TKey1 =3D "HKCR\*\shell\CopyPath\"
> Const Tkey2 =3D "HKCR\Directory\shell\CopyPath\"
> Const sMenu =3D "Copy &FullPath"
> Dim Arg, pPath
> Arg =3D Mid(HTA.commandLine, Len(document.urlunencoded) + 4)
> If Arg =3D "" Then
> pPath =3D document.urlunencoded
> Reg_UnReg TKey1, sMenu, pPath, False
> Reg_UnReg TKey2, sMenu, pPath, True
> Else
> Me.clipboarddata.setdata "Text", Arg
> End If
> Me.Close
> '
> Sub Reg_UnReg(Key, Menu, Path, PopUp)
> Dim ENo
> With CreateObject("WScript.Shell")
> .SendKeys "{F10}{ESC}", True
> On Error Resume Next
> .RegRead Key
> ENo =3D Err.Number
> On Error GoTo 0
> If ENo <> 0 Then=20
> .RegWrite Key, Menu
> .RegWrite Key & "command\", "mshta """ & Path & """ %L"
> If PopUp Then .PopUp "Added to context menu.", 1
> Else
> .RegDelete Key & "command\": .RegDelete Key
> If PopUp Then .PopUp "Deleted from context menu.", 1
> End If
> End With
> End Sub
> </script>
>=20
> --=20
> Miyahn
> Microsoft MVP for Microsoft Office - Excel(Jan 2006 - Dec 2006)
> =
https://mvp.support.microsoft.com/profile=3De971f039-a892-426c-9544-83d37=
2c269b4

Re: Removing paragraph marks from the clipboard contents by noone

noone
Tue Oct 17 15:48:22 CDT 2006

Il giorno Sat, 14 Oct 2006 03:50:46 -0400, "Larry" <larry328NOSPAM@att.net> ha scritto:
>I still don't understand what IE has to do with it and would love to =
>understand.

VbScript has no native access to the clipboard, but IE does.
So you have to use an IE method to read the clipboard.
It's easy with IE as it is loaded on every pc.
But you can do it with word or excel too.

This code runs word, pastes the content of the clipboard in a new document and gets it
into a vbs variable.

Set objWord = CreateObject("Word.Application")
objword.visible=false
with objWord
.Documents.add
.Selection.Paste
.Selection.WholeStory
strText= .Selection
end with

msgbox strText


Giovanni.

--
Giovanni Cenati (Aosta, Italy)
Write to user "Reventlov" and domain at katamail com
http://digilander.libero.it/Cenati (Esempi e programmi in VbScript)
--

Re: Removing paragraph marks from the clipboard contents by Fosco

Fosco
Wed Oct 18 11:07:57 CDT 2006

Reventlov (see signature):
> VbScript has no native access to the clipboard, but IE does.
> So you have to use an IE method to read the clipboard.
> It's easy with IE as it is loaded on every pc.

Se hai IE settato su protezione ALTA NON funziona pero'

It doesn't work if IE security settings are set to HIGH

--
Fosco

Re: Removing paragraph marks from the clipboard contents by Larry

Larry
Thu Oct 19 07:56:24 CDT 2006

I see. That makes sense. Thanks much.

Larry


"Reventlov (see signature)" <noone@no.void> wrote in message =
news:453367b7.245419359@powernews.libero.it...
> Il giorno Sat, 14 Oct 2006 03:50:46 -0400, "Larry" =
<larry328NOSPAM@att.net> ha scritto:
> >I still don't understand what IE has to do with it and would love to =
=3D
> >understand.
>=20
> VbScript has no native access to the clipboard, but IE does.
> So you have to use an IE method to read the clipboard.=20
> It's easy with IE as it is loaded on every pc.
> But you can do it with word or excel too.
>=20
> This code runs word, pastes the content of the clipboard in a new =
document and gets it
> into a vbs variable.
>=20
> Set objWord =3D CreateObject("Word.Application")
> objword.visible=3Dfalse
> with objWord
> .Documents.add
> .Selection.Paste
> .Selection.WholeStory
> strText=3D .Selection
> end with
>=20
> msgbox strText
>=20
>=20
> Giovanni.
>=20
> --=20
> Giovanni Cenati (Aosta, Italy)
> Write to user "Reventlov" and domain at katamail com
> http://digilander.libero.it/Cenati (Esempi e programmi in VbScript)
> --