SoftTree Technologies SoftTree Technologies
Technical Support Forums
RegisterSearchFAQMemberlistUsergroupsLog in
vbs script and wsh script

 
Reply to topic    SoftTree Technologies Forum Index » 24x7 Scheduler, Event Server, Automation Suite View previous topic
View next topic
vbs script and wsh script
Author Message
Romain



Joined: 02 Dec 2005
Posts: 4

Post vbs script and wsh script Reply with quote

Your product can executing vbs script but the windows script host don't works....... why ?

By example the function "wscript.quit(0)" don't works...

A solution to this problem (Without executing a file wsh external) ? Thanks you for your help

Romain (french)

Fri Dec 02, 2005 11:12 am View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7970

Post Re: vbs script and wsh script Reply with quote

Because it does not use wscript. Quit(0) does not make sense in this context as the script runs inside 24x7 scheduler process. There is nothing to quit, it is simply not needed.

In case if you want to abort your script run before the script end use simple VBScript's return statement.

Sub Main
... your code here
return
... your code here
End Sub

: Your product can executing vbs script but the windows script host don't
: works....... why ?

: By example the function "wscript.quit(0)" don't works...

: A solution to this problem (Without executing a file wsh external) ? Thanks
: you for your help

: Romain (french)

Fri Dec 02, 2005 1:42 pm View user's profile Send private message
Romain



Joined: 02 Dec 2005
Posts: 4

Post Re: vbs script and wsh script Reply with quote

It is difficult to convert a script wsh in script vbs?

By example :
"Option Explicit

WScript.Echo "Votre premier script !"

' Récupération de la ligne de commande
Dim Argument
If WScript.Arguments.Unnamed.Length>0 Then

Argument = WScript.Arguments.Unnamed.Item(0)
Else

Argument = ""
End If

Dim s, mess

' Si on est en mode de ligne de commande
If InStr(1,WSCript.FullName, "cscript") > 0 Then

WScript.StdOut.WriteLine "Entrez un message d'exemple..."

s = WScript.StdIn.ReadLine
Else

' boîte de dialogue de saisie

s = InputBox ("Entrez un message d'exemple...", "Exemple VB Script", Argument)
End if

If s = "" Then 'Si Reponse vide = Saisie vide ou clic sur Annuler

mess = "Désolé, vous avez annulé cette action : Fin du programme."

WScript.Echo mess
Else

mess = "Voici le texte que vous avez saisi :" & vbCrLf & s & vbCrLf & "Voulez-vous maintenant connaître la version de WSH ?"

Dim Reponse

Dim oShell

Set oShell = WScript.CreateObject("WScript.Shell")

Reponse = oShell.Popup (mess, 10, "Exemple VB Script", vbYesNo + vbQuestion + vbDefaultButton1)

If Reponse = vbYes Then

' Récupération de la version de VB6

s = ScriptEngine & " Version "

s = s & ScriptEngineMajorVersion & "."

s = s & ScriptEngineMinorVersion & "."

s = s & ScriptEngineBuildVersion

WScript.Echo s

End If
End if"


Sun Dec 04, 2005 6:02 am View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7970

Post Re: vbs script and wsh script Reply with quote

This script is not suitable for automated unattended runs because it requires interactive user input.

Am I missing something here? What are you trying to automate?

: It is difficult to convert a script wsh in script vbs?

: By example : "Option Explicit

: WScript.Echo "Votre premier script !"

: ' Récupération de la ligne de commande
: Dim Argument
: If WScript.Arguments.Unnamed.Length>0 Then

: Argument = WScript.Arguments.Unnamed.Item(0)
: Else

: Argument = ""
: End If

: Dim s, mess

: ' Si on est en mode de ligne de commande
: If InStr(1,WSCript.FullName, "cscript") > 0 Then

: WScript.StdOut.WriteLine "Entrez un message d'exemple..."

: s = WScript.StdIn.ReadLine
: Else

: ' boîte de dialogue de saisie

: s = InputBox ("Entrez un message d'exemple...", "Exemple VB
: Script", Argument)
: End if

: If s = "" Then 'Si Reponse vide = Saisie vide ou clic sur Annuler

: mess = "Désolé, vous avez annulé cette action : Fin du programme."

: WScript.Echo mess
: Else

: mess = "Voici le texte que vous avez saisi :" & vbCrLf & s
: & vbCrLf & "Voulez-vous maintenant connaître la version de
: WSH ?"

: Dim Reponse

: Dim oShell

: Set oShell = WScript.CreateObject("WScript.Shell")

: Reponse = oShell.Popup (mess, 10, "Exemple VB Script", vbYesNo +
: vbQuestion + vbDefaultButton1)

: If Reponse = vbYes Then

: ' Récupération de la version de VB6

: s = ScriptEngine & " Version "

: s = s & ScriptEngineMajorVersion & "."

: s = s & ScriptEngineMinorVersion & "."

: s = s & ScriptEngineBuildVersion

: WScript.Echo s

: End If
: End if"

Sun Dec 04, 2005 12:59 pm View user's profile Send private message
Display posts from previous:    
Reply to topic    SoftTree Technologies Forum Index » 24x7 Scheduler, Event Server, Automation Suite All times are GMT - 4 Hours
Page 1 of 1

 
Jump to: 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


 

 

Powered by phpBB © 2001, 2005 phpBB Group
Design by Freestyle XL / Flowers Online.