AutoHotkey Community

It is currently May 27th, 2012, 8:42 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 19 posts ]  Go to page Previous  1, 2
Author Message
 Post subject: Philho's script
PostPosted: May 10th, 2006, 1:23 pm 
Offline

Joined: May 8th, 2006, 10:24 pm
Posts: 10
Location: QLD Australia
Hi Philho,

I got your script working fine. Works a treat.

Can you (or someone) explain why there is a ! in front of "FileExists"?

path = E:\destinationPath\
cdDriveContent = c:\temp\cd_drive_contents.txt
Run %comspec% /c dir e: /s /A-D /on > %cdDriveContent%, , Hide
Loop
{
filename = %path%CD-Drive%A_Index%.txt
If (!FileExist(filename))
{
FileMove %cdDriveContent%, %filename%
Break
}
}

I will be altering the script for some advancements such as a msg. box at the end but this is a great starting point.
Thanks.


Report this post
Top
 Profile  
Reply with quote  
 Post subject: oh...
PostPosted: May 10th, 2006, 1:27 pm 
Offline

Joined: May 8th, 2006, 10:24 pm
Posts: 10
Location: QLD Australia
Now I feel stoopid. Just re-reading the script to myself and realised that the ! stands for "not" or "does not".

Never mind :)


Report this post
Top
 Profile  
Reply with quote  
 Post subject: final note?
PostPosted: May 10th, 2006, 2:01 pm 
Offline

Joined: May 8th, 2006, 10:24 pm
Posts: 10
Location: QLD Australia
I found that the script [of Philho's] was only letting the temp txt file copy over the next time you ran the script... I had wanted to copy the temp txt file straight into a numbered txt file. By taking some time to think about it, I decided to run the loop function twice and then delete the tmp txt file when the numbered txt file was created.

Here's what it looks like in practice:
Code:
path = d:\destinationPath\  ; this is where I want the numbered files saved
cdDriveContent = c:\temp\cd_drive_contents.txt
Run %comspec% /c dir e: /s /A-D /on > %cdDriveContent%, , Hide
Loop
{
   filename = %path%CD-Drive%A_Index%.txt
   If (!FileExist(filename))
   {
      FileMove %cdDriveContent%, %filename%
      Break
   }
}

; it was not creating the numbered file on the first go so I run the loop again

Loop
{
   filename = %path%CD-Drive%A_Index%.txt
   If (!FileExist(filename))
   {
      FileMove %cdDriveContent%, %filename%
      Break
   }
}

; the numbered file has been created now, I should delete the tmp file or next time I run the script it's contents will be in the next numbered file

filedelete %cdDriveContent%

msgbox Your new CD is called %filename%



Thanks for showing me how, Philho,

Staid.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 10th, 2006, 2:44 pm 
Offline

Joined: December 27th, 2005, 1:46 pm
Posts: 6837
Location: France (near Paris)
Thanks, but that's Goyyah that showed the way (using some of my code)... :-)

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


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 Previous  1, 2

All times are UTC [ DST ]


Who is online

Users browsing this forum: Exabot [Bot], specter333, XstatyK and 61 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