Advertisement
Guest User

AoBTools_2019.7.1

a guest
Jul 3rd, 2019
233
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VBScript 32.41 KB | None | 0 0
  1. <html style="background: #acacac">
  2. <head>
  3. <meta http-equiv="x-ua-compatible" content="ie=9"/>
  4. <link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/icon?family=Material+Icons">
  5. <title>AoB Tools (ver.2019.7.1)</title>
  6. <style type="text/css">
  7.         body {
  8.             filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=0, StartColorStr=White, EndColorStr=#acacac);
  9.             font-family:Verdana;
  10.             font-size: 12px;
  11.             color: #5e5e5e;
  12.             background-color: -ms-linear-gradient(top, #2F2727, #1a82f7);
  13.             text-align: center;
  14.             border-collapse: collapse;
  15.             margin: 0px;
  16.             position: relative;
  17.             top: 0px;
  18.             }
  19.  
  20.         #seldd {
  21.             width: 100px;
  22.                 }
  23.         button {
  24.          filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=0, StartColorStr=White, EndColorStr=#acacac);
  25.          font-family:Verdana;
  26.          font-size: 14px;
  27.          height: 30px;
  28.          width: 150px;
  29.          font-weight: bold;
  30.             }
  31.            
  32.             h3 {
  33.             margin-top: 5px;
  34.             }
  35.            
  36.            
  37.         td {
  38.             border-width: 0px;
  39.             padding: 3px;
  40.             border-style: solid;
  41.             border-color: black;
  42.            
  43.             }
  44.         .tableNorm {
  45.             filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=0, StartColorStr=white, EndColorStr=#acacac);
  46.             font-size: 10px;
  47.             font-weight: color;
  48.             color: black;
  49.             }
  50.         .info1 {  
  51.             text-align: center;
  52.             font-size: 8pt;
  53.             font-weight: color;
  54.             color: black;
  55.             }
  56.         .tabs {
  57.             border-collapse: collapse;
  58.             color: black;
  59.             cursor: pointer;
  60.             cursor: hand;
  61.             font-family: arial;
  62.             font-size: 9pt;
  63.             font-weight: bold;
  64.             margin-top: 4px;
  65.             padding: 2px 4px 0px 4px;
  66.             position: relative;
  67.             text-align: center;
  68.             text-decoration: none;
  69.             z-index: 1;
  70.             }
  71.         .tabsNotSelected {
  72.             background-color: grey;
  73.             border: solid 1px black;
  74.             }
  75.         .tabsSelected {
  76.             filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=0, StartColorStr=#FFFFFF, EndColorStr=#aaacae;
  77.             border-color: black black white black;
  78.             border-style: solid solid solid solid;
  79.             border-width: 1px 1px 1px 1px;
  80.             }
  81.  
  82.        
  83.     </style>
  84.     <!--Styles defined for doc (end)-->
  85.     <!--Scripts to control app window size, position, and behavior (start)-->
  86.     <script language="VBScript">
  87.     Function Window_OnLoad()
  88.     call ResizeWindow()
  89.     end function
  90.     '========================
  91.     Function ResizeWindow()
  92.    
  93.     hght = document.documentElement.clientHeight
  94.  
  95.         Do While abs(document.documentElement.clientHeight - document.body.scrollHeight) >10
  96.         If document.documentElement.clientHeight < document.body.scrollHeight then
  97.             hght = hght + 10
  98.         else
  99.             hght = hght - 10
  100.         end if
  101.    
  102.         window.resizeTo 700,hght
  103.  
  104.         Loop
  105.        
  106.     wdth = document.documentElement.clientWidth
  107.  
  108.         Do While abs(document.documentElement.clientWidth - document.body.scrollWidth) >10
  109.         If document.documentElement.clientWidth < document.body.scrollWidth then
  110.             width = width + 14
  111.         else
  112.             width = width - 14
  113.         end if
  114.    
  115.         window.resizeTo width,hght
  116.  
  117.         Loop
  118.        
  119.         Call Refresh()
  120.  
  121.     End Function
  122.     '========================
  123.     window.resizeTo 750,165
  124.     screenWidth = document.parentwindow.screen.availwidth
  125.     screenHeight = document.parentwindow.screen.availheight
  126.     posLeft = (screenWidth - 700) / 2
  127.     posTop = (screenHeight - 600) / 2    
  128.     window.moveTo posLeft, posTop
  129.    
  130.     </script>
  131.     <!--Scripts to control app window size, position, and behavior (end)-->
  132.     <!--Features of app window (start)-->
  133.     <HTA:APPLICATION ID="AoBTool"
  134.     APPLICATIONNAME="AoBTool"
  135.     version="ver.2019.7.1"
  136.     CAPTION="yes"
  137.     BORDER="thin"
  138.     BORDERSTYLE="raised"
  139.     ICON="#"
  140.     CONTEXTMENU="yes"
  141.     MAXIMIZEBUTTON="no"
  142.     MINIMIZEBUTTON="yes"
  143.     NAVIGABLE="no"
  144.     SCROLL="no"
  145.     SCROLLFLAT="no"
  146.     SELECTION="no"
  147.     SHOWINTASKBAR="yes"
  148.     SINGLEINSTANCE="yes"
  149.     SYSMENU="yes"
  150.     WINDOWSTATE="normal">
  151.     </head>
  152.     <!--Features of app window (end)-->
  153.     <!--Script to control tab behavior (start)-->
  154.     <script language="VBscript">
  155.     Dim iPanelCount
  156.     iPanelCount = 4
  157.  
  158.     Public Sub Panel(tab)
  159.  
  160.     For i = 1 To iPanelCount
  161.         If i = tab Then
  162.             document.getElementById("tab" & i).className = "tabs tabsSelected"
  163.             document.getElementById("panel" & i).style.display = "block"
  164.         Else
  165.             document.getElementById("tab" & i).className = "tabs tabsNotSelected"
  166.             document.getElementById("panel" & i).style.display = "none"
  167.         end if
  168.     Next
  169.  
  170.     call ResizeWindow()
  171.  
  172.     End Sub
  173.     </script>
  174.     <!--Script to control tab behavior (end)-->
  175.  
  176.     <body>
  177.     <table class="tableNorm" id="mainTable" align="center" border="0" cellpadding="0" cellspacing="0" width="650">
  178.         <tr>
  179.             <td colspan="1">
  180.             <span class="tabs tabsSelected" id="tab1" onclick="panel(1)">AoBCompare™</span>
  181.             <span class="tabs tabsNotSelected" id="tab2" onclick="panel(2)">HexCalcTool™</span>
  182.             <span class="tabs tabsNotSelected" id="tab3" onclick="panel(3)">AoB/StringSwap™</span>
  183.             <span class="tabs tabsNotSelected" id="tab4" onclick="panel(4)">About</span>
  184.  
  185.     <!--Code for each tab (buttons, text boxes, etc)-->
  186.     <div class="panel" id="panel1" style="display:block">
  187.         <br><H3><b><font color="darkred">AoB</font>Compare™</b></H3>
  188.         <span style="display:block;" id="aob_spn_aobcountArea">
  189.         <center><H3>How many AoB's would you like to compare?</H3>
  190.         <select name="seldd" id="seldd" onchange="aobBox()">
  191.             <option value="1">Select</option>
  192.             <option value="2">2</option>
  193.             <option value="3">3</option>
  194.             <option value="4">4</option>
  195.             <option value="5">5</option>
  196.             <option value="6">6</option>
  197.             <option value="7">7</option>
  198.             <option value="8">8</option>
  199.         </select>
  200.         <br>
  201.         <br>                
  202.         </center>
  203.         </span>
  204.         <span style="display:none;" id="aob_spn_wldCharArea"><center><H4>Wildcard: <input type="text" title="Note: This will be the only allowable wildcard." name="wldChar" id="wldChar" maxlength="1" value="?" size="1" style="text-align:center;"/></H4></center></span>
  205.         <span style="display:none;" id="aob_spn_WCArea"></span>
  206.         <span style="display:none;" id="aob_spn_DataArea"></span>
  207.         <span style="display:none;" id="aob_spn_RunArea"><br><center><button type="button" id="aob_run_btn" onClick="fixSpaces()">Compare!</button></center></span>
  208.         <span style="display:none;" id="aob_spn_ResetArea"><br><center><button type="button" id="aob_reset_btn" onClick="aobreset()">Reset</button></center><br></span>
  209.     </div>
  210.  
  211.     <div class="panel" id="panel2" style="display:none">
  212.         <br><H3><b><font color="darkred">HexCalculator</font>Tool™</b></H3>
  213.         <center><span style="display:inline-block; width: 580;">
  214.             <table>
  215.                 <tr>
  216.                     <td>
  217.                         <label style="padding-left:200px;">Start Address</label>
  218.                         <center><input type="text" name="ofst_1" id="ofst_1" onkeyup="dispCalc()" maxlength="15" size="16"/>
  219.                         <select name="selArth1" id="selArth1" onchange="dispCalc()">
  220.                         <option value="Select">Select</option>
  221.                         <option value="+">+</option>
  222.                         <option value="-">-</option>
  223.                         <option value="*">*</option>
  224.                         <option value="/">/</option>
  225.                         </select></center>
  226.                     </td>
  227.                 </tr>
  228.                 <tr>
  229.                     <td>
  230.                         <label style="padding-left:200px;">Offset 1</label>
  231.                         <center><input type="text" name="ofst_2" id="ofst_2" onkeyup="dispCalc()" maxlength="15" size="16"/>
  232.                         <select name="selArth2" id="selArth2" onchange="dispCalc()">
  233.                         <option value="Select">Select</option>
  234.                         <option value="+">+</option>
  235.                         <option value="-">-</option>
  236.                         <option value="*">*</option>
  237.                         <option value="/">/</option>
  238.                         </select></center>
  239.                     </td>
  240.                 </tr>
  241.                 <tr>
  242.                     <td>
  243.                         <label style="padding-left:200px;">Offset 2</label>
  244.                         <center><input type="text" name="ofst_3" id="ofst_3" onkeyup="dispCalc()" maxlength="15" size="16"/>
  245.                         <select name="selArth3" id="selArth3" onchange="dispCalc()">
  246.                         <option value="Select">Select</option>
  247.                         <option value="+">+</option>
  248.                         <option value="-">-</option>
  249.                         <option value="*">*</option>
  250.                         <option value="/">/</option>
  251.                         </select></center>
  252.                     </td>
  253.                 </tr>
  254.                 <tr>
  255.                     <td>
  256.                         <label style="padding-left:200px;">Offset 3</label>
  257.                         <center><input type="text" name="ofst_4" id="ofst_4" onkeyup="dispCalc()" maxlength="15" size="16"/>
  258.                         <select name="selArth4" id="selArth4" onchange="dispCalc()">
  259.                         <option value="Select">Select</option>
  260.                         <option value="+">+</option>
  261.                         <option value="-">-</option>
  262.                         <option value="*">*</option>
  263.                         <option value="/">/</option>
  264.                         </select></center>
  265.                     </td>
  266.                 </tr>
  267.                 <tr>
  268.                     <td>
  269.                         <label style="padding-left:200px;">Offset 4</label>
  270.                         <center><input type="text" name="ofst_5" id="ofst_5" onkeyup="dispCalc()" maxlength="15" size="16"/>
  271.                         <select name="selArth5" id="selArth5" onchange="dispCalc()">
  272.                         <option value="Select">Select</option>
  273.                         <option value="+">+</option>
  274.                         <option value="-">-</option>
  275.                         <option value="*">*</option>
  276.                         <option value="/">/</option>
  277.                         </select></center>
  278.                     </td>
  279.                 </tr>
  280.                 <tr>
  281.                     <td>
  282.                         <label style="padding-left:200px;">Offset 5</label>
  283.                         <center><input style="margin-left: -78px;" type="text" name="ofst_6" id="ofst_6" onkeyup="dispCalc()" maxlength="15" size="16"/></center>
  284.                     </td>
  285.                 </tr>
  286.                 <tr>
  287.                     <td>
  288.                         <center><label >Calculation Preview</label></center>
  289.                         <input readonly style="text-align: center;" type="text" name="calc" id="calc" maxlength="100" size="80"/>
  290.                     </td>
  291.                 </tr>
  292.                 <tr>
  293.                     <td>
  294.                         <center><label >Result</label></center>
  295.                         <center><input readonly style="text-align: center;" type="text" name="end_addy" id="end_addy" maxlength="40" size="40"/></center>
  296.                     </td>
  297.                 </tr>
  298.             </table>
  299.            
  300.         </span></center>
  301.         <br><center><button type="button" id="ofst_run_btn" onClick="webhexcalc()">Run</button></center>
  302.         <br><center><button style="display:none" type="button" id="ofst_rst_btn" onClick="resetcalc()">Reset</button></center>
  303.         <center><span style="display:none;" id="ofst_WebMsgArea"></span></center>
  304.         <center><span style="display:none;" id="ofst_LocMsgArea"></span></center>
  305.     </div>
  306.  
  307.     <div class="panel" id="panel3" style="display:none">
  308.         <br><H3><b><font color="darkred">AoB/String</font>Swap™</b></H3>
  309.         <span style="display:inline-block;" id="strhex_spn_area">
  310.                 <font style="vertical-align: middle; line-height: 15px;" size="2">
  311.                 <label style="margin-left: 30px; vertical-align: middle;">Conversion Type(s):&nbsp;</label>
  312.                 <label style="vertical-align: middle; font-weight: bold" id="h2slabel" for="one">Hex to String</label>
  313.                 <input style="vertical-align: middle;" onchange="CheckRadio1()" type="radio" checked="true" id="h2s" name="h2s" value="h2s" />
  314.                 <label style="vertical-align: middle;" id="s2hlabel" for="two">String to Hex</label>
  315.                 <input style="vertical-align: middle;" onchange="CheckRadio2()" type="radio" id="s2h" name="s2h" value="s2h" /></font><br><br>
  316.            
  317.             <span  style="display:inline-block;" id="hex_spn_area">
  318.                 <fieldset>
  319.                 <Legend><b>Enter AoB</b></legend>
  320.                     <table width='100%'>
  321.                         <tr>
  322.                             <td><textarea style="width:540px;height:100px;" onchange"checknohex()" onkeyup="checknohex()" name="hexInput" id="hexInput"></textarea>
  323.                             <br><br>
  324.                             <button type="button" id="hex2str_run_btn" onClick="hex2strGO()">Convert</button>
  325.                             </td>
  326.                         </tr>
  327.                     </table>
  328.                 </fieldset>
  329.             </span>
  330.            
  331.             <span style="display:none;" id="str_spn_area">
  332.                 <fieldset>
  333.                 <Legend><b>Enter String</b></legend>
  334.                     <table width='100%'>
  335.                         <tr>
  336.                             <td><textarea style="width:540px;height:100px;" name="strInput" id="strInput"></textarea>
  337.                             <br><br>
  338.                             <button type="button" id="str2hex_run_btn" onClick="str2hexGO()">Convert</button>
  339.                             </td>
  340.                         </tr>
  341.                     </table>
  342.                 </fieldset>
  343.             </span>
  344.            
  345.             <br><br><br>
  346.            
  347.             <span id="aob2strResult_spn_area"><br>
  348.                 <span style="display:none" id="chkboxRslt_spn_area">
  349.                     <input style="float:left;" type="checkbox" name="0xCheckBox" id="0xCheckBox" onchange="str2hexGO()" title="Prefix Result with 0x"></input>
  350.                     <font style="float:left;" size="2" onclick="chkstr2hexGO()">Prefix resulting bytes with 0x</font>
  351.                 </span>
  352.                
  353.                 <fieldset>
  354.                 <Legend><b>Result</b></legend>
  355.                     <table width='100%'>
  356.                         <tr>
  357.                             <td><textarea readonly style='width:540px;height:100px;' name="rsltOutput" id="rsltOutput" rows=5></textarea></td>
  358.                         </tr>
  359.                     </table>
  360.                 </fieldset>
  361.                 <br>
  362.                 <center><span id="showByteCount" style="display:none;"></span></center>
  363.             </span>
  364.             <br><br><br><br><br>
  365.         </span>
  366.     </div>
  367.    
  368.     <div class="panel" id="panel4" style="display:none">
  369.         <br><H4><b>Origin Story</b></H4>
  370.         <span style="display:inline-block; width: 580;">
  371.             <p><font class="info1">This tool is intended for use with <a href="http://www.cheatengine.org/" style="color:blue;text-decoration:none">Cheat Engine</a>'s array of bytes scanner.<br><br>Developed by <b><a href="http://forum.cheatengine.org/profile.php?mode=viewprofile&u=348916" style="color:blue;text-decoration:none">Drivium</a></b><br><a href="https://discordapp.com/" style="color:blue;text-decoration:none">Discord</a>: Drivium#2488<br><br>
  372.             Inspired by the original VBScript tool created by:<b><a href="http://forum.cheatengine.org/profile.php?mode=viewprofile&u=338952" style="color:blue;text-decoration:none" alt="AikonCWD's Profile""><img src="http://i.imgur.com/f6rnuaV.gif" alt="AikonCWD's Profile" width="20" height="20" border="0" style="vertical-align: middle;"/>AikonCWD<img src="http://i.imgur.com/f6rnuaV.gif" alt="AikonCWD's Profile" width="20" height="20" border="0" style="vertical-align: middle;"/></a></b><br>Found here: <a href="http://forum.cheatengine.org/viewtopic.php?t=572933" style="color:blue;text-decoration:none">[TOOL] AoB Pattern Generator (coded in VBS, OpenSource)</a><br><br>
  373.             <a href="https://drive.google.com/open?id=0B7UqN53jp_4cMEEzT1h1N0ozdVU" style="color:blue;text-decoration:none">AoBTool™</a> shared in the following forums: <a href="http://forum.cheatengine.org/viewtopic.php?t=604665"><img src="http://i34.tinypic.com/33etueb.jpg" alt="Cheat Engine Forums" width="50" height="50" border="0" style="vertical-align: middle;"/></a><a href="https://www.reddit.com/r/cheatengine/comments/6e8s81/release_aob_tool_for_comparing_and_adding/"><img src="https://assets.ifttt.com/images/channels/1352860597/icons/on_color_large.png" alt="/r/cheatengine" width="50" height="50" border="0" style="vertical-align: middle;"/></a><a href="http://fearlessrevolution.com/viewtopic.php?f=8&t=2790" style="color:blue;text-decoration:none">Fearless Revolution</a></font></p>
  374.         </span>
  375.     </div>
  376.  
  377.             </td>
  378.         </tr>
  379.     </table>
  380.     </body>
  381.     </html>
  382.  
  383.     <script language="VBScript">
  384.     'Set Global Variables
  385.     Dim newW
  386.     Dim wldChar
  387.     Dim T
  388.  
  389.     </script>
  390.  
  391.     <!--Begin scripts for 1st tab -->
  392.     <script language="VBScript">
  393.     Sub aob_Convert(T)
  394.  
  395.     'Original script created by AikonCWD.  Modified by Drivium.
  396.  
  397.     wldChar = document.getElementByID("wldChar").value
  398.  
  399.     AoB = Split(T, vbcrlf)
  400.  
  401.     F = ""
  402.     X = 0
  403.     For i = 1 To Len(AoB(0))
  404.         For u = 1 To UBound(AoB)
  405.             If Mid(AoB(u), i, 1) <> Mid(AoB(0), i, 1) Then
  406.                 F = F & "?"
  407.                 X = 1
  408.                 Exit For
  409.             End If
  410.         Next
  411.         If X <> 1 Then F = F & Mid(AoB(0), i, 1)
  412.             X = 0
  413.     Next
  414.  
  415.     Set re = new regexp
  416.     oldF = F
  417.     re.Pattern = "([\?]\w)|(\w[\?])"
  418.     re.Global = True
  419.     newF = re.Replace(oldF, "??")
  420.     newWC = replace(newF, "?", wldChar)
  421.     newW = len(newWC) - len(replace(newWC, wldChar, ""))
  422.  
  423.     '=====================================================================
  424.     'Fix spaces in AoB result
  425.  
  426.         newString = lcase(replace(newWC," ",""))
  427.  
  428.         Set r = New RegExp
  429.         r.Global = True
  430.         r.Pattern = "(.{2})"
  431.  
  432.         document.getElementById("aobresult").value = trim(r.Replace(newString, "$1 "))
  433.  
  434.     '=====================================================================
  435.  
  436.     call showWildcardStat()
  437.  
  438.     document.ParentWindow.ClipboardData.SetData "text", newWC
  439.  
  440.     Alert "Result Copied to Clipboard!"
  441.  
  442.     end sub
  443.     </script>
  444.  
  445.     <!--'============================================================================================================-->
  446.     <!-- Subs and Functions (start)-->
  447.     <script language="VBScript">
  448.     'Triggers screen updates in an HTA...
  449.     Sub Refresh
  450.     With CreateObject("WScript.Shell")  
  451.         .run "%comspec% /c echo something & exit", 0, true  
  452.     End With  
  453.     End Sub
  454.     '===================================
  455.     Function showWildcardStat()
  456.  
  457.     if document.getElementById("aobresult").value = "" then
  458.         aob_spn_WCArea.style.display = "none"
  459.     else
  460.         aob_spn_WCArea.style.display = "block"
  461.         aob_spn_wldCharArea.style.display = "none"
  462.         aob_spn_WCArea.InnerHTML = "<br><center><H4><b>Bytes Replaced: " & round(newW/2,0) & "</b></H4></center>"
  463.         aob_spn_RunArea.style.display = "none"
  464.         aob_spn_ResetArea.style.display = "block"
  465.         call ResizeWindow()
  466.     end if
  467.  
  468.     end function
  469.     '============================
  470.     Function aobBox()
  471.  
  472.     aob_spn_wldCharArea.style.display = "block"
  473.  
  474.     if document.getElementById("seldd").value = "1" then
  475.  
  476.         exit function
  477.  
  478.     else
  479.  
  480.         boxsize = document.getElementById("seldd").value
  481.  
  482.     end if
  483.  
  484.     aobBoxStart =   "<fieldset>" & _
  485.                     "<Legend>ver.2019.7.1</legend>" & vbcrlf
  486.  
  487.         for i = 1 to document.getElementById("seldd").value                          
  488.  
  489.             box =   box & "<b>AoB " & i & "</b>" & _
  490.                             "<table width='100%'>" & _
  491.                                 "<tr>" & _
  492.                                     "<td><textarea style='width:100%' name='aob" & i & "' rows=" & 18/boxsize & " id='aobtextbox" & i & "' onkeyup='btnDisplay()'></textarea></td>" & _
  493.                                 "</tr>" & _
  494.                             "</table>" & vbcrlf
  495.  
  496.         next
  497.  
  498.     aobBoxEnd = "<b>Result</b>" & _
  499.                 "<table width='100%'>" & _
  500.                     "<tr>" & _
  501.                         "<td><textarea readonly style='width:100%' name='result' rows=5 id='aobresult'></textarea></td>" & _
  502.                     "</tr>" & _
  503.                 "</table>" & _
  504.                 "</fieldset>"
  505.  
  506.     aob_spn_ResetArea.style.display = "block"
  507.     aob_spn_aobcountArea.style.display = "none"
  508.     aob_spn_DataArea.style.display = "block"
  509.     aob_spn_DataArea.InnerHTML = aobBoxStart & box & aobBoxEnd
  510.  
  511.     call ResizeWindow()
  512.  
  513.     end function
  514.     '============================
  515.     Function aobreset()
  516.  
  517.     for i = 1 to document.getElementById("seldd").value
  518.         if not document.getElementById("aobtextbox" & i) is nothing then
  519.             document.getElementById("aobtextbox" & i).value = ""
  520.         end if
  521.  
  522.     next      
  523.  
  524.         document.getElementById("aobresult").value = ""
  525.         document.getElementByID("wldChar").value = "?"
  526.         aob_spn_wldCharArea.style.display = "none"
  527.         aob_spn_RunArea.style.display = "none"
  528.         aob_spn_WCArea.style.display = "none"
  529.         aob_spn_ResetArea.style.display = "none"
  530.         aob_spn_DataArea.style.display = "none"
  531.         aob_spn_aobcountArea.style.display = "block"
  532.         document.getElementById("seldd").value = "1"
  533.         call ResizeWindow()
  534.  
  535.     end function
  536.     '============================
  537.     Function btnDisplay()
  538.  
  539.     nullCount = 0
  540.  
  541.     for i = 1 to document.getElementById("seldd").value
  542.         if document.getElementById("aobtextbox" & i).value = "" then
  543.             nullCount = nullCount + 1
  544.         end if
  545.     next
  546.  
  547.     if nullCount = 0 then
  548.         aob_spn_RunArea.style.display = "block"
  549.         aob_spn_ResetArea.style.display = "none"
  550.         call ResizeWindow()
  551.  
  552.     else
  553.  
  554.         document.getElementById("aobresult").value = ""
  555.         aob_spn_RunArea.style.display = "none"
  556.         aob_spn_ResetArea.style.display = "block"
  557.         call ResizeWindow()
  558.     end if
  559.  
  560.     end function
  561.     '============================
  562.     Function fixSpaces()
  563.  
  564.     for ii = 1 to document.getElementById("seldd").value
  565.  
  566.         newString = lcase(replace(document.getElementById("aobtextbox" & ii).value," ",""))
  567.  
  568.         Set r = New RegExp
  569.         r.Global = True
  570.         r.Pattern = "(.{2})"
  571.  
  572.         'document.getElementById("aobtextbox" & ii).value = trim(r.Replace(newString, "$1 "))
  573.  
  574.         remLineBrks = replace(newString,vbcrlf,"")
  575.         remSpaces = trim(r.Replace(remLineBrks, "$1 "))
  576.    
  577.         document.getElementById("aobtextbox" & ii).value = remSpaces
  578.        
  579.     next
  580.  
  581.     call mergeAOB()
  582.  
  583.     end function
  584.     '============================
  585.     Function mergeAOB()
  586.  
  587.     T = document.getElementById("aobtextbox1").value
  588.     for ii = 2 to document.getElementById("seldd").value
  589.         if  not document.getElementById("aobtextbox" & ii) is nothing then
  590.             if document.getElementById("aobtextbox" & ii).value <> "" then
  591.                 T = T & vbcrlf & document.getElementById("aobtextbox" & ii).value
  592.             end if
  593.         end if
  594.     next
  595.  
  596.     call valChar(T)
  597.  
  598.     end function
  599.     '============================
  600.     Function valChar(C)
  601.  
  602.     'Validate wild card characters
  603.  
  604.     Set objRegEx1 = New RegExp
  605.     objRegEx1.IgnoreCase = True
  606.     objRegEx1.Global = True
  607.     wcPat = "[a-f0-9 ]"
  608.     objRegEx1.Pattern = wcPat
  609.  
  610.     wldChar = document.getElementByID("wldChar").value
  611.  
  612.     Set colMatches1 = objRegEx1.Execute(wldChar)
  613.  
  614.     If colMatches1.Count > 0 Then
  615.         For Each strMatch1 in colMatches1
  616.             errMatch1 = strMatch1.Value
  617.         Next
  618.  
  619.         If errMatch1 = " " then
  620.             alert "Ok, technically a space is a non-Hexadecimal character - so you're on the right track, but using a space causes other issues in this tool.  Please enter a non-Hexadecimal character (that's also not a space!)"
  621.             document.getElementByID("wldChar").value = "?"
  622.             exit function
  623.         else
  624.             alert chr(34) & errMatch1 & chr(34) & " is a Hexadecimal character.  Please enter a non-Hexadecimal character as your wildcard."
  625.             document.getElementByID("wldChar").value = "?"
  626.             exit function
  627.         end if
  628.     end if
  629.  
  630.     '-------------------------------------
  631.     'Validate AoB box characters
  632.     Set objRegEx = New RegExp
  633.     objRegEx.IgnoreCase = True
  634.     objRegEx.Global = True
  635.     newPat = "[^\?a-f0-9\s]"
  636.     objRegEx.Pattern = replace(newPat,"?",wldChar)
  637.  
  638.     strSearchString = C
  639.  
  640.     Set colMatches = objRegEx.Execute(strSearchString)
  641.  
  642.     If colMatches.Count > 0 Then
  643.        
  644.         For Each strMatch in colMatches
  645.             errMatch = errMatch & strMatch.Value
  646.         Next
  647.  
  648.         Set oCol = CreateObject("Scripting.Dictionary")
  649.         lCount = Len(errMatch)
  650.  
  651.         For lCtr = 1 To lCount
  652.             sChar = Mid(errMatch, lCtr, 1)
  653.             On Error Resume Next
  654.             oCol.Add sChar, sChar
  655.             If Err.Number = 0 Then sAns = sAns & sChar
  656.                 Err.Clear
  657.                 xChar = xChar & sChar & vbcrlf
  658.         Next                
  659.  
  660.             uniChar = split(xChar,vbcrlf)
  661.  
  662.         For iVal = 1 to document.getElementById("seldd").value
  663.  
  664.             For i = 0 to ubound(uniChar)-1
  665.  
  666.                 if instr(document.getElementById("aobtextbox" & iVal).value,uniChar(i)) then
  667.                     missingAoB = missingAoB & "AoB " & iVal & vbcrlf
  668.                     exit for
  669.                     'clearlist = clearlist & "," & iVal
  670.                 end if
  671.  
  672.             Next
  673.  
  674.         Next
  675.  
  676.         For iii = 1 To Len(sAns)
  677.             if Len(sAns) = 1 then
  678.                 badList = sAns
  679.             elseif iii < Len(sAns) and Len(sAns) > 1 then
  680.                 badList = badList & replace(Mid(sAns,iii,1),Mid(sAns,iii,1),Mid(sAns,iii,1) & ", ")
  681.             elseif iii = Len(sAns) and Len(sAns) > 1 then
  682.                 badList = badList & " and " & Mid(sAns,iii,1)
  683.             end if
  684.         next
  685.  
  686.         Alert "Non-hexadecimal character(s) [" & badList & "] found in: " & vbcrlf & missingAoB & vbcrlf & "Note: The chosen wilcard " & chr(34) & document.getElementByID("wldChar").value & chr(34) & " is the only acceptable non-hexadecimal character for this session."
  687.  
  688.         remBadCharMsg = msgbox("Would you like AoBTool™ to remove these for you?",4,"Remove Invalid Characters?")
  689.  
  690.         if remBadCharMsg = vbYes then
  691.             For ii = 1 to document.getElementById("seldd").value
  692.                 For iiii = 1 To Len(sAns)
  693.                     if instr(document.getElementById("aobtextbox" & ii).value,Mid(sAns,iiii,1)) then
  694.                         remBadChars = replace(document.getElementById("aobtextbox" & ii).value,Mid(sAns,iiii,1)," ")
  695.                         document.getElementById("aobtextbox" & ii).value = remBadChars
  696.                         document.getElementById("aobtextbox" & ii).value = trim(document.getElementById("aobtextbox" & ii).value)
  697.                     End If
  698.                 Next
  699.             Next
  700.             call fixSpaces()
  701.         end if
  702.  
  703.     else
  704.  
  705.         call aob_Convert(C)
  706.  
  707.     end if
  708.  
  709.     end function
  710.    
  711.     '==========================================
  712.     function resetcalc()
  713.    
  714.     for i = 1 to 6
  715.         document.getElementByID("ofst_"&i).value = ""
  716.     next
  717.    
  718.     for i = 1 to 5
  719.         document.getElementByID("selArth"&i).value = "Select"
  720.     next
  721.    
  722.     document.getElementByID("end_addy").value = ""
  723.    
  724.     ofst_rst_btn.style.display = "none"
  725.    
  726.     document.getElementByID("calc").value  = ""
  727.    
  728.     call ResizeWindow()
  729.    
  730.     end function
  731.     '==========================================
  732.     'Display calculation
  733.    
  734.     function dispCalc()
  735.    
  736.     '----Get offset values
  737.  
  738.     if document.getElementByID("ofst_1").value <> "" then
  739.         ofst1 = "0x" & document.getElementByID("ofst_1").value
  740.     end if
  741.    
  742.     if document.getElementByID("ofst_2").value <> "" then
  743.         ofst2 = "0x" & document.getElementByID("ofst_2").value
  744.     end if
  745.    
  746.     if document.getElementByID("ofst_3").value <> "" then
  747.         ofst3 = "0x" & document.getElementByID("ofst_3").value
  748.     end if
  749.    
  750.     if document.getElementByID("ofst_4").value <> "" then
  751.         ofst4 = "0x" & document.getElementByID("ofst_4").value
  752.     end if
  753.    
  754.     if document.getElementByID("ofst_5").value <> "" then
  755.         ofst5 = "0x" & document.getElementByID("ofst_5").value
  756.     end if
  757.    
  758.     if document.getElementByID("ofst_6").value <> "" then
  759.         ofst6 = "0x" & document.getElementByID("ofst_6").value
  760.     end if
  761.    
  762.     '----Get arth values
  763.     if document.getElementByID("selArth1").value <> "Select" then
  764.         arth1 = document.getElementByID("selArth1").value
  765.     end if
  766.    
  767.     if document.getElementByID("selArth2").value <> "Select" then
  768.         arth2 = document.getElementByID("selArth2").value
  769.     end if
  770.    
  771.     if document.getElementByID("selArth3").value <> "Select" then
  772.         arth3 = document.getElementByID("selArth3").value
  773.     end if
  774.    
  775.     if document.getElementByID("selArth4").value <> "Select" then
  776.         arth4 = document.getElementByID("selArth4").value
  777.     end if
  778.    
  779.     if document.getElementByID("selArth5").value <> "Select" then
  780.         arth5 = document.getElementByID("selArth5").value
  781.     end if
  782.    
  783.     calcPend = ofst1 & arth1 & ofst2 & arth2 & ofst3 & arth3 & ofst4 & arth4 & ofst5 & arth5 & ofst6
  784.    
  785.     document.getElementByID("calc").value  = calcPend
  786.    
  787.     Call Refresh()
  788.    
  789.     end function
  790.    
  791.     '==========================================
  792.     function webhexcalc()
  793.  
  794.     document.getElementByID("end_addy").value = ""
  795.     ofst_rst_btn.style.display = "block"
  796.  
  797.     '-------------------
  798.     'Hex Validation
  799.  
  800.     Set objRegEx = New RegExp
  801.     objRegEx.IgnoreCase = True
  802.     objRegEx.Global = True
  803.     hexPat = "[^a-f0-9]"
  804.     objRegEx.Pattern = hexPat
  805.  
  806.     for i = 1 to 6
  807.    
  808.         hexVal = document.getElementByID("ofst_"&i).value
  809.    
  810.         Set colMatches = objRegEx.Execute(hexVal)
  811.    
  812.         If colMatches.Count > 0 Then
  813.             For Each strMatch in colMatches
  814.                 errMatch = strMatch.Value
  815.             Next
  816.    
  817.             alert chr(34) & errMatch & chr(34) & " is not a Hexadecimal character." & vbcrlf & vbcrlf & "Only Hexadecimal characters can be calculated."
  818.             document.getElementByID("ofst_"&i).value = ""
  819.             call dispCalc()
  820.             exit function
  821.         end if
  822.        
  823.     next
  824.    
  825.     '-------------------
  826.    
  827.     timeOutMsg = "<center>There was a problem retrieving results...<br>Try again!</center>"
  828.    
  829.     ofst_WebMsgArea.style.display = "block"
  830.     document.getElementByID("ofst_WebMsgArea").innerHtml = "<br>Calculating...<br><br>"
  831.     call ResizeWindow()
  832.        
  833.     arthInput = document.getElementByID("calc").value
  834.     limit = second(Now())
  835.                            
  836.     on error resume next
  837.     Set IE = CreateObject("internetexplorer.application")
  838.     IE.Visible = false
  839.     IE.Navigate "https://defuse.ca/big-number-calculator.htm"
  840.     Do While (IE.Busy or IE.ReadyState <> 4) and abs(second(Now())-limit) <= 20:ccSleep(0.25):Loop
  841.         For Each input1 in ie.document.GetElementsByTagName("input")
  842.             if input1.name = "eqn" and not ie.document.GetElementsByTagName("input") is nothing then
  843.                 input1.value = arthInput
  844.                 elseif abs(second(Now())-limit) >=20 then
  845.                 document.getElementByID("ofst_WebMsgArea").innerHtml = "Having trouble retrieving web results...<br>Please try again!"
  846.                 document.getElementByID("end_addy").value = ""
  847.                 ie.quit
  848.                 exit function
  849.             end if
  850.         Next
  851.        
  852.         For Each nme In ie.document.getelementsbytagname("select")
  853.             if nme.getAttribute("name") = "base" then
  854.                 for each opt in nme.options
  855.                     If opt.Value = "hex" Then
  856.                         opt.Selected = True
  857.                     Else
  858.                         opt.Selected = False
  859.                     End If
  860.                 next
  861.             elseif abs(second(Now())-limit) >=20 then
  862.                 document.getElementByID("ofst_WebMsgArea").innerHtml = "Having trouble retrieving web results...<br>Please try again!"
  863.                 document.getElementByID("end_addy").value = ""
  864.                 ie.quit
  865.                 exit function
  866.             end if
  867.         Next
  868.        
  869.         For Each chk in ie.document.GetElementsByTagName("input")
  870.             if chk.name = "addspaces" then
  871.                 chk.click
  872.             elseif abs(second(Now())-limit) >=20 then
  873.                 document.getElementByID("ofst_WebMsgArea").innerHtml = "Having trouble retrieving web results...<br>Please try again!"
  874.                 document.getElementByID("end_addy").value = ""
  875.                 ie.quit
  876.                 exit function
  877.             end if
  878.         Next
  879.                
  880.         For Each btn in ie.document.GetElementsByTagName("input")
  881.             if btn.name = "submit" then
  882.                 btn.click
  883.             end if
  884.         Next
  885.        
  886.         Do While (IE.Busy or IE.ReadyState <> 4) and abs(second(Now())-limit) <= 20:ccSleep(0.25):Loop
  887.             hexResult = ie.document.getelementbyid("bignumber").innertext
  888.        
  889.     on error goto 0
  890.  
  891.     if instr(hexResult,"Sorry") then
  892.         document.getElementByID("end_addy").value = "Invalid Calculation.  Please try again!"
  893.     else
  894.         document.getElementByID("end_addy").value = hexResult
  895.     end if
  896.        
  897.         ofst_WebMsgArea.style.display = "none"
  898.        
  899.         call ResizeWindow()
  900.    
  901.         ie.quit
  902.  
  903. end function
  904.     '==========================================
  905.  
  906.     Sub ccSleep(seconds)
  907.      set oShell = CreateObject("Wscript.Shell")
  908.     cmd = "%COMSPEC% /c ping -n " & 1 + seconds & " 127.0.0.1>nul"
  909.     oShell.Run cmd,0,1
  910.      End Sub
  911.      
  912.     '==========================================
  913.     Function str2hexGO()
  914.    
  915.     If document.getelementbyid("strInput").value <> "" then
  916.    
  917.         strString = document.getelementbyid("strInput").value
  918.         document.getelementbyid("strInput").value = strString
  919.        
  920.         For i=1 To Len(strString)
  921.             if not i = Len(strString) then
  922.                 strHex = strHex + Hex(Asc(Mid(strString,i,1))) & " "
  923.             else
  924.                 strHex = strHex + Hex(Asc(Mid(strString,i,1)))
  925.             end if
  926.         Next
  927.    
  928.         If document.getelementbyid("0xCheckBox").checked = false then
  929.             document.getelementbyid("rsltOutput").value = strHex
  930.         else
  931.             strHex = replace(strHex,strHex,"0x" & strHex)
  932.             strHex = replace(strHex," "," 0x")
  933.             document.getelementbyid("rsltOutput").value = strHex
  934.         end if
  935.        
  936.         cntBytes = split(strHex," ")
  937.         bytes = ubound(cntBytes)
  938.        
  939.             ByteCnt = "<h3>(Result is <b>"&bytes+1&"</b> Bytes)</h3><br>"
  940.            
  941.         showByteCount.style.display = "inline-block"
  942.         showByteCount.innerHTML = ByteCnt
  943.        
  944.         Call Refresh()
  945.    
  946.     end if
  947.    
  948.     end function
  949.    
  950.     '==========================================
  951.     function chkstr2hexGO()
  952.    
  953.     if document.getelementbyid("0xCheckBox").checked = false then
  954.         document.getelementbyid("0xCheckBox").checked = true
  955.     else
  956.         document.getelementbyid("0xCheckBox").checked = false
  957.        
  958.     end if
  959.    
  960.     str2hexGO()
  961.        
  962.     end function
  963.     '==========================================
  964.     Function hex2strGO()
  965.  
  966.     If document.getelementbyid("hexInput").value <> "" then
  967.         strHex = replace(document.getelementbyid("hexInput").value," ","")
  968.    
  969.         For I = 1 To Len(strHex) Step 2
  970.             strString = strString & Chr(Eval("&H" & Mid(strHex, I, 2)))
  971.         Next
  972.    
  973.         document.getelementbyid("rsltOutput").value = strString
  974.        
  975.         Call Refresh()
  976.        
  977.     end if
  978.    
  979.     end function
  980.    
  981.     '==========================================
  982.     function checknohex()
  983.    
  984.     strHex = document.getelementbyid("hexInput").value
  985.    
  986.     'Validate AoB box characters
  987.     Set objRegEx = New RegExp
  988.     objRegEx.IgnoreCase = True
  989.     objRegEx.Global = True
  990.     newPat = "[^\?a-f0-9\s]"
  991.     objRegEx.Pattern = replace(newPat,"?",wldChar)
  992.  
  993.     Set colMatches = objRegEx.Execute(strHex)
  994.  
  995.     If colMatches.Count > 0 Then
  996.        
  997.         For Each strMatch in colMatches
  998.             errMatch = errMatch & strMatch.Value
  999.             alert("Non-hexadecimal character(s) found in AoB area. Fix and retry.")
  1000.             exit function
  1001.         Next
  1002.                
  1003.     end if
  1004.    
  1005.     end function
  1006.     '==========================================
  1007.    
  1008. 'Radio Check
  1009. function CheckRadio1()
  1010.  
  1011. if h2s.checked = true then
  1012.     hex_spn_area.style.display = "inline-block"
  1013.     h2slabel.style.fontweight = "bold"
  1014.     s2h.checked = false
  1015.     str_spn_area.style.display = "none"
  1016.     s2hlabel.style.fontweight = "lighter"
  1017.     showByteCount.style.display = "none"
  1018.     showByteCount.innerHTML = ""
  1019.     document.getelementbyid("rsltOutput").value = ""
  1020.     chkboxRslt_spn_area.style.display = "none"
  1021. end if
  1022.  
  1023.     Call Refresh()
  1024.    
  1025. end function
  1026.  
  1027. function CheckRadio2()
  1028.  
  1029.     Call Refresh()
  1030.  
  1031. if s2h.checked = true then
  1032.     str_spn_area.style.display = "inline-block"
  1033.     s2hlabel.style.fontweight = "bold"
  1034.     h2s.checked = false
  1035.     hex_spn_area.style.display = "none"
  1036.     h2slabel.style.fontweight = "lighter"
  1037.     document.getelementbyid("rsltOutput").value = ""
  1038.     chkboxRslt_spn_area.style.display = "inline-block"
  1039. end if
  1040.  
  1041.     Call Refresh()
  1042.    
  1043. end function
  1044.  
  1045.     </script>
  1046.  
  1047.     <!-- Subs and Functions (End)-->
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement