AutoHotkey Community

It is currently May 27th, 2012, 3:45 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 19 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: February 9th, 2010, 9:25 am 
hi guys...i want to know whether is it possible to write a file content in different colour say for example when i use this command

Code:
FileAppend, hi how are you?,xyz.txt ;;;; can i write the content hi how are you in red colour in txt format file???


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 9th, 2010, 11:02 am 
Yes and No. Color display depends on the program showing the text. You can certainly use FileAppend to write text to a file, and if you have (for instance) the proper RichText codes imbedded in the text, then a richtext application (an editor for example) will show the colored text.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 9th, 2010, 11:31 am 
ya thanks but i think to write into a simple notepad it wont work


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 9th, 2010, 11:55 am 
Offline

Joined: May 17th, 2007, 12:07 pm
Posts: 1004
Location: Germany - Deutschland
Where can you define colors in notepad??? I cant at mine.
Btw: Fileappend doesnt write text to notepad but in a txt file.
lostworld wrote:
ya thanks but i think to write into a simple notepad it wont work


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 9th, 2010, 11:59 am 
thats right i wish something like this would get implemented in coming days
FileAppend,hi how are you?,xyz.txt,cred


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 9th, 2010, 12:08 pm 
Offline

Joined: May 17th, 2007, 12:07 pm
Posts: 1004
Location: Germany - Deutschland
But Notepad CANT show text in colors. Thats the problem, not ahk.
You can paste text to a html-file and define there colors of the text. then the text would be colored when the html file generated by ahk would be opened.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 9th, 2010, 12:30 pm 
thanks aaffe for a valuable info


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 9th, 2010, 1:36 pm 
lostworld wrote:
thanks aaffe for a valuable info
:roll:


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: July 29th, 2010, 12:04 am 
Offline

Joined: August 14th, 2008, 5:34 am
Posts: 73
aaffe wrote:
But Notepad CANT show text in colors. Thats the problem, not ahk.
You can paste text to a html-file and define there colors of the text. then the text would be colored when the html file generated by ahk would be opened.


How can this be done? Would I just need to look up html code? And how could ahk write to a .html file? I thought it could only write to .txt files.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 29th, 2010, 1:37 am 
Filename parameters do not necessary to be .TXT


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: July 29th, 2010, 1:46 am 
Offline

Joined: December 8th, 2006, 5:17 am
Posts: 248
Location: Sydney Australia
a small code snippet to create & open a HTML file

Code:
; create the html
FileAppend,
(
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>HELLO</title>
<style type="text/css">
<!--
.style1 {
   font-family: Arial, Helvetica, sans-serif;
   font-size: 72px;
   color: #0000FF;
}
.style2 {
   font-family: Webdings;
   color: #006600;
}
.style5 {color: #006600}
.style6 {
   color: #FF9900;
   font-size: 24px;
   font-family: Arial, Helvetica, sans-serif;
}
.style7 {font-family: Arial, Helvetica, sans-serif}
-->
</style>
</head>
<body>
<p class="style1">Happy Birthday !</p>
<p class="style1">Enjoy the Day! Blue TEXT</p>
<p class="style7">1233333333333</p>
<p class="style6">Orange Text</p>
<p class="style7">Mobile</p>
<p class="style7">Fax</p>
<p class="style7">Address</p>
<p class="style7">Web:</p>
<span class="style2">P</span><span class="style5"> Please consider the environment before printing this e-mail</span></p>
</body>
</html>
),test123.html
run, test123.html

_________________
Paul O


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 29th, 2010, 2:07 am 
Offline

Joined: February 27th, 2009, 9:11 am
Posts: 693
Location: Burbank, California
also see:

Topic: www.autohotkey.com/forum/viewtopic.php?t=60215

_________________
"Data is not information, information is not knowledge, knowledge is not understanding, understanding is not wisdom" but let's start to get the data...


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 29th, 2010, 2:21 am 
lostworld wrote:
thats right i wish something like this would get implemented in coming days
FileAppend,hi how are you?,xyz.txt,cred


as was said, the problem is with your text editor, in this case notepad, not with FileAppend command

basic example for html file:

Code:
FileAppend, <font color="red">hi how are you?</font>, xyz.html


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: July 29th, 2010, 5:30 am 
Offline

Joined: August 14th, 2008, 5:34 am
Posts: 73
guest3456 wrote:
lostworld wrote:
thats right i wish something like this would get implemented in coming days
FileAppend,hi how are you?,xyz.txt,cred


as was said, the problem is with your text editor, in this case notepad, not with FileAppend command

basic example for html file:

Code:
FileAppend, <font color="red">hi how are you?</font>, xyz.html


Thanks, thats super easy and works well. The only thing is the `n as an enter isn't working. Is there some other way to append an enter character to the .html file?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 29th, 2010, 8:00 am 
Offline

Joined: May 17th, 2007, 12:07 pm
Posts: 1004
Location: Germany - Deutschland
Yes, there is. You should look into the definition of html-files.
Just google for it.
Or look into here:
http://www.utexas.edu/learn/html/


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 19 posts ]  Go to page 1, 2  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bing [Bot], bobbysoon, Yahoo [Bot] and 21 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group