MCPcopy Create free account
hub / github.com/AutoHotkey/AutoHotkey-v1.0 / Script

Method Script

Source/script.cpp:41–111  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

39
40
41Script::Script()
42 : mFirstLine(NULL), mLastLine(NULL), mCurrLine(NULL)
43 , mLoopFile(NULL), mLoopRegItem(NULL), mLoopReadFile(NULL), mLoopField(NULL), mLoopIteration(0)
44 , mThisHotkeyName(""), mPriorHotkeyName(""), mThisHotkeyStartTime(0), mPriorHotkeyStartTime(0)
45 , mEndChar(0), mThisHotkeyModifiersLR(0)
46 , mOnExitLabel(NULL), mExitReason(EXIT_NONE)
47 , mFirstLabel(NULL), mLastLabel(NULL)
48 , mFirstTimer(NULL), mLastTimer(NULL), mTimerEnabledCount(0), mTimerCount(0)
49 , mFirstMenu(NULL), mLastMenu(NULL), mMenuCount(0)
50 , mFirstVar(NULL), mLastVar(NULL)
51 , mLineCount(0), mLabelCount(0), mVarCount(0), mGroupCount(0)
52#ifdef AUTOHOTKEYSC
53 , mCompiledHasCustomIcon(false)
54#endif;
55 , mCurrFileNumber(0), mCurrLineNumber(0), mNoHotkeyLabels(true), mMenuUseErrorLevel(false)
56 , mFileSpec(""), mFileDir(""), mFileName(""), mOurEXE(""), mOurEXEDir(""), mMainWindowTitle("")
57 , mIsReadyToExecute(false), AutoExecSectionIsRunning(false)
58 , mIsRestart(false), mIsAutoIt2(false), mErrorStdOut(false)
59 , mLinesExecutedThisCycle(0), mUninterruptedLineCountMax(1000), mUninterruptibleTime(15)
60 , mRunAsUser(NULL), mRunAsPass(NULL), mRunAsDomain(NULL)
61 , mCustomIcon(NULL) // Normally NULL unless there's a custom tray icon loaded dynamically.
62 , mCustomIconFile(NULL), mIconFrozen(false), mTrayIconTip(NULL) // Allocated on first use.
63 , mCustomIconNumber(0)
64{
65 // v1.0.25: mLastScriptRest and mLastPeekTime are now initialized right before the auto-exec
66 // section of the script is launched, which avoids an initial Sleep(10) in ExecUntil
67 // that would otherwise occur.
68 *mThisMenuItemName = *mThisMenuName = '\0';
69 ZeroMemory(&mNIC, sizeof(mNIC)); // Constructor initializes this, to be safe.
70 mNIC.hWnd = NULL; // Set this as an indicator that it tray icon is not installed.
71
72 // Lastly (after the above have been initialized), anything that can fail:
73 if ( !(mTrayMenu = AddMenu("Tray")) ) // realistically never happens
74 {
75 ScriptError("No tray mem");
76 ExitApp(EXIT_CRITICAL);
77 }
78 else
79 mTrayMenu->mIncludeStandardItems = true;
80
81#ifdef _DEBUG
82 if (ID_FILE_EXIT < ID_MAIN_FIRST) // Not a very thorough check.
83 ScriptError("DEBUG: ID_FILE_EXIT is too large (conflicts with IDs reserved via ID_USER_FIRST).");
84 if (MAX_CONTROLS_PER_GUI > ID_USER_FIRST - 3)
85 ScriptError("DEBUG: MAX_CONTROLS_PER_GUI is too large (conflicts with IDs reserved via ID_USER_FIRST).");
86 int LargestMaxParams, i, j;
87 ActionTypeType *np;
88 // Find the Largest value of MaxParams used by any command and make sure it
89 // isn't something larger than expected by the parsing routines:
90 for (LargestMaxParams = i = 0; i < g_ActionCount; ++i)
91 {
92 if (g_act[i].MaxParams > LargestMaxParams)
93 LargestMaxParams = g_act[i].MaxParams;
94 // This next part has been tested and it does work, but only if one of the arrays
95 // contains exactly MAX_NUMERIC_PARAMS number of elements and isn't zero terminated.
96 // Relies on short-circuit boolean order:
97 for (np = g_act[i].NumericParams, j = 0; j < MAX_NUMERIC_PARAMS && *np; ++j, ++np);
98 if (j >= MAX_NUMERIC_PARAMS)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected