Geoff MacCue
Have you tried dropping into a shell command from your synergy program and running the DSQUERY from there
XCALL SHELL (,'CMD')
Have you tried using the "CMD /C DSQUERY …" within you synergy shell code
XCALL SHELL (,'CMD /C dsquery user -samid "chrisa" | dsget user -email > c:\fleetfactors\data\tmp\chrisa.log')
You may need to put the full path name for dsquery and dsget (or add their path to the PATH logical)
Have you tried using the PIPE | in an open
OPEN (CHN=%SYN_FREECHN,I,'|CMD /C dsquery user -samid "chrisa" | dsget user -email')
You may need to put the full path name for dsquery and dsget (or add their path to PATH)
The command "WHERE DSQUERY" should display the full path name of the application, run this from where you can successfully execute you dsquery command. similarly for DSGET
I found both DSQUERY and DSGET using dir /s dsquery.exe from C:\
To work in your application you will need to include these paths in the PATH env variable.
I have worked out how to enable permissions within SYNERGY Code (as well as for batch files) using a single line of code.
I won't publish it here, but you can have a batch file to which you pass parameters (username etc) and it will return to your synergy program the output
If you want the "enable Permissions" code let me know, no guarantees it will work everywhere but I have tried on three different systems and versions of Windows. I was able to launch REGEDIT from synergy DBR.
eg xcall shell (,'batch.bat chrisa filename)
and it will put the resulting data in filename
I wrap it up in an xcall to keep it simple
xcall open_command (channel,command,r_error)
while (r_error == 0) begin
reads (channel,data,eof) ; read output from command
do something with the data
end
eof,
continue
-------------------------------------------------------
Samples using other methods
record
chn ,d4
proc
open (15,o,'tt:')
xcall shell (,'cmd') ; drop out to command prompt, see if you can run DSQUERY
stop
----------------------------------------------------------
record
data ,a500
chn ,d4
proc
open (15,o,'tt:')
open (chn=%syn_freechn,I,'|cmd /c dir') ; get dir information
loop,
reads (chn,data,eof)
writes (15,%atrim(data))
goto loop
eof,
stop
-----------------------------------------------------------
record
data ,a500
chn ,d4
proc
open (15,o,'tt:')
xcall shell (,'cmd /c dir > dir.lst') ; get dir information into a work file and read it
open (chn=%syn_freechn,i,'dir.lst')
loop,
reads (chn,data,eof)
writes (15,%atrim(data))
goto loop
eof,
stop