View Full Version : Problems trying to run a file?
nitro
08-08-2009, 11:37 PM
I'm making a launcher program, I'm almost done, but I've run into a problem,
I can't make my AMS program run a .exe file in the same directory as the project executable
EXAMPLE:
project.exe is in C:\Program (C:\Program\project.exe)
I want my project to run start.exe which is also in C:\Program (C:\Program\start.exe)
I can't set it to
result = File.Run("C:\\Program\\start.exe", "", _SourceFolder, SW_SHOWNORMAL, false);
Because I want to give my project executable to a friend, and I don't know where his "Program" folder will be...
Imagine Programming
08-09-2009, 07:41 AM
So start.exe is in the project.exe folder and is not a webexe?
result = File.Run(_SourceFolder.."\\start.exe", "", _SourceFolder, SW_SHOWNORMAL, false);
nitro
08-11-2009, 09:54 PM
Wow, you just made me feel stupid :D
But i'm happy that someone can help :D
nitro
08-11-2009, 10:30 PM
Nevermind...
I tried the code,, but it didn't work, I put the code into the launcher buttons "On Click" Script tab, Saved, and clicked the "Build" button and made an EXE, I tested it, and NOTHING HAPPEND D:
Have you tried using Shell.Execute instead and are you having the same issues?
longedge
08-12-2009, 01:30 AM
The sourcefolder for .exe's is not the folder where the .exe is held.
Put "start.exe" inside the docs folder of "project.exe" and then run it from there.
nitro
08-12-2009, 09:25 PM
I cannot do that because start.exe needs some files (VERY LARGE FILES) to run.
so I want my friend to be able to copy project.exe to his folder that has start.exe in it, execute project.exe, and click a button to run start.exe
(DO NOT ask me "Why do you need this? just click start.exe normally! No need for a launcher!" I am making this launcher with some extras and things AND an options to run start.exe)
nitro
08-21-2009, 11:16 PM
Replys Anyone?
ShadowUK
08-22-2009, 02:13 AM
Did you export as a Web EXE?
Centauri Soldier
08-22-2009, 02:53 AM
Use the GlobalPaths plugin (in my signature). You can read the details of it in that topic. It will solve your path problem.
nitro
08-25-2009, 10:11 PM
I just looked at the topic, I haven't tried it yet, but it looks like it should work!
Thank you very much! (I'll post some more thanks if it actually works!)
nitro
08-29-2009, 03:24 PM
It didn't work.
Can you gvie me the code I should use for this plugin on the "On click" for my "START" button?
(In the code, I want to use _ExeFolder and the file name should be start.exe)
mystica
08-29-2009, 03:37 PM
Try posting the .APZ file (without the .EXE you're having trouble with, and without all the additional files you want to pack in ... in other words, just the barebones launcher you're trying to build).
That way, we can see exactly what you're having problems with, and can probably post it back with a "dummy EXE" to show you how/where to place the files you're having trouble with.
mystica
08-29-2009, 03:57 PM
In the meantime, try this ... because I have a feeling the others may have been misinterpreting exactly what you're trying to do:
result = File.Run(_ProgramFilesFolder .. "\\start.exe", "", "", SW_SHOWNORMAL, false);
The _ProgramFilesFolder command is a relative path, which should solve the problem you have with not knowing the location of the target-computer's Program folder.
In this example, I've just concatenated it straight to the start.exe. So it will only work, if the start.exe is in the root of the target-computer's Program Folder.
(ie. C:/Program Files/start.exe).
If however, you find that the start.exe is located in a subfolder of it own (ie. C:/Program Files/Nitro/start.exe), then you'll have to adjust it accordingly ... or if this remains as an unknown variable, then you'll have to add a File.Find or Folder.Find command beforehand, so that your AMS launcher will know where to find the start.exe.
Powered by vBulletin™ Version 4.0.6 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.