running third party exe About Monkey 2 › Forums › Monkey 2 Programming Help › running third party exe This topic contains 3 replies, has 3 voices, and was last updated by scurty 1 year, 10 months ago. Viewing 4 posts - 1 through 4 (of 4 total) Author Posts June 19, 2017 at 9:32 am #8815 abakoboParticipant I’d like to convert some of my .BAT to monkey code but I could not find how to simply run an executable from my console app (with app args). I tried to find how ted2 is calling mx2cc but it a bit mazzy for me! 0 June 19, 2017 at 10:04 am #8816 abakoboParticipant It can be done with the std:std.process.Process class 0 June 20, 2017 at 2:39 am #8823 nerobotParticipant Look at this code (monkey2’s launcher): Monkey Function Main() Local qargs:=AppArgs().Slice( 1 ) For Local i:=0 Until qargs.Length qargs[i]="~q"+qargs[i]+"~q" Next Local args:=" ".Join( qargs ) #If __HOSTOS__="windows" libc.system( "bin\ted2_windows\ted2.exe "+args ) #Else If __HOSTOS__="macos" libc.system( "open ~q"+std.filesystem.AppDir()+"../../../bin/ted2_macos.app~q --args "+args ) #Else If __HOSTOS__="linux" libc.system( "bin/ted2_linux/ted2 "+args+" >/dev/null 2>/dev/null &" ) #Else If __HOSTOS__="raspbian" libc.system( "bin/ted2_raspbian/ted2 "+args+" >/dev/null 2>/dev/null &" ) #Endif End 123456789101112131415161718192021222324252627 Function Main() Local qargs:=AppArgs().Slice( 1 ) For Local i:=0 Until qargs.Length qargs[i]="~q"+qargs[i]+"~q" Next Local args:=" ".Join( qargs ) #If __HOSTOS__="windows" libc.system( "bin\ted2_windows\ted2.exe "+args ) #Else If __HOSTOS__="macos" libc.system( "open ~q"+std.filesystem.AppDir()+"../../../bin/ted2_macos.app~q --args "+args ) #Else If __HOSTOS__="linux" libc.system( "bin/ted2_linux/ted2 "+args+" >/dev/null 2>/dev/null &" ) #Else If __HOSTOS__="raspbian" libc.system( "bin/ted2_raspbian/ted2 "+args+" >/dev/null 2>/dev/null &" ) #Endif End 0 June 21, 2017 at 8:17 am #8848 scurtyParticipant I agree with @nerobot, it’s the best way right now. 0 Author Posts Viewing 4 posts - 1 through 4 (of 4 total) You must be logged in to reply to this topic.