Page 1 of 3 123 LastLast
Results 1 to 10 of 30

Thread: How to launch a application with LUA script

  1. #1
    Join Date
    Sep 2004
    Posts
    3

    Default How to launch a application with LUA script

    Hello,

    ops: How to launch a application with LUA script

    Thanks

  2. #2
    Join Date
    Dec 2001
    Posts
    11,560

    Default

    execute ()

    See attached.

    Also see the lua systems function plugin
    Attached Files Attached Files

  3. #3
    Join Date
    Sep 2004
    Posts
    3

    Default

    :lol: Thanks for our reply Mike C, it's OK now

  4. #4
    Join Date
    Jul 2001
    Location
    Risør - Norway
    Posts
    5,305

    Default

    What if I want to send a parameter at the same time that needs " around it? I have tried these two:

    Code:
    execute("C:\\Windows\\notepad.exe" "d:\\test.txt" )
    
    execute("C:\\Windows\\notepad.exe .. "d:\\test.txt"" )
    But it didn't work. I tried different versions of the " placings, but they didn't help either. Any advice?
    Tor - managing director of the Cinema Inferno home theater and multi-zone sound system with Girder running the show in the back, NetRemote as the GUI and Media Center 17, PowerDVD and ZoomPlayer as playback software
    Hobsyssel mastiffs: http://www.hobsyssel.no

  5. #5
    Join Date
    Feb 2001
    Location
    Plano, TX, USA
    Posts
    3,055

    Default

    try:
    Code:
    execute("C:\\Windows\\notepad.exe d:\\test.txt" )
    or
    Code:
    execute("C:\\Windows\\notepad.exe".." ".."d:\\test.txt" )
    If either (or both) of the values are in variables, use one of these:
    Code:
    -- assume:
    -- executable = "C:\\Windows\\notepad.exe"
    -- parameters = "d:\\test.txt"
    
    execute("C:\\Windows\\notepad.exe "..parameters) 
    execute(executable.." d:\\test.txt") 
    execute(executable.." "..parameters)
    Please note that I have place a space between the executable and the parameters in each case.
    Mark F

  6. #6
    Join Date
    Feb 2001
    Location
    Plano, TX, USA
    Posts
    3,055

    Default

    After further review, I would use something like this:
    Code:
    execute( "start " .. ExecuteableAndParameters )
    The start command spawns the application to run asynchronously. This allows the CMD window to close and Girder to continue processing events prior to the application completing.

    If you use the stuff from my previous post, Girder will wait until notepad exits before processing any more events. If you use
    Code:
    execute( "start C:\\Windows\\notepad.exe d:\\test.txt" )
    or
    Code:
    execute( "start" .. " " .. "C:\\Windows\\notepad.exe" .. " " .. "d:\\test.txt" )
    or
    Code:
    -- assume: 
    -- executable = "C:\\Windows\\notepad.exe" 
    -- parameters = "d:\\test.txt" 
    
    execute( "start " .. "C:\\Windows\\notepad.exe " .. parameters ) 
    execute( "start " .. executable .. " d:\\test.txt" ) 
    execute( "start " .. executable .. " " .. parameters )
    Girder will continue to process events while notepad is running.
    Mark F

  7. #7
    Join Date
    Jul 2001
    Location
    Risør - Norway
    Posts
    5,305

    Default

    Talk about wizz! Thanks, Mark! I only needed this one for now:

    Code:
    execute( "start" .. " " .. "C:\\Windows\\notepad.exe" .. " " .. "d:\\test.txt" )
    And of course it works! :wink: I may find a good use for the parameter versions later, though. I'm about to clean up some home theater code. Thanks again!
    Tor - managing director of the Cinema Inferno home theater and multi-zone sound system with Girder running the show in the back, NetRemote as the GUI and Media Center 17, PowerDVD and ZoomPlayer as playback software
    Hobsyssel mastiffs: http://www.hobsyssel.no

  8. #8
    Join Date
    Jul 2001
    Location
    Risør - Norway
    Posts
    5,305

    Default

    Btw should we go even further? Is it possible to execute the file hidden? So I don't see that quick flash of a window when i fire it up. It may disturb what I'm watching on the screen.
    Tor - managing director of the Cinema Inferno home theater and multi-zone sound system with Girder running the show in the back, NetRemote as the GUI and Media Center 17, PowerDVD and ZoomPlayer as playback software
    Hobsyssel mastiffs: http://www.hobsyssel.no

  9. #9
    Join Date
    Feb 2001
    Location
    Plano, TX, USA
    Posts
    3,055

    Default

    The LAU execute() command does not support this. However, the Execute command on the Girder OS tab does.
    Mark F

  10. #10
    Join Date
    Jul 2001
    Location
    Risør - Norway
    Posts
    5,305

    Default

    Yes, I know. I was trying to tidy up so I didn't have to use two commands for each of these (there are a bunch of them), but as long as that's not possible, I'll have to use the Girder execute for the ones that are supposed to run while I'm watching anything.

    Btw I thought it worked with the "'s, but it didn't. The parameter isn't sendt the correct way. The parameter for this program (not notepad) needs to be sendt within "parameter", and I think it only sends it with the first " . Can this be right?
    Tor - managing director of the Cinema Inferno home theater and multi-zone sound system with Girder running the show in the back, NetRemote as the GUI and Media Center 17, PowerDVD and ZoomPlayer as playback software
    Hobsyssel mastiffs: http://www.hobsyssel.no

Posting Permissions

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