Results 1 to 3 of 3

Thread: running vbscript code without cmd console popping up

  1. #1
    Member
    Join Date
    Aug 2013
    Location
    United Kingdom
    Posts
    48

    running vbscript code without cmd console popping up

    In my quest to gather USB stick drive serial number have come across vbscript code that I can run from python. when I run the code however, the popup is displayed and not desirable for the needed implementation. Have gone ahead and changed the vbscript into and exe and to run in silent mode without the pop, but running this within lianja still pops up window. Please check if silent mode is available overall.

    action: a button click action in a custom python gadget.

  2. #2
    Lianja Team yvonne.milne's Avatar
    Join Date
    Feb 2012
    Location
    Berkshire, UK
    Posts
    1,843
    Hi Cox,

    This worked for me, without displaying a window:


    gadget1.py

    Code:
    #
    # Lianja custom python gadget "gadget1"
    #
    import Lianja
    import subprocess 
    #---------------------------------------------------------------------------
    # Define the class we need to handle the button click event
    class MyButton(Lianja.Commandbutton):      
        def click(self):
        	subprocess.call("wscript.exe C:\Temp\writetofile.vbs")
    #---------------------------------------------------------------------------
    # Create the gadget and add in the controls
    gadget1_gadget = Lianja.createObject("gadget1_gadget", "gadget")
    gadget1_gadget.addobject("mybutton", "MyButton")
    mybutton.caption = "Click me!"
    #---------------------------------------------------------------------------
    # Return the gadget to Lianja
    
    returnvalue = gadget1_gadget
    Regards,

    Yvonne

  3. #3
    Member
    Join Date
    Aug 2013
    Location
    United Kingdom
    Posts
    48
    Thanks, that sort it.

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Journey into the Cloud
Join us