cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
DonAIR
Level 6

LaunchAppAndWait .xml file

We are passing our created logs out as xml files now, for a cleaner look. If we find an error (FileGrep) we are trying to launch the .xml file. I am looking for a way to launch it so it uses the machines default program (IE or notepad). The code below doesn't work trying to just launch the actual XML file, so I was wondering if there was a way to do this. Code I am using below


nResult = FileGrep ( PROGRAMFILES64^"AIR"^"Logs"^File.xml, "ErrorMessage" , sReturnLine , nLineNumber , RESTART );
if (nResult != 0) then
nResult = FileGrep ( PROGRAMFILES64^"AIR"^"Logs"^File.xml, "WarningMessage" , sReturnLine , nLineNumber , RESTART );
endif;

if (nResult = 0) then
nResult = AskYesNo ("Errors happened during the installation. Would you like to view the log now?",YES);
if (nResult = 1) then
LaunchAppAndWait(PROGRAMFILES64^"AIR"^"Logs"^File.xml,"", LAAW_OPTION_NOWAIT);
endif;
endif;
Labels (1)
0 Kudos
(2) Replies
ch_eng
Level 7

DonAIR,

My guess as to why it's not working is because you are trying to use the xml file as the szProgram argument of LaunchAppAndWait. The first argument for LaunchAppAndWait has to be the actual program you are launching - in this case, you would need to specify IE or notepad explicitly. The second argument for your example (which you have as "") should actually be the path to the xml file. To figure out what is the default program for opening XML files, you might need to dig around in the Windows Registry under HKEY_CLASSES_ROOT\.xml


example using notepad:

LaunchAppAndWait( WINSYSDIR ^ "notepad.exe", PROGRAMFILES64 ^ "AIR" ^ "Logs" ^ "File.xml", LAAW_OPTION_NOWAIT );


HTH
0 Kudos
DonAIR
Level 6

ch_eng wrote:
DonAIR,

My guess as to why it's not working is because you are trying to use the xml file as the szProgram argument of LaunchAppAndWait. The first argument for LaunchAppAndWait has to be the actual program you are launching - in this case, you would need to specify IE or notepad explicitly. The second argument for your example (which you have as "") should actually be the path to the xml file. To figure out what is the default program for opening XML files, you might need to dig around in the Windows Registry under HKEY_CLASSES_ROOT\.xml


example using notepad:

LaunchAppAndWait( WINSYSDIR ^ "notepad.exe", PROGRAMFILES64 ^ "AIR" ^ "Logs" ^ "File.xml", LAAW_OPTION_NOWAIT );


HTH


thanks, I figured as much, the issue though is we don't know where IE is installed, since IE can be installed to a different path unlike notepad, there is no fool proof path or system variable for IE. More than likely its Program Files\Internet Explorer but it could be changed. I guess I plan to just assume its the default location, since its a non-critical open anyways.
0 Kudos