Antwort von
nach 22 Stunden
hilfreich
So nicht und Lösungsansätze
Ich suche keine alternative Sprache sondern eine Lösung des Problems in genau VBS. Ich weiß das Perl sehr mächtig ist, jedoch ist das nicht das "Aufgabe".
Ich habe zwar schon paar Lösungsansätze gefunden, aber entweder bekomme ich nicht das Ergebnis was ich will oder es funkt. nicht.
1. Gibt mir den Code der Seite im Body zurück, also nicht für TXT-Dateien geeignet
Dim oIE
Set oIE = WScript.CreateObject("InternetExplorer.Application")
oIE.menubar = 0 ' no menu
oIE.toolbar = 0
oIE.statusbar = 0
oIE.navigate="http://www.altavista.de/"
oIE.visible = 1
Do While (oIE.Busy)
Loop
wscript.echo oIE.document.body.innerHTML
2. Kopiert mir den Inhalt des Fensters in die Zwischenablage, so komme ich nicht an den Quellcode und außerdem ist mir die Möglichkeit unbekannt den Text wieder aus der Zwischenablage zu holen, würde sich aber auch für TXT-Dateien eignen
Dim oIE
Set oIE = WScript.CreateObject("InternetExplorer.Application")
oIE.menubar = 0 ' no menu
oIE.toolbar = 0
oIE.statusbar = 0
oIE.navigate="http://www.altavista.de/"
oIE.visible = 1
Do While (oIE.Busy)
Loop
oIE.ExecWB 17,2
oIE.ExecWB 12,2
oIE.ExecWB 18,2
3. ist perfect und funktiniert, ABER nur auf einen Rechner auf dem VBA installiert ist, bei mir auf Win98 mit nur WSH klappt es nicht ("kann das ActiveX Object nicht erstellen"). Ist übrigens JS und nicht VBS, tuts aber auch
/**
* Script: dlwebpage.js
* Purpose: Downloads the webpage specified by 'url'
* Author: Daren Thiel
* Date: 17 May 1999
*
* Note: Rename this script dlwebpage.js
*
* Copyright 1999 Daren Thiel
**/
// The URL to download
var url = "http://www.winscripter.com/index.html"
// Create instance of Inet Control
inet = new ActiveXObject("InetCtls.Inet");
// Set the timeout property
inet.RequestTimeOut = 20;
// Set the URL property of the control
inet.Url = url;
// Actually download the file
var s = inet.OpenURL();
// Show the raw HTML to the user
WScript.Echo( s );
// Bonus - Find the title of the page
// Regular expression to find the string stored between
// the title tags.
rtitle = /<title>(.*)<\/title>/i;
// Execute the regular expression on the raw HTML
var title = rtitle.exec( s );
// Display the result
WScript.Echo( RegExp.$1 );
mfg Slick