Announcement

Collapse
No announcement yet.

Launch Application via script

Collapse
X
 
  • 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

    parameters:

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

    #2
    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

    Comment


      #3
      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

      Comment


        #4
        c:\progra~1
        try that?

        Comment


          #5
          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.

          Comment


            #6
            try renaming everything to NOT have spaces.

            Comment


              #7
              Nope that does not work either...

              Comment


                #8
                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

                Comment


                  #9
                  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.

                  Comment


                    #10
                    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

                    Comment


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

                      Comment


                        #12
                        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

                        ---------------------

                        Comment


                          #13
                          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:
                          www.JohnWPB.com
                          Created with LCARS

                          Comment

                          Working...
                          X