About Shell.Execute

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • qiuwen777
    Forum Member
    • Dec 2004
    • 5

    About Shell.Execute

    I want to register an OCX after install,so I write the script like that
    Shell.Execute("%SystemFolder%//regsvr32","OPEN","%AppFolder%//ocx//a.ocx")
    but it don't recognize the "%AppFolder%//ocx//a.ocx".because the %AppFoler% now is "c:\program files",
    so what can i do ?
    I tried using the sessionvar.expand,but I failed.

    best regard.
  • atrust
    Forum Member
    • Dec 2004
    • 12

    #2
    Variables have to be expanded first,

    I hope this would help.

    Comment

    • Adam
      Indigo Rose Staff Member
      • May 2000
      • 2149

      #3
      qiuwen777,

      Try something like this:

      RegSvr = SessionVar.Expand("%SystemFolder%\\regsvr32.exe");
      F_Name = SessionVar.Expand("%AppFolder%\\ocx\\a.ocx");

      Shell.Execute(RegSvr,"OPEN",F_Name);

      Or you can perform the expand option within the action like this:

      Shell.Execute(SessionVar.Expand("%SystemFolder%\\r egsvr32.exe"),"OPEN",SessionVar.Expand("%AppFolder %\\ocx\\a.ocx"));

      But I think the first method is more readable to the developer.

      Adam Kapilik

      Comment

      • qiuwen777
        Forum Member
        • Dec 2004
        • 5

        #4
        Adam

        I just tried like that

        RegSvr = SessionVar.Expand("%SystemFolder%\\regsvr32.exe");
        F_Name = SessionVar.Expand("%AppFolder%\\ocx\\a.ocx");

        Shell.Execute(RegSvr,"OPEN",F_Name);

        but error

        " Argument 3 must be of type string "

        so how to ?

        thank you.

        Comment

        • Adam
          Indigo Rose Staff Member
          • May 2000
          • 2149

          #5
          I just tested this exact code:

          RegSvr = SessionVar.Expand("%SystemFolder%\\regsvr32.exe");
          F_Name = SessionVar.Expand("%AppFolder%\\ocx\\a.ocx");

          Shell.Execute(RegSvr, "open", F_Name, "");

          And it seems to be calling regsvr32.exe properly.

          Adam Kapilik

          Comment

          • Ted Sullivan
            Indigo Rose Staff Member
            • Oct 2003
            • 963

            #6
            Yes - double check what you've typed there. If it still doesn't work, copy and paste the exact script here onto the forum so we can see what is going on.

            It sounds like a typo on your side.
            New Release: Setup Factory 9.6 adds Windows 11 compatibility and support for hardware token OV/EV Code Signing certificates.

            Comment

            • qiuwen777
              Forum Member
              • Dec 2004
              • 5

              #7
              I'm sorry to bother you again.but it still don't work properly.So I came here again.

              I have checked my script again,and just use Adam's code.

              RegSvr = SessionVar.Expand("%SystemFolder%\\regsvr32.exe");
              F_Name = SessionVar.Expand("%AppFolder%\\CoolButton.ocx");

              Shell.Execute(RegSvr,"OPEN",F_Name);

              There ,F_Name is "C:\Program Files\CoolButton.ocx",

              when Regsvr32 are registering, an error occured,because regsvr32 can't find the properly module "c:\program"

              I guest maybe F_NAME contain a blank char,that it isn't recognized properly,
              so I just use the Code like below

              Shell.Execute(RegSvr,"OPEN","C:\Program Files\CoolButton.ocx");

              The same error occured.

              thank you .Wish to get your help.

              PS,my OS is WinXp Pro(Simplified Chinese).

              Comment

              • Ted Sullivan
                Indigo Rose Staff Member
                • Oct 2003
                • 963

                #8
                Try this line instead:

                Shell.Execute(RegSvr,"OPEN","C:\\Program Files\\CoolButton.ocx");
                New Release: Setup Factory 9.6 adds Windows 11 compatibility and support for hardware token OV/EV Code Signing certificates.

                Comment

                • qiuwen777
                  Forum Member
                  • Dec 2004
                  • 5

                  #9
                  I just used again.

                  Failed again.

                  Comment

                  • Waza04
                    Forum Member
                    • Jun 2004
                    • 31

                    #10
                    Originally posted by qiuwen777
                    I just used again.

                    Failed again.
                    Can't you use Setup Factory's internal action of "Register DLL"? It should work with OCX's too...

                    Comment

                    • qiuwen777
                      Forum Member
                      • Dec 2004
                      • 5

                      #11
                      Originally posted by Waza04
                      Can't you use Setup Factory's internal action of "Register DLL"? It should work with OCX's too...
                      I can't do that like what you said,because the ocx file is dependent on other files.

                      Comment

                      Working...
                      X