AutoHotkey Community

It is currently May 27th, 2012, 10:00 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: May 24th, 2007, 9:18 pm 
Offline

Joined: May 22nd, 2007, 6:03 pm
Posts: 2
Hello, everyone. I have created a new script based on one of the sample scripts on the website, which updates a list of files from another computer on the network. The script looks right to me, and I don't see any syntax errors, but when it is run I always get the following error:

Code:
Error: Missing "{".... --> 045: }


Here is the code. I have deconstructed it, made it more explicit, removed things, etc., but all to no avail. Can anyone tell me what is wrong with it?

Code:
;######################################################################################
; Copy only the source files that are newer than their counterparts in the destination
; Last updated 3/29/2007  10:44 AM
;######################################################################################

; This funtion calls the .ini file kept on Larry, which has a list of the scripts that
; should be updated. Changes to that list will not require this script to be updated.
GetItStarted:
inifilename = L:\Editing Resources\Perl\UpdateFilesFromLarry.ini
iniread, ArrayCount, %inifilename%, NumberOfFiles, ArrayCount

; This is the copying function. It loops through the files in the list...
CopyIfNewer:
numupdated = 0
UpdatedFileList = I did not update any files

Loop, %ArrayCount%
{
   iniread, LarryFile, %inifilename%, LarryFiles, larryarray%A_Index%
   iniread, LocalFile, %inifilename%, LocalFiles, localarray%A_Index%
    copy_it = n
   ; If the file DOES NOT exist on the user's computer, it is flagged for copying
    IfNotExist, %LocalFile% {
        copy_it = y
    } else {
      ; If the file DOES exist, the timestamps are compared
        FileGetTime, localtime, %LocalFile%, M
        FileGetTime, larrytime, %LarryFile%, M
        EnvSub, localtime, larrytime, seconds  ; Subtract the source file's time from the destination's.
        if localtime < 0  ; Source file is newer than destination file.
            copy_it = y
    }
   ; Here, we copy the file if it needs to be copied and update a running list of new files
    if(copy_it = y) {
        FileCopy, %LarryFile%, %LocalFile%, 1   ; Copy with overwrite=yes
      numupdated++
      if(numupdated = 1) {
         UpdatedFileList = I have updated these files:
      }
        SplitPath, LarryFile, UpdatedFile
        UpdatedFileList = %UpdatedFileList% - %UpdatedFile%
        if(ErrorLevel)
            MsgBox, Could not copy "%LarryFile%" to "%LocalFile%".
   }
}
; Last, we tell the user which files were updated
MsgBox, %UpdatedFileList%
Return



Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 24th, 2007, 9:54 pm 
Offline
User avatar

Joined: August 30th, 2005, 8:43 pm
Posts: 8667
Location: Salem, MA
Manual wrote:
One True Brace (OTB, K&R style): In v1.0.41+, the OTB style may optionally be used in the following places: expression if-statements, the "else" keyword, normal loops, and function definitions.


The problem is
Code:
IfNotExist, %LocalFile%  {


should be
Code:
IfNotExist, %LocalFile% 
{

_________________
Image
(Common Answers) - New Tutorials Forum - Humongous FAQ


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 25th, 2007, 3:26 am 
Offline

Joined: May 22nd, 2007, 6:03 pm
Posts: 2
Well, that make sense... That's my Perl syntax coming through. Thanks for the help!


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 25th, 2007, 3:29 am 
Offline
User avatar

Joined: August 30th, 2005, 8:43 pm
Posts: 8667
Location: Salem, MA
If you want to use expression style:

Code:

If FileExist(LocalFile) = 0  {


_________________
Image
(Common Answers) - New Tutorials Forum - Humongous FAQ


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: Google Feedfetcher, tomoe_uehara, XstatyK and 64 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