AutoHotkey Community

It is currently May 27th, 2012, 11:16 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 13 posts ] 
Author Message
PostPosted: March 9th, 2006, 3:00 am 
Offline

Joined: November 11th, 2005, 3:13 am
Posts: 202
Whenever I'm trouble-shooting a PC, I need to check whether some DLLs & OCXs are already in the system. I know that there are cmds like FileExist, IfExist and IfNotExist. Then I was thinking about an array-like variable that would store all the filenames that the script would check before returning true/false. But the problem is I'm not sure about how to set a list of DLLs/OCXs that would be loaded into the array when the script starts...

I was hoping that someone with the know-how could help me out here...

thanks in advance...
badmojo


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 9th, 2006, 5:06 am 
Offline

Joined: February 13th, 2006, 10:40 pm
Posts: 389
Location: Utah
Whenever i want more than one line of output (more than a msgbox) i use html, cuase i can color it etc. This should do it:
Code:
FileOfFiles = files.txt     ;A file that has the list of files, NOTE: one file per line
Output = report.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=iso-8859-1" />
<title>Untitled Document</title>
</head>

<body>
), %output%



i=0
Loop
{
   i += 1
   FileReadLine, file, %FileOfFiles%, %i%
   if ErrorLevel <> 0
      break
   IfExist, %file%
      FileAppend, <font color=#00FF00>%file% is present</font><br>, %output%
   else
      FileAppend, <font color=#FF0000>%file% is absent!!</font><br>, %output%
}

FileAppend,
(
</body>
</html>
), %output%


You need a files.txt file that has something like this:
Code:
These are random files
C:\Windows\PowerReg.dat
C:\Windows\NotePad.exe
C:\Windows\regopt.log
C:\Windows\regedit.exe

_________________
Image
"Power can be given overnight, but responsibility must be taught. Long years go into its making."


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 9th, 2006, 11:55 am 
@Veovis: Thanks for this idea.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: March 9th, 2006, 12:09 pm 
Offline

Joined: December 27th, 2005, 1:46 pm
Posts: 6837
Location: France (near Paris)
Veovis wrote:
<title>Untitled Document</title>
:shock: :? :lol:
I see such titles sometime, while surfing on the Internet. Not always homepages, sometime serious corporate pages... :o

_________________
Image vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 9th, 2006, 6:07 pm 
Offline

Joined: February 13th, 2006, 10:40 pm
Posts: 389
Location: Utah
:lol: Picky, picky....

Shall I change it to "Titled Document" or what? :D

_________________
Image
"Power can be given overnight, but responsibility must be taught. Long years go into its making."


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 10th, 2006, 2:42 am 
Offline

Joined: November 11th, 2005, 3:13 am
Posts: 202
Thanks Veovis, the script works perfectly! I was wondering how to put the results on a GUI but your solution with HTML file is superb!, now I can just use some CSS coding to add background color & et. al... ;-)

Quote:
FileOfFiles = files.txt ;A file that has the list of files, NOTE: one file per line

btw, is that script possible without any additional "files.txt" because I'd like to add the list straight in the script. e.g. the sequence of files can be broken by a comma or semi-colon...

thanks again...
best regards,
badmojo


Last edited by badmojo on March 13th, 2006, 7:02 am, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 10th, 2006, 4:52 am 
Offline

Joined: February 13th, 2006, 10:40 pm
Posts: 389
Location: Utah
yuck.
I just typed up a reply and closed the window on accident.
Here we go again:

Having a String Parse will actually probably be better than a FileReadLine loop. Good Idea! Heres the Code:

Code:
Output = report.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=iso-8859-1" />
<title>File Report</title>
</head>
<body>
), %output%


Files = C:\Windows\PowerReg.dat,C:\Windows\NotePad.exe,C:\Windows\regopt.log,C:\Windows\regedit.exe

Loop, Parse, Files, `,
{
   IfExist, %A_LoopField%
      FileAppend, <font color=#00FF00>%A_LoopField% is present</font><br>, %output%
   else
      FileAppend, <font color=#FF0000>%A_LoopField% is absent!!</font><br>, %output%
}


FileAppend,
(
</body>
</html>
), %output%


Quote:
<title>File Report</title>

Is that better PhiLho? :lol:

_________________
Image
"Power can be given overnight, but responsibility must be taught. Long years go into its making."


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 10th, 2006, 5:11 am 
Offline

Joined: November 11th, 2005, 3:13 am
Posts: 202
Thanks again Veovis... You're a lifesaver... ;-)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 10th, 2006, 11:46 am 
Offline

Joined: December 27th, 2005, 1:46 pm
Posts: 6837
Location: France (near Paris)
Anonymous (Veovis) wrote:
Quote:
<title>File Report</title>

Is that better PhiLho? :lol:

Much better. Of course, my remark was more for pages on the Net than for internal/throwable pages. It was just an opportunity to rant against sloppy webmasters (not you! :-P).

Just a little remark (we are picky, aren't we?):
I would choose an illegal path character as filename separator: the comma is legal in a filename.
Files =
( Join| ; Or Join*, etc.
C:\Windows\PowerReg.dat
C:\Windows\NotePad.exe
C:\Windows\regopt.log
C:\Windows\regedit.exe
)

The continuation section is better if the list of files becomes long...
Don't forget to change the Loop Parse command...

_________________
Image vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 13th, 2006, 7:05 am 
Offline

Joined: November 11th, 2005, 3:13 am
Posts: 202
wow, thanks PhiLho. your method makes the script more elegant... tks again to both, you & Veovis for taking such an interest in my request... ;-)

best regards,
badmojo


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 13th, 2006, 7:53 am 
Offline

Joined: February 7th, 2005, 11:11 am
Posts: 192
Location: Munich, Germany
You shouldn't mix XML and the font-tag together. This is like mixing fire and water! Good browsers shows nothing or switching in her promiscous mode to show at least something.
If you are viewing your files only at your own computer this is enough:
Code:
FileOfFiles = files.txt     ;A file that has the list of files, NOTE: one file per line
Output = report.html

i=0
Loop
{
   i += 1
   FileReadLine, file, %FileOfFiles%, %i%
   if ErrorLevel <> 0
      break
   IfExist, %file%
      FileAppend, <font color=#00FF00>%file% is present</font><br>, %output%
   else
      FileAppend, <font color=#FF0000>%file% is absent!!</font><br>, %output%
}

_________________
Peter

Wisenheiming for beginners: KaPeGe (German only, sorry)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 13th, 2006, 8:05 pm 
Offline

Joined: February 13th, 2006, 10:40 pm
Posts: 389
Location: Utah
That top section was just copied from a blank DreamWeaver 8 document, so alot of it is probably uneeded, but it works, so...

_________________
Image
"Power can be given overnight, but responsibility must be taught. Long years go into its making."


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 14th, 2006, 2:31 am 
Offline

Joined: November 11th, 2005, 3:13 am
Posts: 202
Veovis wrote:
That top section was just copied from a blank DreamWeaver 8 document, so alot of it is probably uneeded, but it works, so...

yes, i understand that it was meant as an example... anyway i had modified them to include CSS formatting and it works very well. of course, it's not for mass distribution... ;-)

anyway, tks kapege.de for pointing it out

best regards,
badmojo


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 13 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: BrandonHotkey and 11 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