7. Februar 2014 09:58
7. Februar 2014 10:22
7. Februar 2014 10:51
7. Februar 2014 12:23
CurrPage.SetSelectionFilter(myDebitorRecordVariable);
If myDebitorRecordVariable.findset then begin
........
end;
8. Februar 2014 13:36
"C:\ECM\TEST\Connect 3\Shell.exe"
"ObjectSwitch@@PAR:object=Kunde@@PAR:objectvalue="No.""
8. Februar 2014 14:07
CREATE(WSHShell);
varDMS := '"ObjectSwitch@@PAR:object=Kunde@@PAR:objectvalue=' + "No." + '"'
WSHShell.Run('"C:\ECM\TEST\Connect 3\Shell.exe"', varDMS);
CLEAR(WSHShell);
8. Februar 2014 19:13
varDMS := '"C:\ECM\TEST\Connect 3\Shell.exe" "ObjectSwitch@@PAR:object=Kunde@@PAR:objectvalue=' + "No." + '"';
runModally := FALSE;
windowState := 1;
CREATE(WSHSHELL,FALSE,TRUE);
WSHSHELL.Run(varDMS,windowState,runModally);
MESSAGE(varDMS);
CLEAR(WSHSHELL);
10. Februar 2014 11:19
IF varNr <> "No." THEN BEGIN //Connect nur einmal pro DebitorNr ansteuern
  varDMS := '"C:\ECM\TEST\Connect 3\Shell.exe" "ObjectSwitch@@PAR:object=Kunde@@PAR:objectvalue=' +  "No." + '"';
  runModally := FALSE;
  windowState := 1;
  CREATE(WSHSHELL,FALSE,TRUE);
  WSHSHELL.Run(varDMS,windowState,runModally);
  //MESSAGE(varDMS);
  CLEAR(WSHSHELL);
END;
varNr := "No.";
10. Februar 2014 12:02
IF ISCLEAR(wshshell) THEN
13. Februar 2014 21:41
1. März 2014 12:00
3. März 2014 13:09
fuige hat geschrieben:Was ich bräuchte wäre die Möglichkeit zu prüfen ob "C:\ECM\TEST\Connect 3\Shell.exe"bereits läuft
7. März 2014 15:01
ich finde einen OnAfterGetRecord aber leider nicht den OnAfterGetCurrRecord.
xRec := Rec;
UpdateSystemIndicator20. März 2014 16:42
//WmiProccessRunning(pHost : Text[30];pExefile : Text[100]) pRunning : Boolean
//----------------------------------------------------------------------------
  //# oWmiSWbemLocator   Automation   'Microsoft WMI Scripting V1.2 Library'.SWbemLocator
  //# oWmiSWbemServices   Automation   'Microsoft WMI Scripting V1.2 Library'.SWbemServices
  //# oWmiSWbemObjectSet   Automation   'Microsoft WMI Scripting V1.2 Library'.SWbemObjectSet
  //# lSelect   Text      250
  // WmiProccessRunning : läuft Programm (Task) ?
  IF pHost = '' THEN
    pHost := '.';
  IF ISCLEAR(oWmiSWbemLocator) THEN
    CREATE(oWmiSWbemLocator);
  oWmiSWbemServices := oWmiSWbemLocator.ConnectServer(pHost);
  lSelect := STRSUBSTNO ('select name, description from Win32_Process where name="%1"', pExefile)
  oWmiSWbemObjectSet := oWmiSWbemServices.ExecQuery(lSelect);
  IF (oWmiSWbemObjectSet.Count > 0) THEN
    pRunning := TRUE
  ELSE
    pRunning := FALSE;20. März 2014 16:46
28. März 2014 08:41
//WmiProccessRunning(pHost : Text[30];pExefile : Text[100]) pRunning : Boolean
//----------------------------------------------------------------------------
  //# oWmiSWbemLocator   Automation   'Microsoft WMI Scripting V1.2 Library'.SWbemLocator
  //# oWmiSWbemServices   Automation   'Microsoft WMI Scripting V1.2 Library'.SWbemServices
  //# oWmiSWbemObjectSet   Automation   'Microsoft WMI Scripting V1.2 Library'.SWbemObjectSet
  //# lSelect   Text      250
  // WmiProccessRunning : läuft Programm (Task) ?
  IF pHost = '' THEN
    pHost := '.';
  IF ISCLEAR(oWmiSWbemLocator) THEN
    CREATE(oWmiSWbemLocator);
  oWmiSWbemServices := oWmiSWbemLocator.ConnectServer(pHost);
  //lSelect := STRSUBSTNO ('select name, description from Win32_Process where name="%1"', pExefile);
  lSelect := STRSUBSTNO ('select name from Win32_Process where name="%1"', pExefile);
  
  oWmiSWbemObjectSet := oWmiSWbemServices.ExecQuery(lSelect);
  
  IF (oWmiSWbemObjectSet.Count > 0) THEN
    pRunning := TRUE
  ELSE
    pRunning := FALSE;
message('%1', prunning);3. April 2014 09:11
7. April 2014 10:45
7. April 2014 10:52
Creates an Automation object.
[Ok :=] CREATE(Automation [,NewServer] [,OnClient])
Parameters
Automation
Type: Automation
A variable that has previously been declared.
NewServer
Type: Boolean
If NewServer is false (the default), CREATE will try to reuse an already running instance of the automation server referenced by Automation before creating a new instance. If NewServer is true, CREATE will always create a new instance of the automation server.
OnClient
Type: Boolean
If OnClient is false (the default), then the Automation object is created on the Microsoft Dynamics NAV Server. If OnClient is true, then the Automation object is created on the client.
This parameter is only valid when you run the function on the RoleTailored client. On the Classic client, the Automation object is always created on the client.
Property Value/Return Value
 IF ISCLEAR(oWmiSWbemLocator) THEN
    CREATE(oWmiSWbemLocator,TRUE,TRUE);
8. April 2014 07:26
oWmiSWbemObjectSet.Count8. April 2014 15:03
22. April 2014 11:26
strComputer = "."  
Set colProcesses = GetObject("winmgmts:" & _  
   "{impersonationLevel=impersonate}!\\" & strComputer & _  
   "\root\cimv2").ExecQuery("Select * from Win32_Process")  
 
For Each objProcess in colProcesses  
 
    Return = objProcess.GetOwner(strNameOfUser)  
    If Return <> 0 Then  
        Wscript.Echo "Could not get owner info for process " & _    
            objProcess.Name & VBNewLine _  
            & "Error = " & Return  
    Else   
        Wscript.Echo "Process " _  
            & objProcess.Name & " is owned by " _   
            & "\" & strNameOfUser & "."  
    End If  
Next 
22. April 2014 11:47
 ).
 ).Name             DataType      Subtype    Length
BSTRConverter    Automation    'Navision Attain Hash 1.0'.BSTRConverter    
ScriptControl    Automation    'Microsoft Script Control 1.0'.ScriptControl    
txtCR            Text                     30
txtCode          Text                     1024CountProcessByOwner(ProcessName : Text[150];ProcessOwner : Text[30]) RetVal : Integer
IF ProcessName = '' THEN
  EXIT;
CREATE(ScriptControl,TRUE);
CREATE(BSTRConverter,TRUE);
ScriptControl.Language := 'VBScript';
ScriptControl.AddObject('BSTRConverter',BSTRConverter);
txtCR := ' ';
txtCR[1] := 13;
txtCode := 'strComputer = "."' + txtCR +
           'Set objWMIService = GetObject("winmgmts:" _' + txtCR +
           '& "{impersonationLevel=impersonate}!\\" _' + txtCR +
           '& strComputer & "\root\cimv2")' + txtCR +
           'Set colProcessList = objWMIService.ExecQuery _' + txtCR +
           STRSUBSTNO('("Select * from Win32_Process Where Name = ''%1''")',ProcessName) + txtCR +
           'For Each objProcess in colProcessList' + txtCR;
IF ProcessOwner <> '' THEN
  txtCode += 'colProperties = objProcess.getowner(strOwner,strDomain)' + txtCR +
             STRSUBSTNO('If strOwner = "%1" then',ProcessOwner) + txtCR;
txtCode += 'i = i + 1' + txtCR;
IF ProcessOwner <> '' THEN
  txtCode += 'End if' + txtCR;
txtCode += 'Next' + txtCR +
           'BSTRConverter.AppendNextStringPortion(i)';
ScriptControl.ExecuteStatement(txtCode);
IF BSTRConverter.BSTR <> '' THEN
  EVALUATE(RetVal,BSTRConverter.BSTR);
CLEAR(ScriptControl);
CLEAR(BSTRConverter);14. Mai 2014 15:35
//>> Prüfen ob ProzessXYZ.exe läuft
ausfuehren := WmiProccessRunning('','ProzessXYZ.exe');
IF ausfuehren = TRUE THEN BEGIN
   UserSetup."DMS aktiv" := TRUE;
   UserSetup.MODIFY;
END ELSE BEGIN
   UserSetup."DMS aktiv" := FALSE;
   UserSetup.MODIFY;
END;
//<< Prüfen ob ProzessXYZ.exe läuft
//>>Funktion zum ermitteln ob der beim Aufruf übergebene Prozess für den ausführenden Benutzer läuft
  IF pHost = '' THEN
    pHost := '.';
  IF ISCLEAR(oWmiSWbemLocator) THEN
    CREATE(oWmiSWbemLocator,TRUE,TRUE);
  oWmiSWbemServices := oWmiSWbemLocator.ConnectServer(pHost);
  
  lSelect := STRSUBSTNO ('select name from Win32_Process where name="%1"', pExefile);
  
  oWmiSWbemObjectSet := oWmiSWbemServices.ExecQuery(lSelect);
 
  FOR i := 0 TO oWmiSWbemObjectSet.Count-1 DO BEGIN
    oWmiSWbemObject := oWmiSWbemObjectSet.ItemIndex(i);
    
    owner := oWmiSWbemObject.ExecMethod_('GetOwner');
    properties := owner.Properties_;
    property := properties.Item('USER');
    user := FORMAT(property.Value);
    //property := properties.Item('DOMAIN');
    //domain := FORMAT(property.Value);
        
    IF user = USERID THEN myProcesses += 1;
  END;
  
  IF ((oWmiSWbemObjectSet.Count > 0) AND (myProcesses > 0)) THEN
    pRunning := TRUE
  ELSE
    pRunning := FALSE;
//<<Funktion zum ermitteln ob der beim Aufruf übergebene Prozess für den ausführenden Benutzer läuft//>> Ansteuern des DMS Programm
varUSERSETUP.SETFILTER(varUSERSETUP."User ID", USERID);
varUSERSETUP.FINDFIRST;
IF varUSERSETUP."DMS aktiv" = TRUE THEN BEGIN //>>CU-1 hinterlegt "DMS aktiv" beim NAV Start in UserSetup
  IF varNr <> "No." THEN BEGIN //DMS nur einmal pro Kontakt beim Bewegen durch die Übersicht ansteuern
    //>> varDMS beinhaltet den Aufrufparameter zum ansteuern des DMS Programm pro Kontakt
    varDMS := '......';
    
    runModally := FALSE;
    windowState := 1;
    CREATE(WSHSHELL,FALSE,TRUE);
    WSHSHELL.Run(varDMS,windowState,runModally);
    CLEAR(WSHSHELL);
  END;
END;
varNr := "No.";
//<< Ansteuern des DMS Programm