PDA

View Full Version : VB-Script aus ClientAccess



lossin
08-08-07, 14:43
Hallo @all,

ich versuche, aus der ClientAccess-Emu ein Macro aufzurufen das wiederum ein WindowsScripting-Programm Test.vbs aufruft.
Das funktioniert auch, nur mein Problem ist die Parameterübergabe.

autSystem.Shell "Test.vbs", "4711"

funktioniert, '4711' wird übergeben. Aber bei

dim Zeichen
Zeichen = "4711"
autSystem.Shell "Test.vbs", Zeichen

wird die Variable 'Zeichen' als Parameter nicht übergeben.
Das Programm Test.vbs erhält einfach keine Parameter
(Parameterzahl = 0) !

Kennt das Problem jemand und kann mir helfen ?

Vielen Dank im Voraus

Holger Lossin

TARASIK
08-08-07, 15:18
Hallo Holger,
ich glaube da hilft Dir dies weiter:

Problems with Playing a PC5250 Visual Basic Macro
Incident Summary

Problem Summary:
When playing a Visual Basic macro in PC5250, it terminates before the end of the script.

Resolution:
The IBM OS/400 command being called in the macro contained a double quotation mark ( " ) before the end of the script. Because a Visual Basic macro automatically places a double quotation mark ( " ) at the beginning and ending of the command, it was interpreting the double quotation mark ( " ) in the middle of the command as the end of script and terminating it. Record the macro as a Macro File rather than a VBScript file, or remove the parameter in the OS/400 command that contains the double quotation mark ( " ).

lossin
09-08-07, 09:42
Hallo,

danke für die Antwort. Die nützt mir aber leider nix.
Ich habe das Zielprogramm jetzt extra auch in einen
Parameter gesteckt, damit im eigentlichen Aufruf kein " steht :

dim Zeichen
dim Programm
Zeichen = "4711"
Programm = "Test.vbs"
autSystem.Shell Programm, Zeichen

Das Programm Test.vbs wird zwar aufgerufen, aber es wird
immer noch kein Parameter übergeben.

Holger

TARASIK
09-08-07, 10:19
Hallo Holger,
laut dem IBM Dokument muss es aber mit dem Parameter gehen:

Calling another Program from within VBScript Macro: PCOMM now supports starting an application file from within a
VBScript. To accomplish this a new automation object has been introduced. autSystem is the new object and Shell
is the new method.
The prototype is as follows:
function autSystem.Shell "ExeName",["Parameters"],[WindowStyle] as long
Parameters :
ExeName - String; the path and filename to the executable file.
Parameters - String, optional; any parameters you wish to pass on to
the application
WindowStyle - Integer, optional; the window style that you want the
application started as.
The valid values are:
AUTSYS_SHOW = 1 - show normal with focus
AUTSYS_SHOWMINIMIZED = 2 - show minimized with focus
AUTSYS_MAXIMIZE = 3 - show maximized
AUTSYS_SHOWNA = 4 - show normal without focus
AUTSYS_MINIMIZE = 5 - show minimized without focus
The default is AUTSYS_SHOW.
Return:
long - If the value is less than 32 it indicates an error has occured.
example: to run notepad from within a VBScript
autSystem.Shell "Notepad.exe", "c:\test.txt" , 1
This will start notepad with the file c:\test.txt loaded in a Normal window with focus.

lossin
09-08-07, 10:43
Hallo,

diese Info habe ich in dieser Form auch.
Und mit der direkten Parameterübergabe ohne Variablen funktioniert das ja auch wie beschrieben.
Aber halt nicht mit Variablen. Und wo ich den Return-Werte herkriegen soll weiß ich auch nicht.
Wenn ich sage
RetWert = autSystem.Shell Programm, Zeichen, 1
läuft der Script auf Fehler :
Anweisungsende erwartet

Den aktuellsten Servicepack für CA habe ich übrigens drauf.

Holger

Fuerchau
09-08-07, 13:15
Zuweisungen erfolgen als Funktion:

RetWert = autSystem.Shell(Programm, Zeichen, 1)