No announcement yet.

Launch Application via script

  • Filter
  • Time
  • Show
Clear All
new posts

    Launch Application via script

    Is there a way to Launch a application and then Pass the parameters to it in a SCRIPT rather than using the launch ap feature?

    program to Launch:

    C:\Program Files\AutoMate 5\SpawnTask.exe


    "C:\Program Files\AutoMate 5\Solon Tasks\on.aml"

    I was able to launch the aplication by doing this;
    sub main()

    hs.Launch "C:\Program Files\AutoMate 5\SpawnTask.exe","C:\Program Files\AutoMate 5\Solon Tasks\on.aml"

    end sub

    But now it starts the program but cant pass the parameter to it cause the space between the word program Files it stops at and says it cant find it. Is there something I can place in there?

    C:\Program Files


      Jon. I tried to anwer this post earlier. But for the life of me couldn't get it to work here. Like an A@% I forgot about hs. . Was just using the command launch and not hs.launch. DUHHHHHH


        try that?


          Nope that didnot work either. For some reason the name is passed but not the parameter. It seems not to want a space . I even tried %20 and that didnt work either.


            try renaming everything to NOT have spaces.


              Nope that does not work either...


                Two things noramlly affect this and both were polked at above. Your spawntask.exe may be a dos program that was written for only 8.3 name conventions or has a dumb parser for the parameter and stops at the first space. Sometimes using the tranform that includes the ~ will get past it, but it assumes the application will recognize this convention. If the application uses Windows file system methods it will work. It it does its own parsing then it will not.

                The second is the argument passing itself. Your objective is to pass the entire parameter as a string so that it will not look like a space-separated parameter list. The scripting arg object will treat spaces as delimeters, but if the entire thing is enclosed in quotes then it will be a single parameter.

                Const q = chr(34)
                hs.Launch "C:\Program Files\AutoMate 5\SpawnTask.exe", q & "C:\Program Files\AutoMate 5\Solon Tasks\on.aml" & q

                Another approach using Wscript rather than hs is

                Set oShell = CreateObject("Wscript.Shell")
                oShell.Run "C:\Program Files\AutoMate 5\SpawnTask.exe" & " " & q & "C:\Program Files\AutoMate 5\Solon Tasks\on.aml" & q, false
                set oShell = Nothing


                  No these created errors and would not run,

                  With the hs.launch , at least it runs the spawntask.exe but loses the parameter when it cant pass the EMPTY SPACE.


                    I saved a copy in the c:\ drive then re wrote it like this and it then worked.
                    sub main()

                    hs.launch "C:\Program Files\AutoMate 5\SpawnTask.exe","C:\on.aml"

                    end sub

                    So its defently the space thats causing the problem


                      If anyone runs into any way of knowing how to read the spaces, please tell us.. thanks


                        I thought some of you may want to know that I found the answer to this question I had;

                        The parameter sent to the launch required that in be in double quotes to see the spaces, so below is how I did this.
                        sub main()

                        hs.launch "C:\Program Files\AutoMate 5\SpawnTask.exe", """C:\Program Files\AutoMate 5\Solon Tasks\on.aml"""

                        end sub



                          Ascii Values

                          It's been a while from my old Commodore 64 and sub$ stuff, but isnt Chr(34) a quote? 32 is a space if I am not mistaking. Of course I im so full of triptophene from the mass quantities of Thanksgiving turkey today, That I may just be delerious

                          I thing it should be:
                          Const q = chr(32)

                          Aha! Just remembered how to test it Open Notepad (Or just about anytying you can type in for that matter ", yep works typing here as well "), hold down the alt key and type 32 on the numeric pad and then release the alt key. This is a quick shortcut to insert ascii characters into a document. 34 is definately a quote, and 32 is a space.
                          Visit My Home Seer Site at:
                          Created with LCARS