AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to convert selected text into comment (including date) w

 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
jitendravyas



Joined: 06 Mar 2010
Posts: 15
Location: India

PostPosted: Sat Mar 06, 2010 8:28 am    Post subject: How to convert selected text into comment (including date) w Reply with quote

For example

I want to select this text


Code:
    Some text here 


then with ahk shortcut want to convert like this

Code:
    /* ======================================================================= */
    /* = Some text here - added by Jitendra (Date and time here from system) = */
    /* ======================================================================= */


Last edited by jitendravyas on Sat Mar 06, 2010 12:24 pm; edited 5 times in total
Back to top
View user's profile Send private message
SoLong&Thx4AllTheFish



Joined: 27 May 2007
Posts: 4999

PostPosted: Sat Mar 06, 2010 8:50 am    Post subject: Reply with quote

- You need a hotkey
- Send ^x will cut text to clipboard
- Look at builtin variables for date & time
- Send commenttext, clipboard + date variables

Try some things, post code if you get stuck. Note there are various methods of doing this, one may be more efficient than the other, but if you try something I'm sure you will learn more from it.
_________________
AHK Wiki FAQ
TF : Text files & strings lib, TF Forum
Back to top
View user's profile Send private message
garry



Joined: 19 Apr 2005
Posts: 2214
Location: switzerland

PostPosted: Sat Mar 06, 2010 9:12 am    Post subject: Reply with quote

had just an example
can also create a GUI with dropdownlist, see command formattime... etc
Code:
;--- mark text s1 and press F7 -----------
;--- send to notepad and display msgbox ---
$F7::
S1=added by Jitendra
Formattime,TS,,longdate
Formattime,TT,T12,time
   clipboard=
   Send ^c
   clipwait
   C2:=clipboard
   clipboard=
   if C2 contains %s1%
     {
e4=
(
/* ====================================================== */
/* = added by Jitendra %ts% %tt%   = */
/* ====================================================== */
)

run, notepad,,,pid
aa=ahk_class Notepad
   WinActivate, %aa%
   WinWaitActive, %aa%,,5
   ControlSend,, %e4%, ahk_pid %PID%
msgbox,%e4%
e4=
return
}
else
return
Back to top
View user's profile Send private message
jitendravyas



Joined: 06 Mar 2010
Posts: 15
Location: India

PostPosted: Sat Mar 06, 2010 9:54 am    Post subject: Reply with quote

how to operate this, it's not working
Back to top
View user's profile Send private message
SoLong&Thx4AllTheFish



Joined: 27 May 2007
Posts: 4999

PostPosted: Sat Mar 06, 2010 9:57 am    Post subject: Reply with quote

You really need to start with the tutorials and some coding yourself otherwise you will never learn. Really try something yourself and you will see that the example by garry will work. But start with the basics first. This is ask for help, not ask for scripts.
_________________
AHK Wiki FAQ
TF : Text files & strings lib, TF Forum
Back to top
View user's profile Send private message
garry



Joined: 19 Apr 2005
Posts: 2214
Location: switzerland

PostPosted: Sat Mar 06, 2010 10:19 am    Post subject: Reply with quote

for example above,
save as xy.ahk, start script , see nothing
mark your text (added by Jitendra) , then press F7
starts notepad and it writes your text with date (e4) to notepad and shows a messagebox
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group