I have batch & js file which convert to word to pdf using cscript.exe.
when I execute batch file directly it convert the files. But if call through browser using below cfm file I
my coldfusion page never end the execution and no output files created.
<cfexecute name="C:\Windows\System32\cmd.exe" arguments="/c #expandpath('./Word2PDF.bat')#" timeout="2000"></cfexecute>
Can you break out your CScript code into a separate file, then invoke cscript.exe as the program you're trying to run? It's difficult to have CFEXECUTE run one program which then invokes another one, because of path stuff & permissions and so on.
Dave Watts, Eidolon LLC
I split code and directly all csript.exe to run js file,but no use. Still it took long time execution without output.
In my server task maganer I can view cscript.exe and winword.exe are trigger after I call my cfm page in user browser.
I have a few things to consider.
First, I'd recommend you do a cfoutput/cfdump of your expandpath result, and then make sure that's valid (that if you drop the result into the command line or windows file explorer--on the server, the bat file tries to run.)
Second, consider also that it will run as the user running cf, which may respond differently compared to you doing the above, when logged into ther server yourself.
As for it hanging, if you had a tool setup to monitor cf, you may find what it's hung on. There is the cf pmt for cf2018 and up, or fusionreactor or other jvm tools that can be configured to work for any cf version.
And consultants like Dave and I (and others) can help get such monitoring set up, where that would be helpful.
Let us know if the first couple of tips I offered help, or if you learn more otherwise.
As mention other replies I try to output path no problem. I add this cfm page in schedule task see whether it work but same so output and throw Timeout Period expired if take more than half hour to show the error.
I see no other replies from you indicating that. Where do you report that result to us? And I listed still more for you to consider.
I do see now that in a reply to Dave, you indicate that you saw winword (and cscript) in task manager, once you run the cfm page.
Ok, then by that we could infer that those were triggered by cf, in which case it confirms that the path was OK. Still, it begs two more questions.
First, BEFORE you run such a test, have you tried confirming that there is NO listed winword.exe in task mgr? Doing that would ensure that the one you see after running the cf page is indeed from cf.
Second, what is the user listed in task mgr, shown running the winword process? That goes back to my first comment above. I'd suspect that the user running it from cf would be quite different from when you run it, and that may be significant.
Finally, it could be that running winword (specifically) from cf may be a particular challenge. As such, it could be worth considering its various command line args for launching it. I see there's one, /x, that seems to be important for some such automation tasks. You may need to do that or something else like it (like /q), when launching winword from something like cf, which has no terminal attached.
Just sharing ideas. You've got 3 of us on it. Hopefully we or others will help you get to a solution.
Try the method throw Timeout period expired error but it take very long time.
Try the method throw Timeout period expired error
Which method did you try?
What happens when you try the following code?
<cfexecute name="#expandpath('./Word2PDF.bat')#" timeout="60"></cfexecute>
but it take very long time.
You have set timeout to 2000 seconds, which is a relatively long time for file conversions.
Still not working. I try to use coldfusion schedule task option to convert but not working.
Sad to hear. I would suggest that you first get the CFM page to work, before running it as a scheduled task.
Could you share with us the code of the CFM page?