Skip to main content

Looking for some examples for windows, I've created a csv file and want to open it using the default program for that particular workstation.  I'm not a windows guy so my development experience is very limited in the MS world.

The online docs provide an example of calling ADVAPI32.DLL to get user-name but i'm struggling on how ultimately call the LaunchFileAsync method.  

Here is a snipit of code that I'm using.

CALL "advapi32.dll" 
    ON EXCEPTION
       PERFORM CSV-DLL-ERR-RTN
       EXIT PARAGRAPH
END-CALL
CALL "Windows.System.Launcher.dll"
    ON EXCEPTION
       PERFORM CSV-DLL-ERR-RTN
       EXIT PARAGRAPH
END-CALL
MOVE CSV-FIL-NAM TO CSV-VAR-NAME
SET CSV-VAR-SIZE TO SIZE OF CSV-VAR-NAME
CALL "LaunchFileAsync"
    USING
       BY REFERENCE CSV-VAR-NAME
       BY REFERENCE CSV-VAR-SIZE
    ON EXCEPTION
       PERFORM CSV-CALL-ERR-RTN
END-CALL

Thanks

Chris


#windowsapi
#AcuGT

Looking for some examples for windows, I've created a csv file and want to open it using the default program for that particular workstation.  I'm not a windows guy so my development experience is very limited in the MS world.

The online docs provide an example of calling ADVAPI32.DLL to get user-name but i'm struggling on how ultimately call the LaunchFileAsync method.  

Here is a snipit of code that I'm using.

CALL "advapi32.dll" 
    ON EXCEPTION
       PERFORM CSV-DLL-ERR-RTN
       EXIT PARAGRAPH
END-CALL
CALL "Windows.System.Launcher.dll"
    ON EXCEPTION
       PERFORM CSV-DLL-ERR-RTN
       EXIT PARAGRAPH
END-CALL
MOVE CSV-FIL-NAM TO CSV-VAR-NAME
SET CSV-VAR-SIZE TO SIZE OF CSV-VAR-NAME
CALL "LaunchFileAsync"
    USING
       BY REFERENCE CSV-VAR-NAME
       BY REFERENCE CSV-VAR-SIZE
    ON EXCEPTION
       PERFORM CSV-CALL-ERR-RTN
END-CALL

Thanks

Chris


#windowsapi
#AcuGT

You could try this:

MOVE SPACE TO WK_CALLSYSTEM.

STRING "start " CSV-FIL-NAM DELIMITED BY SIZE INTO WK_CALLSYSTEM.

CALL "C$SYSTEM" USING WK_CALLSYSTEM, 225.


You could try this:

MOVE SPACE TO WK_CALLSYSTEM.

STRING "start " CSV-FIL-NAM DELIMITED BY SIZE INTO WK_CALLSYSTEM.

CALL "C$SYSTEM" USING WK_CALLSYSTEM, 225.

Thank you . It does work!

You could try this:

MOVE SPACE TO WK_CALLSYSTEM.

STRING "start " CSV-FIL-NAM DELIMITED BY SIZE INTO WK_CALLSYSTEM.

CALL "C$SYSTEM" USING WK_CALLSYSTEM, 225.

As mentioned, it did work for what I need, so again Thank you!

It doesn't work if there is a space in the naming of the file (it will stop and say that it can't find the filename displaying up to the first space character in the file name.  I tried putting the filename double quotes but it will just dump you to the command line and not open the file.  


As mentioned, it did work for what I need, so again Thank you!

It doesn't work if there is a space in the naming of the file (it will stop and say that it can't find the filename displaying up to the first space character in the file name.  I tried putting the filename double quotes but it will just dump you to the command line and not open the file.  

Hi,

could you try this ?

MOVE SPACE TO WK_CALLSYSTEM.

STRING "start "
QUOTES "test" QUOTES
" "
QUOTES CSV-FIL-NAM QUOTES
DELIMITED BY SIZE INTO WK_CALLSYSTEM.

CALL "C$SYSTEM" USING WK_CALLSYSTEM, 225.

It doesn't matter what the first argument is.

 


Hi,

could you try this ?

MOVE SPACE TO WK_CALLSYSTEM.

STRING "start "
QUOTES "test" QUOTES
" "
QUOTES CSV-FIL-NAM QUOTES
DELIMITED BY SIZE INTO WK_CALLSYSTEM.

CALL "C$SYSTEM" USING WK_CALLSYSTEM, 225.

It doesn't matter what the first argument is.

 

that resolved it. Any insight in why that works?