Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
inet
active_desktop
active_scrptng
asp.components
asp.db
asp.general
comctl32
comp.packaging
components.dev
dbweb
dhtml_editing
docobjects
html_authoring
html_objmodel
iis
iis.ftp
iis.security
iis.smtp_nntp
indexserver
misc
mshtml_hosting
scripting.jscript
scripting.vbscript
sdk_setup
shell_objmodel
urlmonikers
webbrowser_ctl
wininet
  
 
date: Wed, 16 Apr 2008 10:15:01 -0700,    group: microsoft.public.inetsdk.programming.scripting.vbscript        back       


Add to clipboard   
I have a qustion. At my workplace we're using a system known as 3270 from IBM 
(http://en.wikipedia.org/wiki/IBM_3270), it's an old system that works really 
well. In this system we can use macros to make it a litlle more efficient and 
theese macros are in VBScript. What I would like to do is to get som 
information from this system into the windows clipboard (we're using XP). I 
know how to get the information that I want into a variable but I have not 
got a single clue on how to get it into the clipboard. I don't even know if 
it's possible but all you bright guys and gals oughta be able to tell me ;o)

So: How to get a variable from a VBScript into the windos clipboard?
date: Wed, 16 Apr 2008 10:15:01 -0700   author:   Mikael

Re: Add to clipboard   
Il giorno Wed, 16 Apr 2008 10:15:01 -0700, =?Utf-8?B?TWlrYWVs?=
 ha scritto:

>I have a qustion. At my workplace we're using a system known as 3270 from IBM 
>(http://en.wikipedia.org/wiki/IBM_3270), it's an old system that works really 
>well. In this system we can use macros to make it a litlle more efficient and 
>theese macros are in VBScript. What I would like to do is to get som 
>information from this system into the windows clipboard (we're using XP). I 
>know how to get the information that I want into a variable but I have not 
>got a single clue on how to get it into the clipboard. I don't even know if 
>it's possible but all you bright guys and gals oughta be able to tell me ;o)
>
>So: How to get a variable from a VBScript into the windos clipboard?

This creates an invisible instance of internet explorer, writes the content of
strClipboard, invoke the SelectAll and Copy methods (copies into the clipboard) and closes
IE.

StrClipboard= inputbox("Text to be written into the clipboard")
With CreateObject("InternetExplorer.Application")
  .Navigate "about:blank"
  'http://digilander.libero.it/Cenati
  do until .ReadyState = 4 : Wscript.Sleep 100 : Loop
  .visible = false
  With .document
    .writeln("<html><head><title></title></head><body><pre>")
    .writeln(StrClipboard)           
    .writeln("</pre></body></html>")
    .execcommand "SelectAll"
    .execcommand "Copy"
  end with ' document
end with 'Createobject

-- 
Giovanni Cenati (Bergamo, Italy)
Write to "Reventlov" at katamail com
http://digilander.libero.it/Cenati (Esempi e programmi in VbScript)
--
date: Sun, 20 Apr 2008 20:30:43 GMT   author:   (Reventlov)

Re: Add to clipboard   
Thanx for the reply!

I get "Variable is undefined: Wscript", how should I declare it?

"Reventlov" wrote:

> Il giorno Wed, 16 Apr 2008 10:15:01 -0700, =?Utf-8?B?TWlrYWVs?=
>  ha scritto:
> 
> >I have a qustion. At my workplace we're using a system known as 3270 from IBM 
> >(http://en.wikipedia.org/wiki/IBM_3270), it's an old system that works really 
> >well. In this system we can use macros to make it a litlle more efficient and 
> >theese macros are in VBScript. What I would like to do is to get som 
> >information from this system into the windows clipboard (we're using XP). I 
> >know how to get the information that I want into a variable but I have not 
> >got a single clue on how to get it into the clipboard. I don't even know if 
> >it's possible but all you bright guys and gals oughta be able to tell me ;o)
> >
> >So: How to get a variable from a VBScript into the windos clipboard?
> 
> This creates an invisible instance of internet explorer, writes the content of
> strClipboard, invoke the SelectAll and Copy methods (copies into the clipboard) and closes
> IE.
> 
> StrClipboard= inputbox("Text to be written into the clipboard")
> With CreateObject("InternetExplorer.Application")
>   .Navigate "about:blank"
>   'http://digilander.libero.it/Cenati
>   do until .ReadyState = 4 : Wscript.Sleep 100 : Loop
>   .visible = false
>   With .document
>     .writeln("<html><head><title></title></head><body><pre>")
>     .writeln(StrClipboard)           
>     .writeln("</pre></body></html>")
>     .execcommand "SelectAll"
>     .execcommand "Copy"
>   end with ' document
> end with 'Createobject
> 
> -- 
> Giovanni Cenati (Bergamo, Italy)
> Write to "Reventlov" at katamail com
> http://digilander.libero.it/Cenati (Esempi e programmi in VbScript)
> -- 
>
date: Sun, 20 Apr 2008 23:52:00 -0700   author:   Mikael

Re: Add to clipboard   
Il giorno Sun, 20 Apr 2008 23:52:00 -0700, =?Utf-8?B?TWlrYWVs?=
 ha scritto:

>Thanx for the reply!
>I get "Variable is undefined: Wscript", how should I declare it?

if you run a .VBS, the wscript object is already declared.
Probably it is not in your environment. It's the same in the HTA applications.
In this case, wscript.sleep is used to wait for IE to be loaded (in order to use IE's
capabilities of accessing the clipboard)

If it works, you can create a file called sleep.vbs in which there is the command
WSCRIPT.SLEEP 100

and then:

Set wshshell=CreateObject("wscript.shell") ' Put this at the beginning of the program

'and put this instead of the wscript.sleep command
wshshell.Run "%comspec% /c start c:\sleep.vbs"

Giovanni.

-- 
Giovanni Cenati (Bergamo, Italy)
Write to "Reventlov" at katamail com
http://digilander.libero.it/Cenati (Esempi e programmi in VbScript)
--
date: Tue, 22 Apr 2008 22:07:12 GMT   author:   (Reventlov)

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us