Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
String Manipulation bug
I use QM for work a lot, and i am using the following code to copy, modify, and paste some text out of a pdf into a web window, where i submit it to an online database. I need to manipulate the string, because in the PDF any word with an 'fi' or 'fl' gets split (ie. first becomes fi rst) and i need to remove the new lines and carriage returns.


Copy      Help
int px(xm) py(ym)

str s
s.replacerx("fi " "fi")
s.replacerx("fl " "fl")
s.replacerx("\n" " ")
s.replacerx("\r" " ")

int w1=act(win("Minimalistic Design Template - Mozilla Firefox" "MozillaWindowClass"))
lef 490 710 w1


mou px py

(ps. i also have the code moving my mouse back to where it started so that it doesn't progressively move further and further away on my desk)

the code is simple, but i keep receiving the following error message (on multiple machines):

"Error (RT) in My First Macro: invalid argument value"

any help is greatly appreciated
Fails when s is empty because no text is selected.

Add this after s.getsel:
if(!s.len) out "nothing selected. Run the macro again."; ret

Or maybe s.getsel does not work well with that window. It presses Ctrl+C and gets clipboard. Maybe it is too fast. Replace it with:
opt slowkeys 1; spe 100
key Cc
Thanks very much!

Forum Jump:

Users browsing this thread: 1 Guest(s)