FUNCTION MB_Call() AS LONG '
'--------------------------------------------------------------------------------------------------+
'- Execute the macro in a seperate thread in case it loops |
'--------------------------------------------------------------------------------------------------+
LOCAL idThread AS DWORD '
LOCAL Arg, RetVal, i, j, WC, WinCtr, lRet AS LONG '
LOCAL MSG, t AS STRING '
gMacNoLoopTest = %False: gMacroTrace = %False ' Reset Users no loop check flag and Trace flag
gMacThread = CreateThread(BYVAL %Null, 0, CODEPTR(MB_CallThread), BYREF Arg, _ '
%THREAD_TERMINATE OR %THREAD_QUERY_INFORMATION, _ '
BYVAL VARPTR(idThread)) '
IF gMacThread <> %INVALID_HANDLE_VALUE THEN '
DO '
WC = WaitForSingleObject(gMacThread, 10000) ' Give macro 10 seconds to execute
SELECT CASE WC ' What came back?
CASE %WAIT_ABANDONED '
'- '
CASE %WAIT_OBJECT_0 ' Thread did its job and ended by itself
GetExitCodeThread(gMacThread, Retval) '
TP.CsrRow = TP.GPTop: TP.CsrCol = TP.GPCmdCol ' Reset the command line
TP.ErrMsgReset ' Clear intermediate errors
IF gMacroRC > 0 OR gMacroMsg <> "" THEN ' Something to issue?
TP.ErrMsgAdd(gMacroRC, gMacroMsg) ' Issue the RC and Msg
'--------------------------------------------------------------------------------+
'- If error in line command, clear comamnd line |
'--------------------------------------------------------------------------------+
IF IsFMTab THEN ' If FM then
j = IIF(gFMMacMode = 1, %True, %False) ' Use gFMMacMode
ELSE '
j = IIF(gEDMacMode = 1, %True, %False) ' Use gEDMacMode
END IF '
IF j THEN TP.pCommand = "" ' Null Cmd if a line command
END IF '
CloseHandle gMacThread ' Clear handle
gMacroMode = %False ' Turn off Macro mode
KbdPopRestore ' Reset popup state
TP.AttnDo = (TP.AttnDo OR %Refresh) ' Ask for refresh
DoStatusBar($AllStatusBarBoxes) ' re-Do the StatusBar box in case something's changed
EXIT DO ' Done
CASE %WAIT_TIMEOUT ' Delay is over, see what to do
IF gMacNoLoopTest THEN ITERATE DO ' User says to ignore loops
IF GetWindowHandle("thinBasic :: Script RunTime error!", WinCtr) THEN ITERATE DO ' If thinbasic telling of an error, also exit
MSG = "Macro may be looping," + $CRLF + "Select OK, to ignore loop and continue execution," + $CRLF + _ '
"Select Cancel to terminate the macro" '
i = DoMessageBox(MSG, %MB_USERICON OR %MB_OKCANCEL, "SPFLite Macro Loop Intercept") '
IF i = %IDOK THEN ' Continue?
ITERATE DO ' Just keep waiting
ELSE '
TerminateThread BYVAL gMacThread, 999 ' Second value is thread exit code
SLEEP 500 ' Give thread time to end
GetExitCodeThread(gMacThread, Retval) '
CloseHandle gMacThread ' Call CloseHandle after TerminateThread
TP.ErrMsgAdd(%eFail, "Macro was terminated") '
KbdPopRestore ' Do final reset
TP.AttnDo = (TP.AttnDo OR %Refresh) ' Ask for refresh
gMacroMode = %False ' Turn off Macro mode
EXIT DO '
END IF '
CASE ELSE
'
END SELECT '
LOOP '
ELSE '
TP.ErrMsgAdd(%eFail, "Unable to start macro thread") '
END IF '
IF ghDBFn <> 0 THEN ' A DebugLog Active?
CLOSE # ghDBFn ' Close it
RESET ghDBFn, ghDBFName ' Reset file info
END IF '
TP.CsrRow = TP.GPTop: TP.CsrCol = TP.GPCmdCol ' reset the command line
gLTblRange = %False ' Reset line ranges
END FUNCTION '
SUB MB_CallThread() '
'--------------------------------------------------------------------------------------------------+
'- Handle the MACRO BASIC format |
'--------------------------------------------------------------------------------------------------+
LOCAL BasicPgm AS STRING, RCA AS RCArea '
LOCAL hLib_thinCore AS LONG ' Handle of thinCore.dll library
LOCAL hProc_thinBasic_Init AS LONG ' Handle to Init function
LOCAL hProc_thinBasic_LoadSymbol AS LONG ' Handle to LoadSymbol function
LOCAL hProc_thinBasic_AddIncludePath AS LONG ' Handle to AddIncludePath function
LOCAL hProc_thinBasic_AddVariable AS LONG ' Handle to AddVariable function
LOCAL hProc_thinBasic_AddEquate AS LONG ' Handle to AddEquate function
LOCAL hProc_thinBasic_Run AS LONG ' Handle to Run function
LOCAL hProc_thinBasic_Release AS LONG ' Handle to Release function
LOCAL lRet, i, j AS LONG '
gMacroRC = 0: gMacroMsg = "" ' Clear the RC and Msg
'-----------------------------------------------------------------------------------------------+
'- Save the Line control context at start of macro |
'-----------------------------------------------------------------------------------------------+
gMacRange = gLTblRange ' Line control range at Macro start
gMacSCmd = TRIM$(gLTblSCmd) '
gMacSFrom = gLTblSFrom '
gMacSTo = gLTblSTo '
gMacSRpt = gLTblSRpt '
gMacSFlag = gLTblSFlag '
gMacDCmd = TRIM$(gLTblDCmd) '
gMacDFrom = gLTblDFrom '
gMacDTo = gLTblDTo '
gMacDRpt = gLTblDRpt '
gMacDFlag = gLTblDFlag '
'-----------------------------------------------------------------------------------------------+
'- Open and load thinCore.dll library |
'-----------------------------------------------------------------------------------------------+
hLib_thinCore = LoadLibraryA( BYCOPY "thinCore.Dll" ) '
'-----------------------------------------------------------------------------------------------+
'- If all went fine |
'-----------------------------------------------------------------------------------------------+
IF hLib_thinCore THEN ' thinCore exists
gMacCore = hLib_thinCore ' Save Core address
'--------------------------------------------------------------------------------------------+
'- Try to load the functions |
'--------------------------------------------------------------------------------------------+
hProc_thinBasic_Init = GetProcAddress(hLib_thinCore, BYCOPY "thinBasic_Init") '
hProc_thinBasic_LoadSymbol = GetProcAddress(hLib_thinCore, BYCOPY "thinBasic_LoadSymbol") '
hProc_thinBasic_AddVariable = GetProcAddress(hLib_thinCore, BYCOPY "thinBasic_AddVariable") '
hProc_thinBasic_AddIncludePath = GetProcAddress(hLib_thinCore, BYCOPY "thinBasic_AddIncludePath") '
hProc_thinBasic_AddEquate = GetProcAddress(hLib_thinCore, BYCOPY "thinBasic_AddEquate") '
hProc_thinBasic_Run = GetProcAddress(hLib_thinCore, BYCOPY "thinBasic_Run" ) '
hProc_thinBasic_Release = GetProcAddress(hLib_thinCore, BYCOPY "thinBasic_Release" ) '
gMacRelease = hProc_thinBasic_Release ' Save release for global use
'--------------------------------------------------------------------------------------------+
'- If all went fine ... |
'--------------------------------------------------------------------------------------------+
IF hProc_thinBasic_Init AND _ '
hProc_thinBasic_LoadSymbol AND _ '
hProc_thinBasic_AddVariable AND _ '
hProc_thinBasic_AddIncludePath AND _ '
hProc_thinBasic_AddEquate AND _ '
hProc_thinBasic_Run AND _ '
hProc_thinBasic_Release THEN '
'-----------------------------------------------------------------------------------------+
'- Initialise all necessary functions etc. |
'-----------------------------------------------------------------------------------------+
CALL DWORD hProc_thinBasic_Init USING thinBasic_Init(0, ghInstance, "thinBasic") '
'-----------------------------------------------------------------------------------------+
'- Add our Macro paths to thinBasic's #INCLUDE path |
'-----------------------------------------------------------------------------------------+
IF ISNULL(gMaclib) THEN ' If no MACLIB overrides
CALL DWORD hProc_thinBasic_AddIncludePath USING thinBasic_AddIncludePath(gENV.HomeData + "MACROS\") '
ELSE ' If there IS a MACLIB
FOR i = 1 TO PARSECOUNT(gMacLibList, ";") ' Add each file in the list
CALL DWORD hProc_thinBasic_AddIncludePath USING thinBasic_AddIncludePath(PARSE$(gMaclibList, ";", i)) '
NEXT i '
END IF '
CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("DELETE_GBL_NUM", %thinBasic_ReturnCodeLong, CODEPTR(Delete_GBLNUM)) '
CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("DELETE_GBL_STR", %thinBasic_ReturnCodeLong, CODEPTR(Delete_GBLSTR)) '
CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("DROP_HANDLE$", %thinBasic_ReturnString, CODEPTR(Drop_HANDLE)) '
CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("FIRST_HANDLE$", %thinBasic_ReturnString, CODEPTR(First_Handle)) '
CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("HALT", %thinBasic_ReturnNumber, CODEPTR(HALT)) '
CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("HAS_HANDLE", %thinBasic_ReturnNumber, CODEPTR(Has_HANDLE)) '
'
' A whole bunch more LoadSymbols
'
CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("IS_AVAILABLE", %thinBasic_ReturnNumber, CODEPTR(ISAVAILABLEF)) '
CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("IS_BOTTOM", %thinBasic_ReturnNumber, CODEPTR(IS_BOTTOM)) '
CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("IS_Cmd_Name$", %thinBasic_ReturnString, CODEPTR(ISCmdName)) '
CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("IS_DATA", %thinBasic_ReturnNumber, CODEPTR(IS_DATA)) '
CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("IS_WORD", %thinBasic_ReturnNumber, CODEPTR(IS_WORD)) '
CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("IS_MARK", %thinBasic_ReturnNumber, CODEPTR(IS_MARK)) '
CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("IS_MASK", %thinBasic_ReturnNumber, CODEPTR(IS_MASK)) '
CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("IS_NOTE", %thinBasic_ReturnNumber, CODEPTR(IS_NOTE)) '
CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("IS_PROF", %thinBasic_ReturnNumber, CODEPTR(IS_PROF)) '
CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("IS_TABS", %thinBasic_ReturnNumber, CODEPTR(IS_TABS)) '
CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("IS_TOP", %thinBasic_ReturnNumber, CODEPTR(IS_TOP)) '
CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("IS_ULINE", %thinBasic_ReturnNumber, CODEPTR(IS_ULINE)) '
CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("IS_XMARKER", %thinBasic_ReturnNumber, CODEPTR(IS_XMARKER)) '
CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("IS_BNDS", %thinBasic_ReturnNumber, CODEPTR(IS_BNDS)) '
CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("IS_COLS", %thinBasic_ReturnNumber, CODEPTR(IS_COLS)) '
CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("IS_FILE", %thinBasic_ReturnNumber, CODEPTR(IS_FILE)) '
CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("IS_XLINE", %thinBasic_ReturnNumber, CODEPTR(IS_XLine)) '
CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("IS_PRIMARY_CMD", %thinBasic_ReturnNumber, CODEPTR(IS_PrimCmd)) '
CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("IS_LINE_CMD", %thinBasic_ReturnNumber, CODEPTR(IS_LineCmd)) '
CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("IS_FM", %thinBasic_ReturnCodeLong, CODEPTR(IS_FM)) '
CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("LAST_HANDLE$", %thinBasic_ReturnString, CODEPTR(Last_Handle)) '
CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("NEXT_HANDLE$", %thinBasic_ReturnString, CODEPTR(Next_Handle)) '
CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("NOP", %thinBasic_ReturnNumber, CODEPTR(NOP)) '
CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("OF", %thinBasic_ReturnNumber, CODEPTR(OV)) '
CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("PREV_HANDLE$", %thinBasic_ReturnString, CODEPTR(Prev_Handle)) '
CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("REQUEST_LABEL$", %thinBasic_ReturnString, CODEPTR(Get_Handle)) '
CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("RELEASE_LABEL$", %thinBasic_ReturnString, CODEPTR(Drop_HANDLE)) '
CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("RESET_GBL_NUM", %thinBasic_ReturnNumber, CODEPTR(Reset_GBLNUM)) '
CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("RESET_GBL_STR", %thinBasic_ReturnNumber, CODEPTR(Reset_GBLSTR)) '
CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("Restore_SrchArgs", %thinBasic_ReturnNumber, CODEPTR(ParseLoad)) '
CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("Save_SrchArgs", %thinBasic_ReturnNumber, CODEPTR(ParseSave)) '
CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("SET_CLR_LINE", %thinBasic_ReturnNumber, CODEPTR(SET_ClrLine)) '
CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("SET_CSR", %thinBasic_ReturnNumber, CODEPTR(SET_CSR)) '
CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("SET_LCSR", %thinBasic_ReturnNumber, CODEPTR(SET_LCSR)) '
CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("SET_LINE", %thinBasic_ReturnNumber, CODEPTR(SET_LINE)) '
CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("SET_MARK", %thinBasic_ReturnNumber, CODEPTR(SET_MARK)) '
CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("SET_MASK", %thinBasic_ReturnNumber, CODEPTR(SET_MASK)) '
CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("SET_MSG", %thinBasic_ReturnNumber, CODEPTR(SET_MSG)) '
CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("SET_SETVAR", %thinBasic_ReturnNumber, CODEPTR(SET_SETVAR)) '
CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("SET_GBL_NUM", %thinBasic_ReturnNumber, CODEPTR(SET_GBLNUM)) '
CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("SET_GBL_STR", %thinBasic_ReturnNumber, CODEPTR(SET_GBLSTR)) '
CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("SET_TABS", %thinBasic_ReturnNumber, CODEPTR(SET_TABS)) '
CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("SET_TOPSCRN_LPTR", %thinBasic_ReturnNumber, CODEPTR(SET_TOPSCREEN)) '
CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("SET_WORD", %thinBasic_ReturnNumber, CODEPTR(SET_WORD)) '
CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("SPF_CMD", %thinBasic_ReturnNumber, CODEPTR(SPF_CMD)) '
CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("SPF_COMMENT", %thinBasic_ReturnNumber, CODEPTR(SPF_COMMENT)) '
CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("SPF_DEBUG", %thinBasic_ReturnNumber, CODEPTR(SPF_Debug)) '
CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("SPF_DEBUGLOG", %thinBasic_ReturnNumber, CODEPTR(SPF_DebugLog)) '
CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("SPF_TRACE", %thinBasic_ReturnNumber, CODEPTR(SPF_Trace)) '
CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("SPF_EXEC", %thinBasic_ReturnNumber, CODEPTR(SPF_EXEC)) '
CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("SPF_EXEMPT_FILE", %thinBasic_ReturnNumber, CODEPTR(SPF_Exempt_File)) '
CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("SPF_FMLCmd", %thinBasic_ReturnCodeLong, CODEPTR(FMRun_LCmd)) '
CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("SPF_INS", %thinBasic_ReturnNumber, CODEPTR(SPF_INS)) '
CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("SPF_INVCHARS$", %thinBasic_ReturnString, CODEPTR(SPF_INVCHARS)) '
CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("SPF_OVR", %thinBasic_ReturnNumber, CODEPTR(SPF_OVR)) '
CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("SPF_LOOP_CHECK", %thinBasic_ReturnNumber, CODEPTR(SPF_LOOPCHECK)) '
CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("SPF_OVR_REP", %thinBasic_ReturnNumber, CODEPTR(SPF_OVR_REP)) '
CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("SPF_PARSE", %thinBasic_ReturnNumber, CODEPTR(SPF_PARSE)) '
CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("SPF_POST_DO", %thinBasic_ReturnNumber, CODEPTR(SPF_POST_DO)) '
CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("SPF_REP", %thinBasic_ReturnNumber, CODEPTR(SPF_REP)) '
CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("SPF_QUOTE$", %thinBasic_ReturnString, CODEPTR(SPF_QUOTE)) '
CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("SPF_SpellChk$", %thinBasic_ReturnString, CODEPTR(MacSpellChk)) '
CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("SPF_UNQUOTE$", %thinBasic_ReturnString, CODEPTR(SPF_UNQUOTE)) '
CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("SPF_SHELL", %thinBasic_ReturnNumber, CODEPTR(SPF_SHELL)) '
CALL DWORD hProc_thinBasic_LoadSymbol USING thinBasic_LoadSymbol("SPF_TRY", %thinBasic_ReturnNumber, CODEPTR(SPF_TRY)) '
CALL DWORD hProc_thinBasic_AddVariable USING thinBasic_AddVariable("OK", "", 0, %EquateTypeNumber) '
CALL DWORD hProc_thinBasic_AddVariable USING thinBasic_AddVariable("WARN", "", 8, %EquateTypeNumber) '
CALL DWORD hProc_thinBasic_AddVariable USING thinBasic_AddVariable("FAIL", "", 8, %EquateTypeNumber) '
CALL DWORD hProc_thinBasic_AddVariable USING thinBasic_AddVariable("ON", "", 1, %EquateTypeNumber) '
CALL DWORD hProc_thinBasic_AddVariable USING thinBasic_AddVariable("OFF", "", 0, %EquateTypeNumber) '
CALL DWORD hProc_thinBasic_AddVariable USING thinBasic_AddVariable("ERROR", "", 2, %EquateTypeNumber) '
CALL DWORD hProc_thinBasic_AddVariable USING thinBasic_AddVariable("YES", "", 1, %EquateTypeNumber) '
CALL DWORD hProc_thinBasic_AddVariable USING thinBasic_AddVariable("NO", "", 0, %EquateTypeNumber) '
CALL DWORD hProc_thinBasic_AddVariable USING thinBasic_AddVariable("SYNC", "", 0, %EquateTypeNumber) '
CALL DWORD hProc_thinBasic_AddVariable USING thinBasic_AddVariable("ASYNC", "", 1, %EquateTypeNumber) '
CALL DWORD hProc_thinBasic_AddVariable USING thinBasic_AddVariable("NORMAL","", 1, %EquateTypeNumber) '
CALL DWORD hProc_thinBasic_AddVariable USING thinBasic_AddVariable("HIDDEN","", 0, %EquateTypeNumber) '
CALL DWORD hProc_thinBasic_AddVariable USING thinBasic_AddVariable("ARG_OPT","", 256, %EquateTypeNumber) ' X'00000100'
CALL DWORD hProc_thinBasic_AddVariable USING thinBasic_AddVariable("ARG_DEF","", 512, %EquateTypeNumber) ' X'00000200'
CALL DWORD hProc_thinBasic_AddVariable USING thinBasic_AddVariable("ARG_VAR","", 1024, %EquateTypeNumber) ' X'00000400'
CALL DWORD hProc_thinBasic_AddVariable USING thinBasic_AddVariable("FM_EQU_FLISTData", "", 0, %EquateTypeNumber) '
CALL DWORD hProc_thinBasic_AddVariable USING thinBasic_AddVariable("FM_EQU_FilePath", "", 1, %EquateTypeNumber) '
CALL DWORD hProc_thinBasic_AddVariable USING thinBasic_AddVariable("FM_EQU_Recent", "", 2, %EquateTypeNumber) '
CALL DWORD hProc_thinBasic_AddVariable USING thinBasic_AddVariable("FM_EQU_Found", "", 3, %EquateTypeNumber) '
CALL DWORD hProc_thinBasic_AddVariable USING thinBasic_AddVariable("FM_EQU_Opened", "", 4, %EquateTypeNumber) '
CALL DWORD hProc_thinBasic_AddVariable USING thinBasic_AddVariable("FM_EQU_Favorites", "", 5, %EquateTypeNumber) '
CALL DWORD hProc_thinBasic_AddVariable USING thinBasic_AddVariable("FM_EQU_FLISTS", "", 6, %EquateTypeNumber) '
CALL DWORD hProc_thinBasic_AddVariable USING thinBasic_AddVariable("FM_EQU_Paths", "", 7, %EquateTypeNumber) '
CALL DWORD hProc_thinBasic_AddVariable USING thinBasic_AddVariable("FM_EQU_Configs", "", 8, %EquateTypeNumber) '
CALL DWORD hProc_thinBasic_AddVariable USING thinBasic_AddVariable("FM_EQU_Profiles", "", 8, %EquateTypeNumber) '
CALL DWORD hProc_thinBasic_AddVariable USING thinBasic_AddVariable("FM_EQU_DirUp", "", 1, %EquateTypeNumber) '
CALL DWORD hProc_thinBasic_AddVariable USING thinBasic_AddVariable("FM_EQU_DirDown", "", 2, %EquateTypeNumber) '
CALL DWORD hProc_thinBasic_AddVariable USING thinBasic_AddVariable("FM_EQU_File", "", 3, %EquateTypeNumber) '
CALL DWORD hProc_thinBasic_AddVariable USING thinBasic_AddVariable("FM_EQU_Path", "", 4, %EquateTypeNumber) '
CALL DWORD hProc_thinBasic_AddVariable USING thinBasic_AddVariable("FM_EQU_FList", "", 5, %EquateTypeNumber) '
CALL DWORD hProc_thinBasic_AddVariable USING thinBasic_AddVariable("FM_EQU_Profile", "", 6, %EquateTypeNumber) '
CALL DWORD hProc_thinBasic_AddVariable USING thinBasic_AddVariable("FM_EQU_READONLY", "", &H00000001, %EquateTypeNumber) '
CALL DWORD hProc_thinBasic_AddVariable USING thinBasic_AddVariable("FM_EQU_HIDDEN", "", &H00000002, %EquateTypeNumber) '
CALL DWORD hProc_thinBasic_AddVariable USING thinBasic_AddVariable("FM_EQU_SYSTEM", "", &H00000004, %EquateTypeNumber) '
CALL DWORD hProc_thinBasic_AddVariable USING thinBasic_AddVariable("FM_EQU_DIRECTORY", "", &H00000010, %EquateTypeNumber) '
CALL DWORD hProc_thinBasic_AddVariable USING thinBasic_AddVariable("FM_EQU_ARCHIVE", "", &H00000020, %EquateTypeNumber) '
CALL DWORD hProc_thinBasic_AddVariable USING thinBasic_AddVariable("FM_EQU_DATA_FILE", "", 1, %EquateTypeNumber) '
CALL DWORD hProc_thinBasic_AddVariable USING thinBasic_AddVariable("FM_EQU_BACKUP_DATA", "", 2, %EquateTypeNumber) '
CALL DWORD hProc_thinBasic_AddVariable USING thinBasic_AddVariable("FM_EQU_BACKUP_STATE", "", 3, %EquateTypeNumber) '
CALL DWORD hProc_thinBasic_AddVariable USING thinBasic_AddVariable("FM_EQU_NORMAL_FOLDER", "", 1, %EquateTypeNumber) '
CALL DWORD hProc_thinBasic_AddVariable USING thinBasic_AddVariable("FM_EQU_BACKUP_FOLDER", "", 2, %EquateTypeNumber) '
CALL DWORD hProc_thinBasic_AddVariable USING thinBasic_AddVariable("DATA", "", 1, %EquateTypeNumber)
CALL DWORD hProc_thinBasic_AddVariable USING thinBasic_AddVariable("gTabsNum", "", gTabsNum, %VarSubType_Long, VARPTR(gTabsNum))
CALL DWORD hProc_thinBasic_AddVariable USING thinBasic_AddVariable("gMacroName$", gMacroName, 0, %VarMainType_IsString, 0, 0, 0, 0, 0)
'-----------------------------------------------------------------------------------------+
'- Run the program |
'-----------------------------------------------------------------------------------------+
BasicPgm = JOIN$(gMaclines(), $CRLF) + $CRLF ' Join the array together
gMacroMode = %True ' Flag we are in Macro Mode
KbdPopSave ' Ready for pop-up
CALL DWORD hProc_thinBasic_Run USING thinBasic_RUN( _ '
0& , _ 'Will be used in future release
BasicPgm , _ 'File name or string Buffer
%thinBasic_BufferType_IsScript , _ 'Previous op is a File Name, or previous op is a string Buffer
(1 OR 2) , _ 'Options (See below)
%FALSE , _ 'Debug Mode %TRUE/%FALSE
%FALSE , _ 'Log Mode %TRUE/%FALSE
%FALSE , _ 'Obfuscate Mode %TRUE/%FALSE
1& , _ 'Calling Program 1=thinBasic, 2=Console
%FALSE _ 'Dependancy Mode %TRUE/%FALSE
) TO lRet '
' Option 1 = use base directory from the executable running thinBasic_Run
' else thinBasic itself
' Option 2 = In case of script run-time ERROR, DO NOT CLOSE calling application too.
' If this option is omitted, thinBasic will fire a PostQuitMessage
'-----------------------------------------------------------------------------------------+
'- Unload all modules, release all memory |
'-----------------------------------------------------------------------------------------+
CALL DWORD hProc_thinBasic_Release USING thinBasic_Release(0& _ 'Will be used in future release
) TO lRet '
'-----------------------------------------------------------------------------------------+
'- Free loaded thinCore library |
'-----------------------------------------------------------------------------------------+
FreeLibrary(hLib_thinCore) '
ELSE '
TP.ErrMsgAdd(%eFail, "Internal thinBasic functions not found") ' Error
END IF '
ELSE '
TP.ErrMsgAdd(%eFail, "thinBasic does not appear to be installed") ' Say why we didn't do it
END IF '
END SUB '