Link to home
Start Free TrialLog in
Avatar of jimc5240
jimc5240

asked on

CFExecute fails but same code works from command line

I am trying to call a small conversion tool via cfexecute and it times out when I call it.  I have several tools that use cfexecute so I understand the basics and have even made some tricky ones work but this has me stumped, especially because it is so simple.

The code looks like this

<cfexecute name="C:\SCPDF\SolidConvertPDF.exe"  arguments=" /i inputfilename /o outputfilename" timeout="30">

When I run this I get a timeout.  If I cut and paste the code from the error message on the command line it works fine.  So, thinking that I might have a permission problem, I looked down all of those alleys with no success.  I did run across a posting somewhere that suggested putting this in a batch file, which I did.  It then looked like this:

<cfexecute name="C:\thetool.bat" arguments="inputfilename, outputfilename" timeout="30">
 
When I ran this I got the exact same thing, timed out in CF yet when I pasted the code from the error on the command line, it ran like a champ.  

I've tried moving the directory, installing the utility to the web server root, cffusion and any place else that I thought would work.  I also installed it in the directory of another utility that I have that runs fine so I don't think it's a directory permission thing.

Does anyone have any idea where to go with this?
Avatar of pinaldave
pinaldave
Flag of India image


<cfexecute name="cmd.exe"
     arguments='/c thetool.bat /i inputfilename /o outputfilename'
/>
Avatar of jimc5240
jimc5240

ASKER

Thanks for the help but I still have a problem.  It's not timing out any more but it's not running either.  I further reduced the batch file and just calling sc.bat from the command line works.  So, I tried this without success:

 <cfexecute name="cmd.exe"
           arguments="/c c:\sc.bat"
           timeOut="20"></cfexecute>

It runs through this so fast that I began to belive it wasn't running anything.  So I made another batch file called test.bat that was simply "copy c:\afile.txt c:\bfile.txt"  and when I plug it in the cfexcute like this:

<cfexecute name="cmd.exe" arguments="/c test.bat">  (and lots of deviations)

It didn't run that either. It didn't fail, it just doesn't do anything.  And of course, if you run test.bat from the command line, it works just fine.  How can I find out what is going on?

Thanks
let us see the example in the other thread..... pay attention to capitalized word PERL

<cfexecute name="cmd.exe"
     arguments='/c PERL "\Program Files\AWStats\tools\logresolvemerge.pl" \statsLogs\WS001_ex040902.log \statsLogs\WS002_ex040902.log > \statsLogs\merged\merge_ex040902.log'
/>

we need something like that in your example... like some kind of program name which will run your SolidConvertPDF.exe may be ... something like this....

<cfexecute name="cmd.exe"  arguments="SolidConvertPDF.exe /i inputfilename /o outputfilename" timeout="30">

if you can do something like that in dos prompt that it will directly recognize SolidConvertPDF.exe from command line and you do no thave to go to the directory folder ... it will sure work ... I promise.. you just need to set path ( how ? I do not know... i am CF guy only) .... or you bring that program to c:\ directly ... it will work...
Regards,
---Pinal
Okay, I fixed the path so that you can run the utility directly at the c prompt:  The cfexecute looks like this:

<cfexecute name="cmd.exe"
           arguments="/c perl SolidConverterPDF.exe /i convtest.pdf /o converted.rtf"
          timeOut="15"></cfexecute>

If I run the cfexecute above, I get an error that 'perl' is not a recognized command.

If I cut and paste SolidConverterPDF.exe /i convtest.pdf /o converted.rtf to the command line it runs.

If I put this on the command line it runs:
cmd.exe /c SolidConverterPDF.exe /i convtest.pdf /o converted.rtf

If I run it without the 'perl' in the agrugments line it times out.

First, what is the purpose of the 'perl' entry?  I would assume it sets a run environment somehow.

Second, how do I fix the perl execution error or is there another environment I can use like asp or something?

Thanks,
hello,
PERL is in the previous example... not in your example...buddy... I said we need to use somethingl like that... you can not use perl here... i said we need to have something like that... in your example that is like solidconverterpdf.exe... and you need  to set path to that... not to perl... :(
anyway... you need to install perl if you want to use ... but once you install it will nto server purpose... i was just trying to show you that how other one is fixed...
as I mentioned in the my previoius example... you need to do something like this... and what is the error now...
<cfexecute name="cmd.exe"
           arguments="/c SolidConverterPDF.exe /i convtest.pdf /o converted.rtf"
          timeOut="15"></cfexecute>

if it is timeoutinmg may be it is not finishing the job in 15 sec or milisec
REgards,
---Pinal
I have set the environment path variable so that I can run the SolidConverterPDF.exe from almost anywhere, yet the cfexecute still times out.  My guess at this point is there is some quirk in SolidConverterPDF that is at odds with CF.  If you run this from the command line, it finishes in less than 1 second so I doubt that it is not finishing within 15 seconds.  I know what you're thinking, if it runs on the command line, it ought to run in CFExecute, but it doesn't.  I've had three other CF guys look at it and no one sees the problem so maybe there isn't one that is solvable.

If you want to try it yourself, go to www.soliddocuments.com and download the 15 day trial of SolidConverterPDF.  All it does is take a PDF and turn it into an rtf.
okey ... i will try it on Tuesday when I will go to office.
As a last try just have this and let me know what goes on...
<cfexecute name="cmd.exe"
           arguments="/c SolidConverterPDF /i convtest.pdf /o converted.rtf"
          timeOut="15"></cfexecute>
Your example just times out.
ASKER CERTIFIED SOLUTION
Avatar of INSDivision6
INSDivision6

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Okay, INSdivision6 had the answer in that I needed CFX_EXEC to do this however, according to the CFX_EXEC people, you do want to execute this directly and not via cmd.exe.