
Robot-Entwicklerhandbuch
Sie können die folgenden Methoden und Eigenschaften in Ihre benutzerdefinierte Anwendung oder Webseite aufnehmen.
init-Methode ist optional. Sie gibt die IRobotSDK-Instanz zurück, mit der Sie sie als Variable für die spätere Verwendung speichern können.
const robot = UiPathRobot.init();const robot = UiPathRobot.init();settings vom Typ Einstellungen können Sie die Standardportnummer und das Abfrageintervall in Millisekunden ändern oder das Senden von Telemetriedaten deaktivieren.
const robot = UiPathRobot.init();
robot.settings.portNumber = 1234;
robot.settings.pollTimeInterval = 1000;
robot.settings.disableTelemetry = true;const robot = UiPathRobot.init();
robot.settings.portNumber = 1234;
robot.settings.pollTimeInterval = 1000;
robot.settings.disableTelemetry = true;on wird verwendet, um Ereignishandler an das SDK anzufügen.
consent-prompt und missing-components .
Das UiPath JavaScript SDK verfügt über ein integriertes Zustimmungs-Overlay, das jedes Mal angezeigt wird, wenn Ihre benutzerdefinierte Anwendung oder Webseite eine Verbindung mit dem Roboter herstellen muss.
Dieses Zustimmungs-Overlay kann mit einem benutzerdefinierten Handler überschrieben werden.
const robot = UiPathRobot.init();
robot.on('consent-prompt', consentCode => console.log(consentCode));const robot = UiPathRobot.init();
robot.on('consent-prompt', consentCode => console.log(consentCode));missing-components wird ausgelöst, wenn der Robot JS-Dienst nicht ausgeführt wird. In diesem Fall zeigt das SDK einen Fehler an, der mit einem benutzerdefinierten Handler überschrieben werden kann.
const robot = UiPathRobot.init();
robot.on('missing-components', () => console.log('Missing Components'));const robot = UiPathRobot.init();
robot.on('missing-components', () => console.log('Missing Components'));Before being shown the consent prompt you might be asked to allow the browser to open a uipath-web URL in the associated application.
By default, RobotJS will automatically try to open this URL, but users can override this behavior by providing a custom event handler.
const robot = UiPathRobot.init();
robot.on('open-uipath-protocol', (protocolUrl) => console.log('RobotJS protocol URL: ' + protocolUrl));const robot = UiPathRobot.init();
robot.on('open-uipath-protocol', (protocolUrl) => console.log('RobotJS protocol URL: ' + protocolUrl));getProcesses -Methode ruft die Liste der verfügbaren Prozesse ab. Gibt eine Zusage an ein Array von RobotProcess- Objekten zurück. Wenn der Roboter mit dem Orchestrator verbunden ist, ruft er die Prozesse aus der Umgebung und dem Ordner ab, zu dem der Roboter gehört. Andernfalls werden lokale Prozesse abgerufen.
const robot = UiPathRobot.init();
const processes = await robot.getProcesses();
for(let i=0; i<processes.length; i++){
console.log(processes[i].name + " (" + processes[i].description + ") - Id=" + processes[i].id);
}const robot = UiPathRobot.init();
const processes = await robot.getProcesses();
for(let i=0; i<processes.length; i++){
console.log(processes[i].name + " (" + processes[i].description + ") - Id=" + processes[i].id);
}inputArgumentsSchema eines installierten Prozesses können Sie die Eingabeargumente eines Prozesses abrufen. Bevor Sie die Eigenschaft inputArgumentsSchema verwenden, müssen Sie zuerst den Prozess installieren.
installProcess installiert einen Prozess und gibt eine Zusage an ein Objekt vom Typ InstallProcessResult zurück, das einen Array von InputArgumentSchema-Objekten enthält.
const robot = UiPathRobot.init();
const processes = await robot.getProcesses();
const installedProcess = await robot.installProcess(processes[0].id);
for(let i=0; i<installedProcess.inputArgumentsSchema.length; i++){
console.log("Argument " + i + ":");
console.log(" name: " + installedProcess.inputArgumentsSchema[i].name)
console.log(" type: " + installedProcess.inputArgumentsSchema[i].type)
console.log(" isRequired: " + installedProcess.inputArgumentsSchema[i].isRequired)
console.log(" hasDefault: " + installedProcess.inputArgumentsSchema[i].hasDefault)
}const robot = UiPathRobot.init();
const processes = await robot.getProcesses();
const installedProcess = await robot.installProcess(processes[0].id);
for(let i=0; i<installedProcess.inputArgumentsSchema.length; i++){
console.log("Argument " + i + ":");
console.log(" name: " + installedProcess.inputArgumentsSchema[i].name)
console.log(" type: " + installedProcess.inputArgumentsSchema[i].type)
console.log(" isRequired: " + installedProcess.inputArgumentsSchema[i].isRequired)
console.log(" hasDefault: " + installedProcess.inputArgumentsSchema[i].hasDefault)
}install eines RobotProcess-Objekts verwendet werden, um einen Prozess zu installieren.
const robot = UiPathRobot.init();
const processes = await robot.getProcesses();
const myProcess = processes.find(p => p.name === "MyProcess");
const installedProcess = await myProcess.install();const robot = UiPathRobot.init();
const processes = await robot.getProcesses();
const myProcess = processes.find(p => p.name === "MyProcess");
const installedProcess = await myProcess.install();startJob empfängt eine bereits erstellte Job und startet diese. Sie gibt eine Zusage an ein Objekt vom Typ JobResult zurück, das die Ausgabeargumente enthält.
createJob erstellt einen Roboterauftrag mit der Prozess-ID. Kann optional die Auftragseingabeargumente empfangen. Sie gibt ein Auftragsobjekt zurück.
robot = UiPathRobot.init();
processes = await robot.getProcesses();
const calculatorProcess = processes.find(p => p.name.includes('Calculator'));
const arguments = {
"input1" : 23,
"input2" : 42,
"operation" : "add"
};
const job = robot.createJob(calculatorProcess.id, arguments);
const result = await robot.startJob(job);
console.log(result.Sum);robot = UiPathRobot.init();
processes = await robot.getProcesses();
const calculatorProcess = processes.find(p => p.name.includes('Calculator'));
const arguments = {
"input1" : 23,
"input2" : 42,
"operation" : "add"
};
const job = robot.createJob(calculatorProcess.id, arguments);
const result = await robot.startJob(job);
console.log(result.Sum);robot = UiPathRobot.init();
processes = await robot.getProcesses();
const calculatorProcess = processes.find(p => p.name.includes('Calculator'));
const arguments = {
"input1" : 23,
"input2" : 42,
"operation" : "add"
};
const job = new Job(calculatorProcess.id, arguments);
const result = await robot.startJob(job);
console.log(result.Sum);robot = UiPathRobot.init();
processes = await robot.getProcesses();
const calculatorProcess = processes.find(p => p.name.includes('Calculator'));
const arguments = {
"input1" : 23,
"input2" : 42,
"operation" : "add"
};
const job = new Job(calculatorProcess.id, arguments);
const result = await robot.startJob(job);
console.log(result.Sum);on des Job -Objekts wird verwendet, um Ereignishandler an den Auftrag anzufügen. Die verfügbaren Ereignisse sind status und workflow-event .
status wird während der Auftragsausführung jedes Mal ausgelöst, wenn sich der Status des Auftrags geändert hat.
Dieses Ereignis wird auch jedes Mal ausgelöst, wenn die Aktivität ReportStatus ausgeführt wird.
const robot = UiPathRobot.init();
const job = robot.createJob('processId');
job.on('status', robotStatus => console.log(robotStatus));
await robot.startJob(job);const robot = UiPathRobot.init();
const job = robot.createJob('processId');
job.on('status', robotStatus => console.log(robotStatus));
await robot.startJob(job);workflow-event wird während der Auftragsausführung jedes Mal ausgelöst, wenn eine Aktivität ausgeführt wird, die ein Workflowereignis sendet. Es ist die Unterstützung für die Implementierung von Teilergebnissen mithilfe der Aktivität „Send Interim Results “. Der Event Handler hat ein Argument vom Typ WorkflowEventData.
const robot = UiPathRobot.init();
const job = robot.createJob('processId');
job.on('workflow-event', e => console.log(e.name));
await robot.startJob(job);const robot = UiPathRobot.init();
const job = robot.createJob('processId');
job.on('workflow-event', e => console.log(e.name));
await robot.startJob(job);start des Objekts RobotProcess wird verwendet, um einen Prozess zu starten, indem ihm Eingabeargumente übergeben werden, falls verfügbar.
Es gibt ein Objekt vom Typ JobPromise zurück.
const robot = UiPathRobot.init();
const processes = await robot.getProcesses();
const myProcess = processes.find(p => p.name === "MyProcess");
const arguments = {
"a" : 41,
"b" " 27
};
const result = await myProcess.start(arguments);const robot = UiPathRobot.init();
const processes = await robot.getProcesses();
const myProcess = processes.find(p => p.name === "MyProcess");
const arguments = {
"a" : 41,
"b" " 27
};
const result = await myProcess.start(arguments);onStatus wird verwendet, um einen Ereignishandler an das Statusereignis des Auftrags anzufügen.
const robot = UiPathRobot.init();
const processes = await robot.getProcesses();
const myProcess = processes.find(p => p.name === "MyProcess");
const result = await myProcess.start().onStatus(status => console.log(status));const robot = UiPathRobot.init();
const processes = await robot.getProcesses();
const myProcess = processes.find(p => p.name === "MyProcess");
const result = await myProcess.start().onStatus(status => console.log(status));onWorkflowEvent wird verwendet, um einen Ereignishandler an das Ereignis „workflow-event“ des Auftrags anzufügen.
const robot = UiPathRobot.init();
const processes = await robot.getProcesses();
const myProcess = processes.find(p => p.name === "MyProcess");
const result = await myProcess.start().onWorkflowEvent(e => console.log(e.name));const robot = UiPathRobot.init();
const processes = await robot.getProcesses();
const myProcess = processes.find(p => p.name === "MyProcess");
const result = await myProcess.start().onWorkflowEvent(e => console.log(e.name));stopProcess wird verwendet, um einen ausgeführten Roboterprozess zu stoppen.
Sie gibt eine Zusage zurück, die bei erfolgreichem Abbruch des laufenden Roboterprozesses aufgelöst wird.
const robot = UiPathRobot.init();
const processes = await robot.getProcesses();
const myProcess = processes.find(p => p.name === "MyProcess");
const result = await myProcess.start();
await robot.stopProcess(myProcess);const robot = UiPathRobot.init();
const processes = await robot.getProcesses();
const myProcess = processes.find(p => p.name === "MyProcess");
const result = await myProcess.start();
await robot.stopProcess(myProcess);interface IRobotSDK {
settings: Settings;
getProcesses(): Promise<Array<RobotProcess>>;
init(): IRobotSDK;
on(eventName: string, callback: (argument?: any) => void): void;
startJob(job: Job): Promise<JobResult>;
stopProcess(process: RobotProcess): Promise<void>;
installProcess(processId: string): Promise<InstallProcessResult>;
}interface IRobotSDK {
settings: Settings;
getProcesses(): Promise<Array<RobotProcess>>;
init(): IRobotSDK;
on(eventName: string, callback: (argument?: any) => void): void;
startJob(job: Job): Promise<JobResult>;
stopProcess(process: RobotProcess): Promise<void>;
installProcess(processId: string): Promise<InstallProcessResult>;
}class Settings {
portNumber: number;
pollTimeInterval: number;
disableTelemetry: boolean;
}class Settings {
portNumber: number;
pollTimeInterval: number;
disableTelemetry: boolean;
}class RobotProcess {
id: string;
name: string;
description?: string;
start: (inArguments?: any) => JobPromise;
install: () => Promise<InstallProcessResult>;
}class RobotProcess {
id: string;
name: string;
description?: string;
start: (inArguments?: any) => JobPromise;
install: () => Promise<InstallProcessResult>;
}class InstallProcessResult {
inputArgumentsSchema: InputArgumentSchema[]
}class InstallProcessResult {
inputArgumentsSchema: InputArgumentSchema[]
}class InputArgumentSchema {
name: string;
type: string;
isRequired: boolean;
hasDefault: boolean;
}class InputArgumentSchema {
name: string;
type: string;
isRequired: boolean;
hasDefault: boolean;
}class JobPromise {
onStatus(eventHanlder: (argument?: any) => void): JobPromise;
onWorkflowEvent(eventHanlder: (argument?: any) => void): JobPromise;
}class JobPromise {
onStatus(eventHanlder: (argument?: any) => void): JobPromise;
onWorkflowEvent(eventHanlder: (argument?: any) => void): JobPromise;
}class Job {
processId: string;
argument?: any;
jobId: string;
on(eventName: string, eventHanlder: (argument?: any) => void): void;
}class Job {
processId: string;
argument?: any;
jobId: string;
on(eventName: string, eventHanlder: (argument?: any) => void): void;
}- Methoden und Eigenschaften
- Init
- Einstellungen
- Auf
- Zustimmungsaufforderung
- fehlende-Komponenten
- open-uipath-protocol
- Prozesse erhalten (Get Processes)
- Schema für Eingabeargumente abrufen
- Job starten (Start Job)
- Auftrag auf
- Status
- Workflow-Ereignis
- Prozess starten (Start Process)
- Status „Prozess ein“
- Prozess bei Workflowereignis
- Prozess anhalten (Stop Process)
- Modelldefinitionen
- IRobotSDK
- Einstellungen
- RobotProcess
- InstallProcessResult
- EingabeArgumentSchema
- Auftragsversprechen
- Auftrag
- JobResult
- WorkflowEventData