It is currently Sat May 25, 2013 5:16 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 11 posts ] 
Author Message
 Post subject: runprogram - need help
PostPosted: Sun Jun 03, 2012 10:56 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Mon Nov 21, 2005 10:21 pm
Posts: 285
Location: Germany
Hello List,

in a project I want to compile a given PB-file.
but the following code (example) don't work.
Code:
FileChoose$ = OpenFileRequester("", "", "*.pb", 0)

MessageRequester("choosen file", FileChoose$) ; #############

   myProg = RunProgram(#PB_Compiler_Home + "compilers/pbcompiler", #DQUOTE$+"--executable"+#DQUOTE$+#DQUOTE$+FileChoose$+#DQUOTE$, "", #PB_Program_Open)   
   Debug myProg
   
   While ProgramRunning(myProg)
      Debug "program running"
   Wend
   
   Debug "runprogram finished"

The compiler seems to run, but no application will be created.
Also I tried a lot of combinations in "parameters" with the same result.
What is wrong?

BTW, the example in the help works as expected.

_________________
michel51

Mac OS X Snow Leopard (10.6.8 ) Intel
PureBasic V 5.11(x64), V 5.10(X64)


Top
 Profile  
 
 Post subject: Re: runprogram - need help
PostPosted: Mon Jun 04, 2012 7:09 am 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sat Jun 28, 2003 12:01 am
Posts: 349
Hello,

Have a look at the commandline options:
Code:
Quick Help:
-----------

pbcompiler "filename.pb"

Options:
--------
...
-e or --executable "filename": Create an executable to the given filename
...

If you change your code, you can see, that the passed parameters are wrong:
Code:
EnableExplicit

Define FileChoose$, Parameter$, myProg

FileChoose$ = OpenFileRequester("", "", "*.pb", 0)

MessageRequester("choosen file", FileChoose$) ; #############

Parameter$ = #DQUOTE$+"--executable"+#DQUOTE$+#DQUOTE$+FileChoose$+#DQUOTE$
Debug Parameter$

myProg = RunProgram(#PB_Compiler_Home + "compilers/pbcompiler", Parameter$, "", #PB_Program_Open)
Debug myProg

While ProgramRunning(myProg)
  Debug "program running"
Wend

Debug "runprogram finished"


Result of Parameter$:
Code:
"--executable""/path/to/source-code.pb"


Solution: Change your code, so that the Result of Parameter$ looks like this:
Code:
--executable "/path/to/new-executable" "/path/to/source-code.pb"

If you will pass this as Parameter to RunProgram, it should work.

cu,
guido

_________________
Windows 8 / Windows 7 / Windows XP (als VM)
PB Last Final / Last Beta Testing


Top
 Profile  
 
 Post subject: Re: runprogram - need help
PostPosted: Tue Jun 05, 2012 6:10 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Mon Nov 21, 2005 10:21 pm
Posts: 285
Location: Germany
Hi helpy,

thanks for your answer.
I tried and tested a lot of combinations for parameters, but an app will not be created.
My last try is here:
Code:
sFile.s = OpenFileRequester("", "", ".pb", 0)
appFile.s = ReplaceString(sFile, ".pb", ".app")
RunProgram(#PB_Compiler_Home + "compilers/pbcompiler", sFile + " -e " + appFile, GetPathPart(sFile), #PB_Program_Wait)

This is from a short snippet, that creates me a resident. It's modified for compiling to an application, but nothing happens.
A resident-file will be compiled.

May be the parameter "-e" or "--executable" buggy and works on Mac not correctly.

_________________
michel51

Mac OS X Snow Leopard (10.6.8 ) Intel
PureBasic V 5.11(x64), V 5.10(X64)


Top
 Profile  
 
 Post subject: Re: runprogram - need help
PostPosted: Tue Jun 05, 2012 8:23 pm 
Offline
Addict
Addict
User avatar

Joined: Sun Apr 27, 2003 8:12 am
Posts: 1620
Location: USA
Works just fine. Try it with Chr(34). ;)

Code:
sFile.s = OpenFileRequester("", "", ".pb", 0)
appFile.s = ReplaceString(sFile, ".pb", ".app")
RunProgram(#PB_Compiler_Home + "compilers/pbcompiler", Chr(34) + sFile + Chr(34) + " -e " + Chr(34) + appFile + Chr(34), GetPathPart(sFile), #PB_Program_Wait)

_________________
AMD 64 4000+ / 1GB PC2700 / WIN XP Home SP3 / Nvidia GT220 x16 512MB / M-Audio Revolution 5.1
Macbook Air 11.6" - 2010 / OS X 10.8

http://www.posemotion.com
http://www.flashpulse.com


Top
 Profile  
 
 Post subject: Re: runprogram - need help
PostPosted: Tue Jun 05, 2012 9:23 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Mon Nov 21, 2005 10:21 pm
Posts: 285
Location: Germany
J. Baker wrote:
Works just fine. Try it with Chr(34). ;)

Code:
sFile.s = OpenFileRequester("", "", ".pb", 0)
appFile.s = ReplaceString(sFile, ".pb", ".app")
RunProgram(#PB_Compiler_Home + "compilers/pbcompiler", Chr(34) + sFile + Chr(34) + " -e " + Chr(34) + appFile + Chr(34), GetPathPart(sFile), #PB_Program_Wait)


Hmmm... tried, but nothing happens.
Don't know, what is wrong or missing (?)

_________________
michel51

Mac OS X Snow Leopard (10.6.8 ) Intel
PureBasic V 5.11(x64), V 5.10(X64)


Top
 Profile  
 
 Post subject: Re: runprogram - need help
PostPosted: Tue Jun 05, 2012 9:58 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sat Jun 28, 2003 12:01 am
Posts: 349
Is the source file correct? Maybe the compiler does not finish creating the application because of an syntax error?

_________________
Windows 8 / Windows 7 / Windows XP (als VM)
PB Last Final / Last Beta Testing


Top
 Profile  
 
 Post subject: Re: runprogram - need help
PostPosted: Tue Jun 05, 2012 10:08 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Mon Nov 21, 2005 10:21 pm
Posts: 285
Location: Germany
I think, I got it :!:

The code really works as expected.
In the code I used for testing I have used the compiler constant "#PB_Editor_CreateExecutable". This constant is useful for testing if I compiled a source to an application from IDE or if I run the code in IDE (compile/run).
But in this case the constant generates an error ( "Constant #PB_Editor_CreateExecutable not found").
The same if I try to compile in command line terminal.

Hmm, looks like a bug, because the compiler is the same in all cases.
I will further try it and eventually post an bug later.

_________________
michel51

Mac OS X Snow Leopard (10.6.8 ) Intel
PureBasic V 5.11(x64), V 5.10(X64)


Top
 Profile  
 
 Post subject: Re: runprogram - need help
PostPosted: Tue Jun 05, 2012 10:22 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sat Jun 28, 2003 12:01 am
Posts: 349
It is not a bug!

The constants #PB_Editor_CompileCount, #PB_Editor_BuildCount, #PB_Editor_CreateExecutable are special EDITOR constants, which only work, when compiling from the editor! Have a look at the PureBasic documentation:

==> http://www.purebasic.com/documentation/ ... piler.html

cu,
guido

_________________
Windows 8 / Windows 7 / Windows XP (als VM)
PB Last Final / Last Beta Testing


Top
 Profile  
 
 Post subject: Re: runprogram - need help
PostPosted: Tue Jun 05, 2012 11:59 pm 
Offline
Addict
Addict
User avatar

Joined: Sun Apr 27, 2003 8:12 am
Posts: 1620
Location: USA
michel51 wrote:
J. Baker wrote:
Works just fine. Try it with Chr(34). ;)

Code:
sFile.s = OpenFileRequester("", "", ".pb", 0)
appFile.s = ReplaceString(sFile, ".pb", ".app")
RunProgram(#PB_Compiler_Home + "compilers/pbcompiler", Chr(34) + sFile + Chr(34) + " -e " + Chr(34) + appFile + Chr(34), GetPathPart(sFile), #PB_Program_Wait)


Hmmm... tried, but nothing happens.
Don't know, what is wrong or missing (?)

Don't copy and paste from Safari. It doesn't work. Use Firefox. ;)

If that's indeed what you did or not.

_________________
AMD 64 4000+ / 1GB PC2700 / WIN XP Home SP3 / Nvidia GT220 x16 512MB / M-Audio Revolution 5.1
Macbook Air 11.6" - 2010 / OS X 10.8

http://www.posemotion.com
http://www.flashpulse.com


Top
 Profile  
 
 Post subject: Re: runprogram - need help
PostPosted: Wed Jun 06, 2012 1:00 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Mon Nov 21, 2005 10:21 pm
Posts: 285
Location: Germany
J. Baker wrote:
Don't copy and paste from Safari. It doesn't work. Use Firefox. ;)

If that's indeed what you did or not.

I know that. I use another way for "copy and paste" from Safari.

_________________
michel51

Mac OS X Snow Leopard (10.6.8 ) Intel
PureBasic V 5.11(x64), V 5.10(X64)


Top
 Profile  
 
 Post subject: Re: runprogram - need help
PostPosted: Wed Jun 06, 2012 1:07 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Mon Nov 21, 2005 10:21 pm
Posts: 285
Location: Germany
helpy wrote:
It is not a bug!

The constants #PB_Editor_CompileCount, #PB_Editor_BuildCount, #PB_Editor_CreateExecutable are special EDITOR constants, which only work, when compiling from the editor! Have a look at the PureBasic documentation:

==> http://www.purebasic.com/documentation/ ... piler.html

cu,
guido


You're right. But as I've said above the source with this constants are testing codes form the past.
And till now I don't needed runprogram in this way.
But now I know that and I will avoid this mistake from now on.
Thanks for your help.

_________________
michel51

Mac OS X Snow Leopard (10.6.8 ) Intel
PureBasic V 5.11(x64), V 5.10(X64)


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 11 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye