-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSetVariable.cs
46 lines (37 loc) · 1.19 KB
/
SetVariable.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
using System;
using Robin.Core;
using Robin.Core.Attributes;
using System.ComponentModel;
using System.Windows.Forms;
using sharpAHK;
namespace Modules.AhkTest8
{
[Action(Order = 5)]
[Throws("ActionError")] // TODO: change error name (or delete if not needed)
public class SetVar : ActionBase
{
[InputArgument]
public AutoHotkey.Interop.AutoHotkeyEngine AhkEngine { get; set; }
[InputArgument, DefaultValue("a")]
public string AhkVariable { get; set; }
[InputArgument, DefaultValue("z")]
public string NewValue { get; set; }
[OutputArgument, DefaultValue("Variable set.")]
public string AhkResult { get; set; }
public override void Execute(ActionContext context)
{
try
{
var ahk = AhkEngine;
ahk.SetVar(AhkVariable, NewValue);
AhkResult = ("Variable set.");
}
catch (Exception e)
{
if (e is ActionException) throw;
throw new ActionException("ActionError", e.Message, e.InnerException);
}
// TODO: set values to Output Arguments here
}
}
}