Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CFEXECUTE -> Arguments

Status
Not open for further replies.

Bramvg

IS-IT--Management
Joined
Jan 16, 2001
Messages
135
Location
BE
Hi,

I have a exe file which expects a string of arguments.
I tried to use following code:

<CFEXECUTE NAME=&quot;.exe&quot; ARGUMENTS=&quot;12;123;&quot; TIMEOUT=&quot;10&quot;></CFEXECUTE>
The arguments are seperated by ';'

BUT this doesn't work. The only way it works is when I create a .bat file where I specify the whole 'shit'.
E.g.:

d:
cd d:\inetpub\ ALG;1;1;650;KOD;250;1250000;106;750000;355;100000;400;500000

Everytime someone fills out the form I create such a .bat file (cffile) to determine the arguments and next I run the .bat file using the CFEXECUTE tag to process the .bat file.
But that takes way to much time and is too slow.

Any suggestions?

Tnx
Bram
 
why not just use a string var to put in place of the arguments?

replace your code:
Code:
   <CFEXECUTE NAME=&quot;.exe&quot; ARGUMENTS=&quot;12;123;&quot;
   TIMEOUT=&quot;10&quot;></CFEXECUTE>
with:
Code:
   <CFEXECUTE NAME=&quot;.exe&quot; ARGUMENTS=&quot;#ARGS#&quot;
   TIMEOUT=&quot;10&quot;></CFEXECUTE>
Here's a sample bit of code to get the arguments:
Code:
   <cfparam name=&quot;ARGS&quot; default=&quot;&quot;>
   <cfoutput>
   
   <cfif ARGS IS NOT &quot;&quot;>
   Here are your command line params:</b> #Replace(ARGS,&quot; &quot;,&quot; ; &quot;,&quot;ALL&quot;)#
   </cfif>
   
   <form name=&quot;go&quot; action=&quot;#CGI.SCRIPT_NAME#&quot; method=&quot;post&quot;>
   <br><B>Enter arguments seperated by a space</B><BR>
   <input type=&quot;text&quot; name=&quot;ARGS&quot; value=&quot;#ARGS#&quot;>
   <input type=&quot;submit&quot; value=&quot;GO!&quot;>
   
   </cfoutput>
 
Hello Iamkillyou,


I tried that (before) as well, but the result is the same, it does not help.

bram
 
Hello tleish


Yeps, that works fine!

Regards
Bram
 
And the following script doesn't work for you?

<cfexecute name=&quot;d:\inetpub\wwwroot\projects\PB2002E.exe&quot;
arguments=&quot;12;123;&quot;
timeout=&quot;10&quot;/>



Do you get any errors? - tleish
 
Nope I do not get to any errors, but looking at the result I see the arguments are not passed.

The result of the exe depends of the arguments passed, using the code above (the example you submitted) I get a 'zero' length result, meaning: the arguments are not passed.

I realy don't get it, if I use the .bat file (in which you helped me before) it works fine. But once I use the CFEXECUTE it doesn't work, althought that is the reason of existence of cfexecute.... ;-)

Bram
 
As I recall, one of the problems of the script was that you had change the directory first before executing it in order to be able to write the file to that directory. Is that correct?

If you were able to create 1 bat file, and then pass arguments to the bat file without having to re-write it every time, would that help? - tleish
 
I think that would help too (passing the arguments to the bat file).

Like you sent it to me before (using the %1),but I tried that and the cfexecute does not pass that either, OR the bat file does not 'see' that the %1 should be replaced with the arguments of the cfexecute tag.

What I have to do everytime is:
1. Retrieve the values of the form
2. put them in a list
3. create a .bat file (for every visitor!)
4. run the bat file

My fear is also that when I process the script for user 1 and at the same time a second user launches the script the result for user 1 would be incorrect (because i overwrite the .bat file each time).
+ it's not logical to go through these steps everytime, it's to time and server consuming.

I don't know IF an other sollution exsists (e.g. CFOBJECT/...)?

Many thanks
Bram
 
What did your CFEXECUTE code and BAT code look like when you were trying to pass the arguments. - tleish
 
I don't realy understand what you mean with 'how did my cfexecute code looked like'?

Regards
Bram
 
You said you tried to pass arguments to the bat file through CFEXECUTE. Post the code you tried when you passed the arg's that didn't work. - tleish
 
The CFM file looks like this:

<CFSET stringinfo = &quot;ALG;1;1;650;KOD;250;1250000;106;750000;355;100000;400;500000&quot;>

<CFFILE ACTION=&quot;WRITE&quot; FILE=&quot;#expandpath(&quot;..&quot;)#\belastingen\testingnew.bat&quot;
OUTPUT=&quot;d:
cd #expandpath(&quot;..&quot;)#\belastingenPB2002E.exe #stringinfo#&quot; ADDNEWLINE=&quot;Yes&quot;>

<CFEXECUTE NAME=&quot;#expandpath(&quot;..&quot;)#\belastingen\testingnew.bat&quot; TIMEOUT=&quot;10&quot;/>


The code above is to create the .bat file, which you can see below.

d:
cd d:\inetpub\ ALG;1;1;650;KOD;250;1250000;106;750000;355;100000;400;500000


When I try it direcly throught the bat file, it looks like this:

d:
cd D:\standaard-nieuwsbrief.be\ %1

What I still do not get is that I can use a simple URL to pass the variables

e.g.

alg;5;13213....
 
Try this:

[COLOR=666666]<!--- testingnew.bat FILE --->[/color]

d:
cd
Code:
d:\inetpub\wwwroot\projects\destandaard\PB2002E.exe
%1


[COLOR=666666]<!--- CFEXECUTE FILE --->[/color]
<CFSET stringinfo = &quot;ALG;1;1;650;KOD;250;1250000;106;750000;355;100000;400;500000&quot;>

<CFEXECUTE NAME=&quot;#expandpath(&quot;..&quot;)#\belastingen\testingnew.bat&quot;
ARGUMENTS=&quot;#stringinfo#&quot;
TIMEOUT=&quot;10&quot;/>
- tleish
 
Hi Tleish,


I tried this as well, but it doesn't work ;-(

Like the other times I do not get to see an error, but the arguments are definately not passed. The result of the exe is 'nothing'.

Last time you sent me that sollution as well (tnx for that) and back then I tried it as well, but with no succes ;-)

Apparently it's not working. DO you have an idea how I can make SURE that the result of the calculation is only for user 1?
Meaning: if user presses the OK button on the same time theire values of the form are not mixed?



Bram
 
Can you run the exe on your machine through the url?

Code:
[URL unfurl="true"]http://<servername>/PB2002E.exe?ALG;0;1;650;KOD;250;1250000;106;750000;355;100000;400;500000[/URL]
- tleish
 
I tried that as well, but nope, that doesn't work ;-(


I can send you the code how it works with me.
if you send me a mail to bram@vangrimbergen.com

regards
bram
 
So, does the code you sent me work on your machine? - tleish
 
Yes,
that code works fine.

The way it works is :

1. retrieves info of the form
2. creates a .bat file
3. executes the .bat file (cfexecute)
4. redirects to afdruk.htm (= result of the exe)

bram
 
Of the 13 items in the list:

ALG;0;1;650;KOD;250;1250000;106;750000;355;100000;400;500000

How many of them are dynamic? In other words, which ones change, and which ones stay the same?

Also, are there always 13 arguments? - tleish
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top