cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
hh1234
Level 5

FindFile Command

I have tried just about ever syntax combo I can think of on this code and it will NOT compile.

function OnFirstUIBefore()
number nResult, nLevel, nSize, nSetupType;
string szTitle, szMsg, szOpt1, szOpt2, szLicenseFile;
string szName, szCompany, szTargetPath, szDir, szFeatures;
BOOL bLicenseAccepted;


#define FILE_SPEC "notepad.exe"
#define SEARCH_DIR "C:\Winodws"
#define TITLE_TEXT "InstallScript Sucks!!"

STRING svResult;


begin
FindFile (SEARCH_DIR, FILE_SPEC, svResult);
MessageBox (TITLE_TEXT, svResult );
end;


I've wrapped each variable in quotes, no quotes etc....etc... and nothing works.

What am I not doing?
Labels (1)
0 Kudos
(4) Replies
CoreyZ
Level 5

hh1234 wrote:
I have tried just about ever syntax combo I can think of on this code and it will NOT compile.

function OnFirstUIBefore()
number nResult, nLevel, nSize, nSetupType;
string szTitle, szMsg, szOpt1, szOpt2, szLicenseFile;
string szName, szCompany, szTargetPath, szDir, szFeatures;
BOOL bLicenseAccepted;


#define FILE_SPEC "notepad.exe"
#define SEARCH_DIR "C:\Winodws"
#define TITLE_TEXT "InstallScript Sucks!!"

STRING svResult;


begin
FindFile (SEARCH_DIR, FILE_SPEC, svResult);
MessageBox (TITLE_TEXT, svResult );
end;


I've wrapped each variable in quotes, no quotes etc....etc... and nothing works.

What am I not doing?


If its a direct copy/paste of your script... it could be that you misspelled the directory name wrong "c:\Winodws" instead of "c:\windows"
0 Kudos
hh1234
Level 5

Even when Windows is spelled right it still fails 🙂 No matter what I try it will not compile.

How hard can it be to search for a file? I came from Wise Script Editor which blows this tool away. With Wise you don't have to define anything you just do it. Question for you and this board......do you actually have to add a bunch of #define command every time you want to search for a file or a reg key?
0 Kudos
alegerlotz
Level 7

Check the parameters you're supplying to the functions.

One obvious thing, without even looking at the help is that MessageBox takes a string followed by a message type (INFORMATION|WARNING|SEVERE) as parameters...
0 Kudos
Earthshine
Level 4

you need two \\ to make one \ in real life

from the documentation:
/*--------------------------------------------------------------*\ 
*
* InstallShield Example Script
*
* Demonstrates the FindFile function.
*
* FindFile is called to search for the file Config.sys in the
* root of drive C.
*
\*--------------------------------------------------------------*/

#define FILE_SPEC "Config.sys"
#define SEARCH_DIR "C:\\"
#define TITLE_TEXT "FindFile Example"

// Include Ifx.h for built-in InstallScript function prototypes.
#include "Ifx.h"

export prototype ExFn_FindFile(HWND);

function ExFn_FindFile(hMSI)
STRING svResult;
begin


if (FindFile (SEARCH_DIR, FILE_SPEC, svResult) < 0) then
MessageBox ("FindFile failed.", SEVERE);
else
SprintfBox (INFORMATION, TITLE_TEXT, "Found: %s in %s.", svResult,
SEARCH_DIR);
endif;

end;
0 Kudos