Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / ColdFusion / Advanced Techniques / September 2007



Tip: Looking for answers? Try searching our database.

CFExecute issue

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
dbranch - 15 Sep 2007 20:10 GMT
I am having a problem with both cfexecute and CFX_EXEC in that they seem to
launch an application as a process and work in the background, but I cannot get
it to launch on the desktop as an application. This wouldn't be a problem as it
actually seems to execute a single command very well. The problem I am having
is when I try to launch a multi-step batch file or when I need to receive
feedback from the launched application it fails.

I have a batch file which basically calls an application called imacros and
depending on the outcome writes the results to mysql database. See attached
code.

When I execute a batch file by double clicking it the CMD window opens and
runs through the entire batch file perfectly. However when I execute the same
batch file with cfexecute or cfx_exec the process only launches the first
command, launching imacros and completes it's objective. However the process
seems to terminate after that and thus nothing gets written to mysql.

I assume that this has to be a setting in Windows 2003 or a permissions issue
that is not allowing me to run applications on the desktop. I have set
Coldfusion to run as Administrator  but this hasn't helped. I also have tried
to assign it as System user and allow it to interact with desktop.

echo off
echo Example iMacros Batch File
REM Tip: You may have to adjust the path names to YOUR installation directory
of iMacros

REM Note: The "-loop <x> " command runs the macro <x> times in a loop.
REM This is the same as pressing the LOOP button in the IM browser.

"C:\Program Files\iMacros\imacros.exe" -macro CB_Register -var_username
oncemoor

REM The batch variable %errorlevel% is automatically set by "imacros.exe" upon
exit

if %errorlevel% == 1 goto ok
if NOT %errorlevel% == 1 goto error

:ok
"C:\Program Files\MySQL\MySQL Server 5.0\bin\MySQL.exe" -u root -p12345 -e
"UPDATE candidatejobboard SET SubmissionStatus=2 WHERE JobBoardSubmissionID=39"
test
goto end

:error
"C:\Program Files\MySQL\MySQL Server 5.0\bin\MySQL.exe" -u root -p12345 -e
"UPDATE candidatejobboard SET SubmissionStatus=%errorlevel% WHERE
JobBoardSubmissionID=39" test
:end
pause
GArlington - 17 Sep 2007 11:51 GMT
>  I am having a problem with both cfexecute and CFX_EXEC in that they seem to
> launch an application as a process and work in the background, but I cannot get
[quoted text clipped - 47 lines]
>  :end
>  pause

I suspect that the system does not allow you to run MySQL as root. Try
to add some command before BOTH calls to MySQL (OK or ERROR) to
indicate the condition when the call occurs. Another question: why do
you have pause in the end of the batch? It may be another reason why
it does not run properly...
Mr Black - 17 Sep 2007 20:30 GMT
It is very unlikely that this is a desktop problem.  You can easily verify that
in CFX_EXEC using INTERACTIVE option.

Most likely this is the problem with conditions in your batch file, which are
not correctly processed due to using "alien" launchers (CFEXECUTE and CFX_EXEC).

Immediate suggestion is not to use the batch file at all, but use conditional
CFX_EXEC.  CFX_EXEC returns the process return code, which you might be able to
use for recognizing the error condition, if  "imacros.exe" sets it properly.  
So, just analyze process return code and launch second CFX_EXEC or CFXEXECUTE
to run the appropriate second command.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.