Jump to content

Search the Community

Showing results for tags 'define macros pre processor'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • General
    • Announcements and Site News
    • Administration
  • AutoIt v3
    • AutoIt Help and Support
    • AutoIt Technical Discussion
    • AutoIt Example Scripts
  • Scripting and Development
    • Developer General Discussion
    • Language Specific Discussion
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Categories

  • AutoIt Team
    • Beta
    • MVP
  • AutoIt
    • Automation
    • Databases and web connections
    • Data compression
    • Encryption and hash
    • Games
    • GUI Additions
    • Hardware
    • Information gathering
    • Internet protocol suite
    • Maths
    • Media
    • PDF
    • Security
    • Social Media and other Website API
    • Windows
  • Scripting and Development
  • IT Administration
    • Operating System Deployment
    • Windows Client
    • Windows Server
    • Office

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Member Title


Location


WWW


Interests

Found 1 result

  1. So I'm thinking about creating a preprocessor for AutoIt and was wondering on whether you had any ideas? Thanks. Quick idea: #include <Array.au3> #include <Constants.au3> #define MSGOK = 4096 #define MATCHSTRING = "This is some simple string" & @CRLF #define PI = 3.14159 Local $sScriptFileData = 'MsgBox(#MSGOK, "", "")' & @CRLF & @CRLF & 'StringInStr("Some string example",#MATCHSTRING, "#PI") ; #PI shouldn''t be expanded in strings.' Local Const $aMacros = PreProcessorMacros(@ScriptFullPath) ;~ _ArrayDisplay($aMacros) For $i = 1 To $aMacros[0][0] $sScriptFileData = StringRegExpReplace($sScriptFileData, '#\b' & $aMacros[$i][0] & '\b', $aMacros[$i][1]) Next MsgBox($MB_SYSTEMMODAL, '', $sScriptFileData) Func PreProcessorMacros($sFilePath) Local $aMacros = StringRegExp('#define macrocount = 0' & @CRLF & FileRead($sFilePath), '(?im:^#define\h+)(\w+)(?:\h+=\h+)([^\r\n]+)', 3) $aMacros[0] = UBound($aMacros) - 1 Local $aReturn[($aMacros[0] / 2) + 1][2] = [[0]] For $i = 2 To $aMacros[0] Step 2 $aReturn[0][0] += 1 $aReturn[$aReturn[0][0]][0] = $aMacros[$i] $aReturn[$aReturn[0][0]][1] = $aMacros[$i + 1] Next Return SetError($aReturn[0][0] = 0, 0, $aReturn) EndFunc ;==>PreProcessorMacros
×
×
  • Create New...