I have 30 different web pages, where I am trying to make a script to copy all the texts and paste it to 30 different txt files and save it - all in the background.
So far I successfully created one script for one web page, but I am having problems to create ONE .vbs file that will do it for all 30 pages. I thought I can just copy/paste my code 30x to the bottom of the page and just modify the source/destination of the website and it would work. But it didnt.
With CreateObject("internetexplorer.application")
.Navigate "http://example.com"
Do Until .ReadyState = 4
Wscript.Sleep 100
Loop
.Document.execcommand "SelectAll"
.Document.execCommand "copy"
End With
'paste
Const ForAppending = 8
Dim sFSpec
sFSpec = ".\file1.txt"
Dim oIE
Dim sText
Set oIE = CreateObject( "InternetExplorer.Application" )
oIE.Navigate( "about:blank" )
sText = oIE.document.parentwindow.clipboardData.GetData( "text" )
CreateObject( "Scripting.FileSystemObject" )_
.OpenTextFile( sFSpec, ForAppending, True )_
.WriteLine sText
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'Below, I just copy and paste it, but the code here doesn't work
With CreateObject("internetexplorer.application")
.Navigate "http://example1.com"
Do Until .ReadyState = 4
Wscript.Sleep 100
Loop
.Document.execcommand "SelectAll"
.Document.execCommand "copy"
End With
'paste
Const ForAppending = 8
Dim sFSpec1
sFSpec1 = ".\dev01-envVar.txt"
Dim oIE1
Dim sText1
Set oIE1 = CreateObject( "InternetExplorer.Application" )
oIE1.Navigate( "about:blank" )
sText1 = oIE1.document.parentwindow.clipboardData.GetData( "text" )
CreateObject( "Scripting.FileSystemObject" )_
.OpenTextFile( sFSpec, ForAppending, True )_
.WriteLine sText
Or any other easier way than using vbscripting?
Also, IE always gives me this pop-up message - "Do you want to allow this webpage to access your clipboard?" How can I remove that pop up? Remove this popup!