View Full Version : How do you turn off error messages when running a batch file.
AmyGrrl
01-28-2006, 08:50 PM
If I double-click to run the batch file manually in Windows XP, I get no Windows Type Error Message, the batch file just displays "File Not Found" and proceeds.... When I run the same batch file with AMS6... It comes up with a Windows Message saying Windows could not find the file and halts the batch file until I click ok. Is their a way to make AMS6 Show No Error messages? I'll post my Batch file below... perhaps I can make a change in the batch file to stop the error.... The Error Occurs during the 'FOR' Command when it attempts to search for 'daemon.exe'... if it find the file.. all is good... if it doesn't.. then... BOOM... windows error message pops up when it shouldn't...
@ECHO OFF
CLS
CD Data
SET DataFolder=%CD%
CD %SystemDrive%\Program Files\Daemon Tools
IF NOT exist daemon.exe GOTO Mount1
START daemon.exe -mount 0,"%DataFolder%\Image.cue" && exit
GOTO END
:Mount1
ECHO.
ECHO Daemon.exe Not Found
ECHO.
ECHO Attempting To Search For Daemon.exe
ECHO.
CD %SystemDrive%\
FOR /F "tokens=2* delims= " %%A IN ('dir daemon.exe /s ^| Find "Directory of"') DO SET Daemon=%%B
ECHO.
CD %Daemon%
IF exist daemon.exe GOTO Mount2
:Mount2
START daemon.exe -mount 0,"%DataFolder%\Image.cue" && exit
:END
CLS
ECHO.
ECHO Daemon.exe Not Found
ECHO.
ECHO Attempting To Search For Daemon.exe
ECHO.
ECHO Was Unable To Locate Daemon.exe
ECHO.
ECHO You Will Need To Do One Of The Following
ECHO To Install This Program.
ECHO.
ECHO (1) Mount This Image Manually With Daemon
ECHO Tools Or With Any Virtual CD Program
ECHO Of Your Choice.
ECHO.
ECHO (2) Burn This Image To A CD.
ECHO.
PAUSE
AmyGrrl
01-29-2006, 11:01 AM
Grr.. I've been trying to figure this out.... I get no windows error message when I run the batch file manually..... so why does it come up when I run the same batch file with AMS6?
AmyGrrl
01-29-2006, 12:02 PM
I haven't really played around with all of AMS6 features.... but would it be possible to have AMS6 do all this itself... like run through a list of commands when a button is clicked?
Gabis
01-29-2006, 01:21 PM
It would most definitely be possible. You can use File.DoesExist to find daemon tools. Then use a simple if statement, same as in the batch basically, to perform certain tasks if it is/is not found. Instead of ECHO you can use Dialog.Message. To mount the image if daemon tools is found, use File.Run to execute it. You can also pass the -mount parameter to the exe with this function. Using the Action Wizard will help you greatly to get everything running exactly how you want.
AmyGrrl
01-29-2006, 04:16 PM
Grr.. this is fustration.... lol... I know I don't understand this completely... but I do understand the basic concepts... back in highschool we learned a programming langauge called 'Turing'... but what I think should be happening... isn't happening... lol...
The main issue I'm having is with the find command... I know it find the daemon.exe but what is it storing in the DaemonFind Variable.... I assume it would be the location of deamon.exe.. like ... C:\Program File\Program\daemon.exe...... But then I wanted to check and see if daemon.exe is stored in the DaemonFind Variable and store that anwser in it's own Variable DaemonCheck... but I get and error saying it's the wrong string type or something... then I need to find out what is being store in DaemonCheck weather is a true/false... so that I can do an if statement to see it is been found or not.. then run command if found.. display error message if not found.
function DaemonSearchStatus()
end
function DaemonSearch()
DaemonFind = File.Find(_SourceDrive, "daemon.exe", true, false, DaemonSearchStatus, nil);
DaemonCheck = String.Find(DaemonFind, "daemon.exe", 1, false);
if (1 < DaemonCheck) then
result = Dialog.Message("Notice", "Daemon.exe Found.", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
else
result = Dialog.Message("Notice", "Daemon.exe Not Found.", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
end
end
DaemonSearch();
Corey
01-29-2006, 04:36 PM
back in highschool we learned a programming langauge called 'Turing'
Alan Turing is considered by many to be the father of computer science:
http://en.wikipedia.org/wiki/Alan_Turing
AmyGrrl
01-29-2006, 04:42 PM
Yes, and if you follow the URL below, you can learn all about this wonderful programming language that we were subjected to...
I would rather have learned C/C++ instead.... and if your going to mock me instead of helping then so be it..
http://www.holtsoft.com/turing/
Corey
01-29-2006, 04:58 PM
if your going to mock me
Mocking you? No one is mocking you and I have no idea what led you to that conclusion. C'mon now.
Turing looks like a decent basis for scripting in many languages. Shouldn't be too hard to transition into AMS scripting syntax from there. :yes
OK so if you check out the scripting guide you'll read that the File.Find action returns a table (array) which contains the paths to all of the files that were found. If no files were found or an error occurs, nil is returned. So in your case simply check for a nil value to see if the file was found and then refer to DaemonCheck[1] for the path instead of DaemonCheck. This gives you the data stored in the first position of the DaemonCheck table which was returned by the File.Find function. There are working examples of this, and all the other actions, in the AMS help file which you can refer to for working code anytime. The help file is available online also right here. :yes
http://www.indigorose.com/webhelp/ams60/index.htm
In AMS tables are the name for arrays. Think of a table as a big mailbox with lots of individual slots. Each individual slot has a unique ID number, and you can freely add/retrieve/edit data to or from any of those slots.
Some people prefer to visualize tables as grids. Think of an egg carton for example. Twelve slots, numbered 1 thru 12, each of which can contain data. That's basically how that works. I realize you probably already understand arrays, just though I'd post this for extra clarification. :)
Intrigued
01-29-2006, 05:16 PM
That's cool. I did not know about Turing, either the man or the programming platform.
:yes
Corey
01-29-2006, 05:25 PM
I read a book on computational analysis which had some stuff about him, it was the most incredibly boring book I've ever read. I forced myself through it purely as an excercise in dicispline. I can barely remember any of it but the one concept which stuck with me is "thin slicing". I'm convinced that the ability to thin slice is the basis for increased intelligence. There's lots of emerging evidence to back that up:
http://www.eurekalert.org/pub_releases/2005-11/uoo-dds111805.php
Without exception, high-capacity individuals excelled at dismissing blue, but low-capacity individuals held all of the rectangles in mind.
Apparently it's all about the ability to reject non-essential info. I believe this is essentially true. :yes
AmyGrrl
01-29-2006, 05:44 PM
mm... thank you ...I finally got it to check if daemone.exe is found or not found.... thanks.... now I just need to finish with the dialog box showing that it's searching the Hard Drive
function DaemonSearchStatus()
end
function DaemonSearch()
DaemonFind = File.Find(_SourceDrive, "daemon.exe", true, false, nil, nil);
if (nil ~= DaemonFind) then
result = Dialog.Message("Notice", "Daemon.exe Found.", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
else
result = Dialog.Message("Notice", "Daemon.exe Not Found.", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
end
end
DaemonSearch();
AmyGrrl
01-29-2006, 07:41 PM
I've been working on getting the Status Window to appear, and it works, finally figured out how to have it come up, change the Title, Show a message saying Please wait while we search the Hard Drive... even a Cancel button I can use to cancel the search. But what I can't figure out is how to get it to show the location of the files it's searched on the hard drive.... if you don't use the Call Back Fuction, thats what it normally shows... I have the SetStatusTest to nil for the moment. I keep searching the forums and help file... but can't find a anwser
function DaemonSearchStatus()
StatusDlg.Show(MB_ICONNONE, false);
StatusDlg.SetTitle("Daemon Tools Was Not Found In Default Folder");
StatusDlg.SetMessage("Please Wait While We Search Your Hard Drive For Daemon.exe...");
StatusDlg.SetStatusText(nil);
StatusDlg.ShowCancelButton(true, "Cancel Search")
if StatusDlg.IsCancelled() then
StatusDlg.Hide();
return false;
else
return true;
end
end
function DaemonSearch()
DaemonFind = File.Find(_SourceDrive, "daemon.exe", true, false, DaemonSearchStatus, nil);
if (nil ~= DaemonFind) then
StatusDlg.Hide();
Dialog.Message("Notice", "Daemon.exe Found.", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
else
StatusDlg.Hide();
Dialog.Message("Notice", "Daemon.exe Not Found.", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
end
end
DaemonSearch();
Powered by vBulletin™ Version 4.0.6 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.