----------------------------Mike - success and failure!
My RMD file runs fine in R:Base and with no errors in trace but nothing happens.
I have copied and pasted my version of what you posted along with the BAT file
that is supposed to be run. You'll notice some comments of mine which I added
as I was working through. I've left them as they are since they seem as good a
way of any of explaining where I've got to and gone wrong.
Any further help will be muchly appreciated.
*( FileName: AttribChange.RMD ... ... Date of last amendment: 06/08/2008 )
*( Run a batch file with parameters in silent mode )
{
ShellExecute.rmd example by Mike Byerley
The Windows API declaration of Shellexecute:
HINSTANCE ShellExecute( HWND hwnd,
LPCTSTR lpOperation,
LPCTSTR lpFile,
LPCTSTR lpParameters,
LPCTSTR lpDirectory,
INT nShowCmd
);
Syntax located at: http://msdn.microsoft.com/en-us/library/bb762153(VS.85).aspx
}
-- ---------------------------------------------------------------------------
-- Pre-define all variable types to null:
-- ---------------------------------------------------------------------------
SET VAR nShowCmd INTEGER = NULL
SET VAR lpDirectory TEXT = NULL
SET VAR lpParameters TEXT = NULL
SET VAR lpFile TEXT = NULL
SET VAR lpOperation TEXT = NULL
SET VAR HWND INTEGER = NULL
SET VAR vRetVal INTEGER = NULL -- not used?
-- SET VAR vi INTEGER = NULL ??
-- ---------------------------------------------------------------------------
-- Set variable values:
-- ---------------------------------------------------------------------------
SET VAR vTestParams TEXT = 'D: -H -R' -- Variable parameters to be passed in
later...
SET VAR nShowCmd = 0 -- SW_HIDE
SET VAR lpDirectory = NULL -- Full path in lpFile (Repeated - DELETE?)
SET VAR lpFile = 'C:\DosPrograms\Attrib.BAT'
SET VAR lpParameters = .vTestParams
SET VAR lpOperation = 'open'
SET VAR HWND = 0 -- since it runs hidden, pass HWND as null
SET VAR vRetVal = NULL -- (Repeated - vi ??)
-- ---------------------------------------------------------------------------
-- Process:
-- ---------------------------------------------------------------------------
IF (chkfunc('ShellExecuteA')) = 0 THEN
STDCALL function 'ShellExecuteA' ALIAS 'ShellExecute' +
(Integer, ptr TEXT (256), ptr TEXT (128), +
ptr TEXT (128), ptr TEXT (32), Integer) : Integer
ENDIF
-- STDCALL part of DLCALL (DLLCALL in help link from CHKFUNC!)??
SET VAR vi = (dlcall('shell32.dll', 'ShellExecuteA', +
nShowCmd, lpDirectory, lpParameters, lpFile, lpOperation, HWND))
-- consistantly returns 42 - implying success (>32) Should this be vRetVal?
-- ---------------------------------------------------------------------------
-- Tidy-up and return/exit:
-- ---------------------------------------------------------------------------
LABEL lEnd
CLEAR VAR nShowCmd, lpDirectory, lpParameters, lpFile, lpOperation, HWND,
vRetVal, vi
RETURN
*( End of program )
Attrib.BAT:
rem @ECHO OFF
rem Parameters:
rem First = DriveColon - C: D: etc
rem Second = +H or -H
rem Third = +R or -R
rem
rem eg: C:\DosPrograms\Attrib.BAT D: +H +R
rem
rem CLS
rem ECHO.
rem ECHO.
rem ECHO Re-Setting attributes...
rem the above are a bit pointless if it's invisible anyway!
%1
CD \ALMANAC
ATTRIB %2 *.* /S
CD _VIEWER
ATTRIB %3 *.*
C:
EXIT
Regards,
Alastair
----------------------------
Alastair Burr
St. Albans, UK.
[EMAIL PROTECTED]
-----------------------------