Home Download Buy Blog Forum Support

text processing, macros and looping

text processing, macros and looping

Postby 7immy on Wed Jul 27, 2011 2:07 am

Hi all,
Note: I'm new to python and also sublime /macros etc so sry if this is a very simple / complicated question..

I'm trying to do some text processing via macros, I'd like to copy some text into the text editor and then process each line that has been pasted ie:
    for the first line I would do an insert snippet command (<h1>${<0:$SELECTION}</h1>) - (requires knowing beginning line number when pasted)
    for the rest of each line pasted i would do another insert snippet command (<p>${<0:$SELECTION}</p>) until i reach the end of all the pasted lines - (requires knowing last pasted line number)
I'm am not sure how I go about doing this but it looks like I need to somehow get the line number before pasting and then get the line number after pasting. this would then supposedly let me loop the number of lines pasted and do some commands for each... but how??

If some could help it would be much appreciated,
many thanks :)
7immy
 
Posts: 1
Joined: Tue Jul 26, 2011 11:23 pm

Return to General Discussion

Who is online

Users browsing this forum: jbrooksuk and 43 guests