Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[solved] macro routinely totally freezes computer
#1
I have one macro that routinely freezes my computer. I don't understand why this happens especially since it seems to be random.

Summary: it cleans up a selected piece of text of weird misc characters by doing a series of findreplace functions.

Macro cleanup text - clean up pdf text copies -
Trigger Wc     Help - how to add the trigger to the macro
Code:
Copy      Help
str inputstring

inputstring.getsel

spe 100

;combo non-alphanumeric characters
inputstring.findreplace("___" " ")
inputstring.findreplace("__" " ")
inputstring.findreplace("_-_" " ")
inputstring.findreplace("--" " ")

;single non-alphanumeric characters
inputstring.findreplace("_" " ")
inputstring.findreplace("-" " ")
inputstring.findreplace("+" " ")
inputstring.findreplace(":" " - ")
inputstring.findreplace("~" " ")
inputstring.findreplace("''" "'") ;;replaces "
inputstring.findreplace("?" " - ")
inputstring.findreplace("/" "   ")
inputstring.findreplace("\" "   ")
inputstring.findreplace("|" " - ")
inputstring.findreplace("»" " - ")
inputstring.findreplace("<" "" 8)
inputstring.findreplace(">" "" 8)
inputstring.findreplace("*" "" 8)
inputstring.findreplace(" " " " 8) ;; the weird non-space space character when text copied from pdf - only works in word
inputstring.findreplace(" " " " 8) ;; the weird non-space space character when text copied from pdf - works in text editor

inputstring.setsel
#2
Try to replace setsel with paste.

paste inputstring
#3
Thank you. The code works great. I had to wait a few days to try it out first before replying.
#4
The setsel/setclip bug now is fixed in the newest QM version.
#5
Thanks.


Forum Jump:


Users browsing this thread: 1 Guest(s)