Announcement

Collapse
No announcement yet.

How to run exe file from registry path

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to run exe file from registry path

    I use Autoplay media studio vesrion 7.5 and i have add button, and i want to know what is script code to run exe file from registry,
    this is what i do:

    OnShow... if Registry.GetValueNames(HKEY_LOCAL_MACHINE, "Software\\test\\test2", "Myapp.exe", true)then
    Button.SetVisible("Button2", true);
    end;
    This is work, but how to run the exe file "Myapp.exe" when i click button.
    i need to run "Myapp.exe" when value exist in registry.

    I need help please.

    Sorry bad english.

    Thanks @Cybergraph for reply
    Now I realize how is work, i try very much scripts code line and i found what i need, is very simple..the code found is: On Click (section of the button)
    Path = Registry.GetValue(HKEY_LOCAL_MACHINE, "Software\\test\\test2", "execPath", true);
    File.Run (Path, "Myapp.exe");
    I can now install the files where I want and the "Myapp.exe" is detected and can be run by button click
    Last edited by florin2020; 07-13-2010, 01:17 PM.

  • #2
    OnShow... if Registry.GetValueNames(HKEY_LOCAL_MACHINE, "Software\\test\\test2", "Myapp.exe", true)then
    Button.SetVisible("Button2", true);
    end;

    On Click (section of the button)
    Shell.Execute ("Myapp.exe", "open", "", "", SW_SHOWNORMAL, false);

    Or, if you want to run your app without clicking the button, you can insert the Shell.Execute code before the "end" of your code.

    You could also store the complete path of Myapp.exe in the registry key, then retrieve it and store in a variable that will substitute "Myapp.exe" in the Shell.Execute code.

    Please read carefully AMS help file, this things are very simple stuff that can be found easily.
    We are slowly invading your planet to teach lazy humans to read the user manual.
    But don't be scared: we are here to help.

    Comment


    • #3
      i use On Click (section of the button)
      Path = Registry.GetValue(HKEY_LOCAL_MACHINE, "Software\\test\\test2", "execPath", true);
      File.Run (Path, "Myapp.exe");
      but Myapp.exe is crash, when i open Myapp.exe directly ( double click ) its open without crashing.
      Where im wrong? :-(

      Comment


      • #4
        Which is exactly the content of the "execPath"?
        We are slowly invading your planet to teach lazy humans to read the user manual.
        But don't be scared: we are here to help.

        Comment


        • #5
          execPath E:\test\test2\Myapp.exe

          Comment


          • #6
            Because "execPath" already contains "Myapp.exe", use:

            File.Run (Path, "", "", SW_SHOWNORMAL, false); (set other parameters as you need)

            In your example File.Run (Path, "Myapp.exe"); you were passeing the "Myapp.exe" as a command line argument to your app (by this, probably it crashed).
            We are slowly invading your planet to teach lazy humans to read the user manual.
            But don't be scared: we are here to help.

            Comment


            • #7
              i use your code
              File.Run (Path, "", "", SW_SHOWNORMAL, false);
              but no luck...to be exactly i try to run game executable file...I tried many codes with same result (error)
              I do not know what to do :-(

              Comment


              • #8
                Have you tried with E:\\test\\test2\\Myapp.exe ?

                Exactly, which is the error?
                We are slowly invading your planet to teach lazy humans to read the user manual.
                But don't be scared: we are here to help.

                Comment


                • #9
                  i have installer and when i use installer to install...exemple like game...and the installer set the value in the registry to path the folder installation and path to file executable, i want to use the registry to detect where is installed the game and executable to run by button play from autorun, i want to be able to run file wherever is installed the game for exemple.

                  i cut only the error message and i painted the title of game...this is the error from this executable...but each executable have different error.
                  i forgot to say , i have windows vista x64.
                  Last edited by florin2020; 08-24-2010, 03:15 PM.

                  Comment


                  • #10
                    To verify which path is passed to your app, have you tried to put a label in your program like this:

                    Label.SetText ("Label1", Path);

                    so you can check if the path retrieved from registry to your app is correct.
                    We are slowly invading your planet to teach lazy humans to read the user manual.
                    But don't be scared: we are here to help.

                    Comment


                    • #11
                      please give me the exactly code or make a project for test and tell me if you did to run file exe from registry without error.
                      i have tried (file.Run)...(file.Open)...(Shell.Execute)... but no luck

                      Comment


                      • #12
                        Originally posted by florin2020 View Post
                        i have installer and when i use installer to install...exemple like game...and the installer set the value in the registry to path the folder installation and path to file executable, i want to use the registry to detect where is installed the game and executable to run by button play from autorun, i want to be able to run file wherever is installed the game for exemple.

                        i cut only the error message and i painted the title of game...this is the error from this executable...but each executable have different error.
                        i forgot to say , i have windows vista x64.
                        I work on XP sp3, I don't know if this could make a difference in registry management.
                        It seems to me, looking to the error image you sent, that the problem is not that the program can not be found using the path from the registry, but seems that the program has problem finding one of his components ("fileSysCheck.cfg" in this case).
                        Try to insert the working folder like this:
                        File.Run (Path, "", "E:\\test\\test2\\", SW_SHOWNORMAL, false);

                        Take in mind that File.Run may fail to launch a program under Vista (check the help file on this) - try using Shell.Execute instead.
                        We are slowly invading your planet to teach lazy humans to read the user manual.
                        But don't be scared: we are here to help.

                        Comment


                        • #13
                          Finally...i have done..the problem was a simple script to do that...
                          Path = Registry.GetValue(HKEY_LOCAL_MACHINE, "Software\\test\\test2", "EXEStringS", true);
                          folder = Registry.GetValue(HKEY_LOCAL_MACHINE, "Software\\test\\test2", "InstallPath", true);
                          File.Run(Path, "", folder, SW_SHOWNORMAL, false);
                          folder = Registry.GetValue(HKEY_LOCAL_MACHINE, "Software\\test\\test2", "InstallPath", true); is the workingFolder :-)
                          @Cybergraph Thank you very much for tried to help me with this, I appreciate your help very much.
                          Last edited by florin2020; 08-24-2010, 04:10 PM.

                          Comment


                          • #14
                            Glad to have helped you.
                            We are slowly invading your planet to teach lazy humans to read the user manual.
                            But don't be scared: we are here to help.

                            Comment

                            Working...
                            X