Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Cut first line from notepad
#8
Macro Macro22
Code:
Copy      Help
str s="$desktop$\1.txt"
str get_text.getfile(s)
str getline
int line_pos=getline.getl(get_text 0) ;; CHANGE THE NUMBER HERE TO THE LINE YOU WANT TO GET, '0'= first line, '1' = second line...etc...
get_text.remove(line_pos getline.len)
get_text.trim ;; trim removes leading and trailing spaces, (put cursor on "trim" in QM editor then press [F1])
out get_text

;; At line 4 you see '0' this means GET the line at line '0' (FIRST LINE!), we store it in 'getline'
;; At line 5 you remove the exact length (amount of characters) of 'getline', we remove starting at 'line_pos' which should be '0'
;; line_pos will be '0' at 'A' and this will be put into variable 'line_pos' at line 4, do NOT confuse this with the zero in .=> getl(get_text 0)

It is confusing in beginning, keep re-studying the examples (in this forum thread and the help file). You will get it.


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)