AutoHotkey Community

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

All times are UTC [ DST ]




Post new topic Reply to topic  [ 21 posts ]  Go to page Previous  1, 2
Author Message
 Post subject:
PostPosted: September 4th, 2009, 8:17 am 
HotKeyIt wrote:
ZANZA wrote:
HotKeyIt wrote:
Can you explain why you do not use WatchDirectory for that?

What is wrong with this example :?:


umm 20 lines compared to ....


So it's too complex :?:


quotes of quotes of quotes r wikid.


i think what he is trying to say is that my code was teeny tiny and simple. however inefficient it is.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: September 4th, 2009, 8:49 am 
Offline

Joined: August 10th, 2009, 8:17 am
Posts: 12
Sorry I didn't mean to tick you off its just that your way is longer then the first way. but is does look good =) (Y)

_________________
Beta. Software undergoes beta testing shortly before it's released. Beta is Latin for "still doesn't work."

The programmer's national anthem is 'AAAAAAAARRRRGHHHHH!!'.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 4th, 2009, 10:04 am 
Offline

Joined: June 18th, 2008, 8:36 am
Posts: 4923
Location: AHK Forum
I see ;)

_________________
AHK_H (2alpha) AHF TT _Struct WatchDir Yaml _Input ObjTree RapidHotkey DynaRun :wink:


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 4th, 2009, 7:11 pm 
Offline

Joined: April 4th, 2008, 8:15 pm
Posts: 538
Location: Canada
+ some people like to use their own code, so they can tweak it / learn how to improve upon it instead of just using something they don't understand :wink:


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 11th, 2009, 4:04 am 
Offline

Joined: August 28th, 2009, 10:33 am
Posts: 7
UPDATE ON CODE.

ok i changed it so that an ini file is written and the script refers to it for the folder path and the folder size.

so if the user nominates a folder and then loggs off his computer, and that nominated folder is changed while they are logged off, when the user reruns the script it will ask if they wish to continue to monitor the same folder. if the user clicks yes the script will retrieve the folder path and the last noted folder size and will immediately notify the user if that folder has been changed while they were away.

i have also reduced the timer spaces to make it more reliable.

Code:
#Persistent

ifexist, foldermonitor.Ini
{
   MsgBox,4,, Do you want to continue to monitor current folder?
   IfMsgBox Yes
   {
      iniread, FolderSize, foldermonitor.ini, foldermonitor, foldersize
      iniread, FolderPath, foldermonitor.ini, foldermonitor, path
   }
   else
   {
   FileSelectFolder, FolderPath , , 1, select folder to monitor   
   Loop, %FolderPath%\*.*, , 1
      FolderSize += %A_LoopFileSize%
      
   iniwrite, %FolderPath%, foldermonitor.ini, foldermonitor, path
   }
}
Else
{
   FileSelectFolder, FolderPath , , 1, select folder to monitor   
   Loop, %FolderPath%\*.*, , 1
      FolderSize += %A_LoopFileSize%
      
   iniwrite, %FolderPath%, foldermonitor.ini, foldermonitor, path
}

   SetTimer , DoThis, 10

DoThis:
   Folder2Size = 0
   Loop, %FolderPath%\*.*, , 1
      Folder2Size += %A_LoopFileSize%
      
   if (Folder2Size != FolderSize)
   {
      MsgBox, Folder has been modified
      FolderSize = 0
      Loop, %FolderPath%\*.*, , 1
         FolderSize += %A_LoopFileSize%
   }
   IniWrite, %FolderSize%, foldermonitor.ini, foldermonitor, foldersize
   
return

_________________
i am the walrus. cookookachoo


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 11th, 2009, 5:39 am 
Offline

Joined: August 10th, 2009, 8:17 am
Posts: 12
looks good (y)

_________________
Beta. Software undergoes beta testing shortly before it's released. Beta is Latin for "still doesn't work."

The programmer's national anthem is 'AAAAAAAARRRRGHHHHH!!'.


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: Google Feedfetcher, MSN [Bot], nomissenrojb, nothing and 67 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