Results 1 to 2 of 2
  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2018

    VBScript Promblem with using wscript.shell

    Hello everyone
    i am using a software name MCPS. and there is a possibility to write a script in this program. the scripts from this program contains the extension .mbs and not .vbs
    creating wscript object doesn't make a problem but when using there commands for example the name of file or directory ..etc
    i come with this error:
    wscript is not defined
    so is there any way that i can call or get this object
    for example when use :
    Set objXL = GetObject(,"Excel.Application")
    its working . i have tried to GetObject(,"WScript.shell") but it giving me another error related to activeX error activex component can't create object
    please help. thanks
    the script is :

    Option Explicit

    '******************** Deklarationen ********************
    DIM Main_Fenster 'the main window variable
    DIM Run_Window 'Main Window
    DIM SType ' Varialbe to store the script call type : 6 First run and 3 for Scan while scaning
    DIM Text1 'Main window name Text
    DIM Text2 ' Abluf Box selection Text name
    DIM SelBoxAblauf 'selection Box for choosing the Abluaf of the Measurment
    DIM SelBoxAblauf_Value 'Selectoin Box value for Ablauf
    DIM Text3 'Database path show
    DIM Project_Path
    DIM DatabasePath_Default
    DIM DatabasePath_Default_Help
    DIM DatabasePath_Default_Help_Open
    DIM SystmeObject
    DIM SystmeObject2
    DIM i
    '******************** Paramete_Init *********************

    '******************** Main_Start *********************
    SType = MCPS.GetScriptType 'to know why the script is call. first run or normal scan
    call Get_Value_Window

    '******************** Startfenster *********************
    Sub Get_Value_Window
    Main_Fenster=MCPS.DialogCreate("Druck Kalibrierung Flucke 6270A",1000,800,0) 'name of the dialoge and size of it
    Text1 = MCPS.DialogAddText(Main_Fenster,"Druckkalibrierung mit Flucke 6270A",400,5,250,25,4096)

    'Database Path to show and get
    call DatabasePathSub
    Text3 = MCPS.DialogAddText(Main_Fenster,DatabasePath_Default,50,80,300,25,0)
    'Ablauf Text Selection Box
    Text2 = MCPS.DialogAddText(Main_Fenster,"Abluaf",50,10,60,25,0)
    SelBoxAblauf = MCPS.DialogAddSelection(Main_Fenster,50,30,60,25,0)
    SelBoxAblauf_Value = MCPS.DialogAddSelectionString(Main_Fenster,SelBoxAblauf,"A")
    SelBoxAblauf_Value = MCPS.DialogAddSelectionString(Main_Fenster,SelBoxAblauf,"B")
    SelBoxAblauf_Value = MCPS.DialogAddSelectionString(Main_Fenster,SelBoxAblauf,"C")
    SelBoxAblauf_Value = MCPS.DialogAddSelectionString(Main_Fenster,SelBoxAblauf,"Benutzer")
    'End from Abluf Text Selection Box

    Run_Window=MCPS.DialogRun(Main_Fenster) 'to wait for the answere of the user
    End Sub

    Sub DatabasePathSub
    Set SystmeObject = CreateObject("WScript.shell")
    DatabasePath_Default_Help = Left(WScript.ScriptFullname,(Len(WScript.ScriptFullname))-(Len(WScript.ScriptName)))
    DatabasePath_Default_Help = DatabasePath_Default_Help&"Flucke6270AskriptDatabasePath.txt"
    End Sub

  2. #2
    New Member
    Join Date
    Apr 2018

    Re: VBScript Promblem with using wscript.shell

    Hey.. let me see if I understand...

    Fisrt Try:
    Option Explicit
    ' Option Explicit

    Second Try:
    I think this error will occur when you not define the variable when you type on the very beginning of code, or function of subroutine the code: Option Explicit...
    to make this right you must declare the variables.
    ... Dim variable ....

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts


Click Here to Expand Forum to Full Width

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.