예제 #1
0
        protected override void Execute(CodeActivityContext context)
        {
            var filename    = Filename.Get(context);
            var script      = Script.Get(context);
            var function    = Function.Get(context);
            var newinstance = NewInstance.Get(context);
            var param1      = Param1.Get(context);
            var param2      = Param2.Get(context);
            var param3      = Param3.Get(context);
            var param4      = Param4.Get(context);

            if (sharpAHK.ahkGlobal.ahkdll == null || newinstance)
            {
                New_AHKSession(newinstance);
            }
            if (!sharpAHK.ahkGlobal.ahkdll.FunctionExists(function))
            {
                if (!string.IsNullOrEmpty(filename))
                {
                    sharpAHK.ahkGlobal.ahkdll.LoadFile(filename);
                }
                else
                {
                    sharpAHK.ahkGlobal.ahkdll.LoadScript(script);
                }
            }
            if (!sharpAHK.ahkGlobal.ahkdll.FunctionExists(function))
            {
                throw new ArgumentNullException("Function '" + function + "' does not exists");
            }
            var result = sharpAHK.ahkGlobal.ahkdll.ExecFunction(function, param1, param2, param3, param4);

            Result.Set(context, result);
        }