home *** CD-ROM | disk | FTP | other *** search
- /* ©1996 Dietmar Eilert. Empty GoldED macro */
-
- OPTIONS RESULTS /* enable return codes */
-
- if (LEFT(ADDRESS(), 6) ~= "GOLDED") then /* not started by GoldEd ? */
- address 'GOLDED.1'
-
- 'LOCK CURRENT RELEASE=4' /* lock GUI, gain access */
-
- if (RC ~= 0) then
- exit
-
- OPTIONS FAILAT 6 /* ignore warnings */
-
- SIGNAL ON SYNTAX /* ensure clean exit */
-
- /* ------------------------ INSERT YOUR CODE HERE: ------------------- */
- /* $VER: 1.3, ©1999 Wolfgang Morgeneier */
-
- 'QUERY Var=Wild Name=Wildcards'
- 'QUERY Var="Suchbytes" Name=Find'
- 'Query Var="Ersetzenstring" Name=Rplc'
- 'QUERY Var=grkl Name=UseCase'
- 'FIX VAR=Suchbytes'
- 'FIX VAR=Ersetzenstring'
- if length(Suchbytes)=0 then Suchbytes="x"
- if length(Ersetzenstring)=0 then Ersetzenstring="x"
-
- parse arg Eingabe
- sprache=substr(Eingabe,1,1)
- start =substr(Eingabe,2,1)
-
- if sprache = "d" then do
- R1B = "Bytes im Hexformat eingeben (max 16 Bytes):"
- R1T = "Eingabe"
- R2P = "Es sind jeweils paarweise Hexziffern einzugeben"
- R3P = "Es sind nur Hexziffern (0...9 oder a...f) bzw ? einzugeben"
- R4P = "Es sind nur Hexziffern (0...9 oder a...f) einzugeben"
- R5P = "Das ersten beiden Zeichen des Suchstrings dürfen kein Platzhalter sein"
- R6P = "Der Suchbegriff wurde nicht gefunden"
- R7B1 ="Ersetzenstring im Hex-Format eingeben ("
- R7B2 =" Zeichen):"
- R7T = "Eingabe"
- R8P = "Der Ersetzenstring muß genauso lang wie der Suchstring sein"
- R9P = R4P
- R10T= "Alle folgenden Vorkommen ersetzen?"
- R10B= "Vorgang kann mit der CTRL-Taste abgebrochen werden"
- R10X= "Alles ersetzen|!Beenden"
- R11T= "Fertig"
- R11B1="Insgesamt "
- R11B2=" Ersetzungen"
- end
- else do
- R1B = "Enter bytes in hex format (max 16 bytes):"
- R1T = "Input"
- R2P = "You have to enter hex diigts in pairs"
- R3P = "You have to enter only hex digits (0...9 or a...f) or ?"
- R4P = "You have to enter only hex digits (0...9 or a...f)"
- R5P = "The first two chars in the search string may be no wildchars"
- R6P = "Search string not found"
- R7B1 ="Enter replace string in hex format ("
- R7B2 =" chars):"
- R7T = "Input"
- R8P = "Replace string must have same length as search string"
- R9P = R4P
- R10T= "Shall I replace all following findings?"
- R10B= "You can break this by pushing the CTRL key"
- R10X= "Replace all|!Finished"
- R11T= "Ready"
- R11B1="Totally "
- R11B2=" replacements"
- end
-
- if start = "1" | start = "r" then do
- if length(Suchbytes)>32 then Suchbytes=left(Suchbytes,32)
- 'REQUEST Body="' || R1B || '" Title="' || R1T || '" Var=Suchbytes String Old="' || Suchbytes || '"'
- if RC > 0 then do
- 'UNLOCK'
- exit
- end
- end
-
- SuchbytesLaenge=length(Suchbytes)
- if SuchbytesLaenge > 32 then Suchbytes=left(Suchbytes,32)
- 'FIX VAR=Suchbytes'
-
- if length(Suchbytes)=0 | length(Suchbytes)//2 ~=0 then do
- 'REQUEST Problem="' || R2P || '"'
- 'UNLOCK'
- exit
- end
-
- Suchbytes = Upper(Suchbytes)
- if verify(Suchbytes,'0123456789ABCDEF?')~=0 & Wild=TRUE then do
- 'REQUEST Problem="' || R3P || '"'
- 'UNLOCK'
- exit
- end
-
- if verify(Suchbytes,'0123456789ABCDEF')~=0 & Wild=FALSE then do
- 'REQUEST Problem="' || R4P || '"'
- 'UNLOCK'
- exit
- end
-
- if Wild=TRUE & pos("?", Suchbytes)>0 & pos("?", Suchbytes)<3 then do
- 'REQUEST Problem="' || R5P || '"'
- 'UNLOCK'
- exit
- end
-
- 'SET Name=Find Value='Suchbytes
- Optstring = " "
- if start = "2" then Optstring = Optstring || "NEXT "
- if grkl=TRUE then Optstring = Optstring || "USECASE "
- if Wild=TRUE then Optstring = Optstring || "WILDCARD "
-
- 'HEXSEARCHHEX SEARCH='Suchbytes || Optstring
-
- if RC > 0 then do
- 'REQUEST Problem="' || R6P || '"'
- 'UNLOCK'
- exit
- end
-
- if start="r" then call ersetzen
-
- 'UNLOCK'
- exit
-
-
- ersetzen:
-
- flag=1
- do while flag
- flag=0
- 'REQUEST Body="' || R7B1 || length(Suchbytes) || R7B2 || '" Title="' || R7T || '" Var=Ersetzenstring Max=' || length(Suchbytes) || ' String Old="' || Ersetzenstring || '"'
- if RC > 0 then do
- 'UNLOCK'
- exit
- end
- 'FIX VAR=Ersetzenstring'
- Ersetzenstring= upper(Ersetzenstring)
- if length(Ersetzenstring) ~= length(Suchbytes) then do
- 'REQUEST Problem="' || R8P || '"'
- flag=1
- end
- if verify(Ersetzenstring,'0123456789ABCDEF')~=0 then do
- 'REQUEST Problem="' || R9P || '"'
- flag=1
- end
- end
-
- 'SET Name=Rplc Value=' || Ersetzenstring
-
- call doersetzen
-
- 'REQUEST Title="' || R10T || '" Body="' || R10B || '" BUTTON="' || R10X || '"'
- if result = 0 then return
-
- Anzahl=1
- do forever
- 'HEXSEARCHHEX SEARCH='Suchbytes || Optstring
- if RC > 0 then do
- 'REQUEST Title="' || R11T || '" Body="' || R11B1 || Anzahl || R11B2 || '"'
- return
- end
- 'QUERY Name=CTRL Var=ctrl'
- if ctrl=TRUE then return
- call doersetzen
- Anzahl = Anzahl + 1
- end
-
- return
-
-
- doersetzen:
-
- do i=1 to length(Ersetzenstring)
- 'HEXKEY KEYH=' || substr(Ersetzenstring,i,1)
- end
-
- return
-
- /* ---------------------------- END OF YOUR CODE --------------------- */
-
- SYNTAX:
-
- SAY "Sorry, error line" SIGL ":" ERRORTEXT(RC) ":-("
-
- 'UNLOCK'
-
- exit
-