VBscript und win98/win2k scripting Host?

Hallo,
ich habe im Outlook Brett eine Antwort in Form eines VBscripts bekommen (siehe http://www.wer-weiss-was.de/cgi-bin/forum/showarticl…). Nun ist aber mein Problem, dass es laut angaben eines Freundes unter Win2000 wunderbar zu funktionieren scheint, nur bei mir, auf einer Win98se installation, bringt es einen ‚Kompilierungsfehler‘ in Line 3 Char 15 (Anweisungsende erwartet). Leider kenne ich mich nun überhaupt nicht mit VBscript aus. Brauche ich für Win98 irgend ein Update des Scripting Host? Wo kann ich soetwas finden, oder woran liegt der Fehler? Vielen Dank im vorraus…

Hallo,

ich kenne mich mit Win98 nicht gut aus, aber soweit ich weiss, hat Win98 im Gegensatz zu Win95/NT den Script Host schon standardmaessig dabei. Ueberpruefen kann man dies -glaube ich zumindestens- unter "Start/Settings/Control Panel/Add Remove Programs/Windows Setup oder so aehnlich auf deutsch. Da muss dann beim Windows Scripting Host die CheckBox aktiviert sein. Ansonsten muss man ihn nachinstallieren aber unwahrscheinlich, da der Internet Explorer es ohnehin macht.

Weitere Infos findest Du unter:
http://www.msdn.microsoft.com/scripting/

Die aktuelle Version von WSH ist 5.1 bzw. 5.5. Version 5.6 laesst signierte Scripte zu ist aber buggy. WSH installiert wscript.exe, cscript.exe sowie vbscript.dll und jscript.dll auf deinem System. Ansonsten sehe ich keinen Fehler im Posting von „Maze“. Vielleicht ein Tippfehler deinerseits…???

CU

Hi,
danke für die Hilfe,
also WSH war schon da, weiss nur nicht welche version. Darum habe ich nun mal die WSH v5.5 installiert aber es bleibt das selbe Problem. Tippfehler hab auch keine weil per copy & paste übernommen. Nunja, ich werd mal noch etwas rumstöbern vielleicht findet sich ja noch irgendwo der Hinweis das definitiv bestimmte Script Befehle nur bei/ab Win2k gehen?! Kann es mir momentan nicht anders erklären :frowning:
so long

ich kenne mich mit Win98 nicht gut aus, aber soweit ich weiss,
hat Win98 im Gegensatz zu Win95/NT den Script Host schon
standardmaessig dabei. Ueberpruefen kann man dies -glaube ich
zumindestens- unter "Start/Settings/Control Panel/Add Remove
Programs/Windows Setup oder so aehnlich auf deutsch. Da muss
dann beim Windows Scripting Host die CheckBox aktiviert sein.
Ansonsten muss man ihn nachinstallieren aber unwahrscheinlich,
da der Internet Explorer es ohnehin macht.

Weitere Infos findest Du unter:
http://www.msdn.microsoft.com/scripting/

Die aktuelle Version von WSH ist 5.1 bzw. 5.5. Version 5.6
laesst signierte Scripte zu ist aber buggy. WSH installiert
wscript.exe, cscript.exe sowie vbscript.dll und jscript.dll
auf deinem System. Ansonsten sehe ich keinen Fehler im Posting
von „Maze“. Vielleicht ein Tippfehler deinerseits…???

CU

Hallo,

hab nochmal nachgeschaut. Ersetze mal als Probe:

Dim myOlApp As New Outlook.Application

durch folgendes:

Dim myOlApp As Outlook.Application
Set myOlApp = New Outlook.Application

BEGRUENDUNG:

When you manipulate Outlook objects, you always start with the Application object. If you are using VBA in Outlook, there is a reference to the Outlook object library set by default. If you are using Automation to work with Outlook objects from another application, you must first set a reference to the Outlook 9.0 object library by using the References dialog box in the application you are working from. If you have set a reference to the Outlook 9.0 object library, you create a new instance of an Outlook Application object by using the New keyword as follows:

Dim olApp As Outlook.Application

Set olApp = New Outlook.Application

If you have not set a reference to the Outlook 9.0 object library, you must use the CreateObject function. There can only be one instance of Outlook available at one time. Therefore, when Outlook is not running, the New keyword (or the CreateObject function) creates a new, hidden, instance of Outlook. If an instance of Outlook is already running, then using the New keyword (or the CreateObject function) returns a reference to the running instance.

CIAO

Hi,
will leider immernoch nicht.
Es kommt weiterhin die Fehlermeldung:

Line: 3
Char: 3
Error: Anweisungsende erwartet
Source: Kompilierungsfehler in Microsoft VBScript

Zeile 3 und Zeichen 3 ist genau nach Dim myOlApp
aus Dim myOlApp As New Outlook.Applicationn

… nunja ich bin ja eingentlich gerade dabei mir etwas Java (so richtiges Java) anzeignen, darum werd ich das erstmal ruhen lassen (nicht tiefer erforschen) aber werde alle Tips ausprobieren wenn noch welche kommen sollten :smile:

regards

hab nochmal nachgeschaut. Ersetze mal als Probe:

Dim myOlApp As New Outlook.Application

durch folgendes:

Dim myOlApp As Outlook.Application
Set myOlApp = New Outlook.Application

Ok,

vielleicht werde ich auch noch was finden. Bin mit meinem Latein auch am Ende erstmal. In Deinem ersten Posting heisst es aber Line 3 Char 15 und jetzt Line 3 Char 3. Was denn nur genau??? Vielleicht doch ein Fluechtigkeitsfehler ???

BYE

Hallo nochmal,

so…nun musste ich es selbst nochmal ausprobieren und eigentlich habe ich es auch schon erwähnt.

Statt:

Dim myOlApp As New Outlook.Application

muss es natuerlich heissen:

Dim myOlApp
Set myOlApp = CreateObject(„Outlook.Application“)

CU

ich hab nun in der nächsten Zeile wieder bei dem ‚As‘ den selben Fehler… habe nun alle folgenden Zeile auf die Art umgeändert und bin nun schon bis zur Zeile 30 Fehlerfrei was die Kompilierung angeht. Ob es so funktionier - keine Ahung :o)

Sub test_Attach2()

Dim myOlApp
Set myOlApp = CreateObject(„Outlook.Application“)
Dim myOlExp
Set myOlExp = CreateObject(„Outlook.Explorer“)
Dim myOlSel
Set myOlSel = CreateObject(„Outlook.Selection“)
Dim myItem
Set myOlSel = CreateObject(„MailItem“)
Dim a
Set a = CreateObject(„Attachment“)

Dim MsgTxt
Set MsgTxt = CreateObject(„String“)
Dim MsgTxt2
Set MsgTxt2 = CreateObject(„String“)

MsgTxt = „You have selected items from“ & Chr(13) & Chr(13)
MsgTxt2 = „You have selected attachements“ & Chr(13) & Chr(13)
Set myOlExp = myOlApp.ActiveExplorer
Set myOlSel = myOlExp.Selection
For x = 1 To myOlSel.Count
'Set myItem = myOlSel.Item(x)
MsgTxt = MsgTxt & myOlSel.Item(x).SenderName & Chr(13)
For i = 1 To myOlSel.Item(x).Attachments.Count
Set a = myOlSel.Item(x).Attachments(i)
MsgTxt2 = MsgTxt2 & a.DisplayName & Chr(13)
a.SaveAsFile „C:\Eigene Dateien\Eigene Bilder“ & a.DisplayName
Next i
Next x
MsgBox MsgTxt
MsgBox MsgTxt2

End Sub

Also nun ist der Fehler das WSH ein ‚Anweisungsende‘ hinter dem ‚Next i‘ erwartet ! Gibt es vielleicht noch andere Methoden so ein wsh script zu kompilieren wo der ursprüngliche Code vielleicht geht? Kann mir ja nicht vorstellen das der so falsch sein sollte.
so long

Statt:

Dim myOlApp As New Outlook.Application

muss es natuerlich heissen:

Dim myOlApp
Set myOlApp = CreateObject(„Outlook.Application“)

CU