Пример #1
0
        /// <summary>
        /// Run some code instantly.  The thread will be paused until the code
        /// has finished executing.
        /// </summary>
        /// <param name="Code">The AutoHotkey code to be run</param>
        /// <returns>The output of the code</returns>
        public static string Exec(string Code)
        {
            // prefix is inserted before each executed line.  The variable
            // name was choosen because it's generally bad practice to use
            // variable names starting with "A_" due to their use as built-
            // in-variables.  The user may also refer to A_LASTRETURN in
            // following lines of code.
            const string prefix = "A_LASTRETURN := ";

            AhkDllFlat.ahkExec(prefix + Code);
            return(AutoHotkey.Var["A_LASTRETURN"]);
        }
Пример #2
0
 /// <summary>
 /// Execute code instantly discarding the result.
 /// </summary>
 /// <param name="Code">The AutoHotkey code to be run</param>
 /// <returns>true for sucess, otherwise false</returns>
 public static bool ExecSimple(string Code)
 {
     return(AhkDllFlat.ahkExec(Code));
 }