how to pass commandline arguments when running program?

This forum is user-to-user based and not regularly monitored by IDM.
Please see the note at the top of this page on how to contact IDM.

how to pass commandline arguments when running program?

Postby strawberry » Thu Nov 17, 2005 7:33 pm

Hi all,

I was wondering if there is a way to pass some arguments when running a program. I have tried to modified the "command line arguments" option in the compile options from xxx.exe to xxx.exe arg1 arg2. But it won't work.

Is it not the correct option I should setup or it is due to a bug from uestudio? :(
User avatar
strawberry
Newbie
 
Posts: 1
Joined: Thu Nov 17, 2005 12:00 am

Re: how to pass commandline arguments when running program?

Postby bobh » Sat Nov 19, 2005 4:56 pm

That is the correct way to do it. Are any of the command-line arguments paths or filenames containing spaces? If so, you need to put quotes around them.

Which compiler are you using?
User avatar
bobh
Advanced User
Advanced User
 
Posts: 59
Joined: Tue Dec 28, 2004 12:00 am

Re: how to pass commandline arguments when running program?

Postby strawberry » Sun Nov 20, 2005 11:49 pm

The compiler I used is Cygwin gcc. Anything wrong with this compiler?
strawberry
 

Re: how to pass commandline arguments when running program?

Postby bobh » Mon Nov 21, 2005 10:11 pm

IIRC, gcc runs under the Cygwin shell and not directly out of the Windows console. This is probably why it isn't working with UEStudio, but I never tried it myself.

There is a native Windows port of gcc for Windows called MinGW, I believe, which DOES run from the command shell without having Cygwin installed.

What other issues are you having except for the extra command-line arguments? Does it work at all?
User avatar
bobh
Advanced User
Advanced User
 
Posts: 59
Joined: Tue Dec 28, 2004 12:00 am

Re: how to pass commandline arguments when running program?

Postby strawberry » Wed Nov 23, 2005 3:19 pm

Thanks for your answer, buddy. I am still wondering if there's a way I can change the default shell used by UEStudio? I used MinGW before but since I also use cygwin, I remove the MinGW from my computer. BTW, I think MinGW may lack some standard library. That's another reason why I removed it.
strawberry
 

Re: how to pass commandline arguments when running program?

Postby strawberry » Thu Nov 24, 2005 4:01 pm

I have tried MinGW. It still won't work. My actual problem is to redirect the standard input to a text file, e.g.

prog.exe < input.txt

Seriously, is it really a bug from UltraStudio'05?
strawberry
 

Re: how to pass commandline arguments when running program?

Postby bobh » Sat Nov 26, 2005 2:23 pm

Does it work from the command line outside of UEStudio?

I think there are probably going to be problems running your program like that from inside of UEStudio. Presumably, UEStudio calls CreateProcess() or something to run the application outside of the shell. But you need the shell in order to redirect standard input.

It's probably less of a hassle to just run it from a batch file or from the command line. You can also try setting up a custom tool (under the "Advanced" menu). Alternatively, you could design your application so as to receive the file name as a command line argument and open it inside the application.
User avatar
bobh
Advanced User
Advanced User
 
Posts: 59
Joined: Tue Dec 28, 2004 12:00 am

Re: how to pass commandline arguments when running program?

Postby strawberry » Sat Nov 26, 2005 6:30 pm

Yes. It works in the command line window outside of UEStudio.
strawberry
 

Re: how to pass commandline arguments when running program?

Postby laurens » Sat Oct 28, 2006 9:33 pm

You can make UE portable (I tried v11+) by just moving the ini-file into the application directory. It always looks in the appdir for an ini-file.

The only problem is that relative paths (eg Language File=.\wordfile.txt) set in the ini-file are relative to the project-dir or the current working dir. Very inconvenient if you want to invoke your portable UE from another app, eg Total Commander.

An example: You browse to "C:" in TC, select a textfile and press F4 (invoke text editor, by default Notepad, but you can specify a custom texteditor, in this case I specified UE). TC invokes the portable UE and passes the name of the textfile as parameter. The problem is the current working dir becomes "C:" and UE searches for the wordfile in "C:".

To workaround, use a batchfile to invoke UE from other programs. Create a file called "startue.bat" in the UE-directory. Put the following command in the batchfile:

start /b /d%~dp0 %~dp0uedit32.exe %*

NOTE: Doesn't work under Win9x, only Win2k and higher.
User avatar
laurens
Newbie
 
Posts: 1
Joined: Wed Oct 25, 2006 11:00 pm


Return to UEStudio General Discussion