I want to create a script that can comment/uncomment a line similar to how it's done in advanced notepads (Notepad++, Sublime Text, different IDEs e.t.c). If it's already been done, I can't find it using forum searches because "comment" is a very broad definition. I need this script because I often work in the text editors that doesn't support hotkeys (Different SQL database tools, web pages, e.t.c) and copy-pasting it to/from notepad will be a hassle. Of course being able to comment/uncomment whole blocks would be even greater, but I doubt it's easily achievable with AHK, so one line comment/uncomment will do for me.
So, how do I see it working? For example, when hotkey is pressed:
1. The script copy the whole current line to the clipboard (for example by sending 'Home > Shift+End > Ctrl+C' to the active window)
2. Script analyze the contents of the clipboard and determines the first character on the line.
3. If the first character is "#" (or another pre-defined comment symbol), the script deletes this character (for example simply by sending 'Home > Del' to the active window)
4. If it's any other character, the script inserts "#" at the start of the line ( Send Home > Send "#" )
Is something like that possible? Will this task be interesting enough for you to tackle?
![Smile :)](./images/smilies/icon_e_smile.gif)
UPD: This is not to ask for a ready-made solution, I just ask for a tip where to start reading, which method/function can be used for this...