forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


need help with script again

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
xearo
Newbie


Joined: 01 Oct 2004
Posts: 18

PostPosted: Thu Oct 28, 2004 1:00 am    Post subject: need help with script again Reply with quote

hey guys

i need some help with this script

what happens is:

when the timer realises that it is time to go to the backup routine it works fine

but what happens is that because it has finished what it is doing before the clock ticks over to the next minute it keeps running the backup routine

anyone have any suggestions to stop it running if it already has run on that minute
Code:

Title Company Backup
  DIALOG CREATE,Backup Manager,-1,0,515,321,COLOR WHITE,SMALLCAP,CLASS BackupM
REM *** Modified by Dialog Designer on 22/10/2004 - 12:45 ***
  DIALOG ADD,STYLE,STYLE2,Verdana,8,,,BLUE
  DIALOG ADD,STYLE,STYLE1,Verdana,8
  DIALOG ADD,LIST,LIST1,10,10,493,109,Double Click to Remove entries,DBLCLICK
  DIALOG ADD,CHECK,Monday,154,11,87,18,Monday,,,STYLE1
  DIALOG ADD,CHECK,Tuesday,174,11,87,17,Tuesday,,,STYLE1
  DIALOG ADD,CHECK,Wednesday,194,11,87,18,Wednesday,,,STYLE1
  DIALOG ADD,CHECK,Thursday,214,11,87,18,Thursday,,,STYLE1
  DIALOG ADD,CHECK,Friday,234,11,87,18,Friday,,,STYLE1
  DIALOG ADD,CHECK,Saturday,254,11,87,18,Saturday,,,STYLE1
  DIALOG ADD,CHECK,Sunday,274,11,87,18,Sunday,,,,STYLE1
  DIALOG ADD,BUTTON,BackupFiles,237,368,134,60,Backup Now,,STYLE1
  DIALOG ADD,EDIT,BackupPath,168,148,180,19,BackupPath,,STYLE1
  DIALOG ADD,BUTTON,Dir,167,331,20,21,...
  DIALOG ADD,TEXT,Backup,152,150,,,Path to backup selected files to:,,,,STYLE1
  DIALOG ADD,BUTTON,AddFiles,126,368,135,24,AddFiles,,STYLE1
  DIALOG ADD,STATUS,STATUS1,STATUS1
  DIALOG ADD,BUTTON,Save,161,368,135,24,Save Changes,,STYLE1
  DIALOG ADD,CHECK,ROS,254,149,180,18,Run on Startup,,,STYLE1
  DIALOG ADD,SPIN,Hour,217,149,39,22,,,Set the backup time in 24 hour time,STYLE1,CLICK
  DIALOG ADD,SPIN,Min,217,222,39,22,,,Set the backup time in 24 hour time,STYLE1,CLICK
  DIALOG ADD,TEXT,Time,196,150,,,Backup Time:,24 Hour Time,,STYLE1
  DIALOG ADD,TEXT,Hrs,229,191,,,Hrs,,STYLE1
  DIALOG ADD,TEXT,Mins,229,264,,,Mins,,STYLE1
  DIALOG ADD,BUTTON,Hide,195,368,135,24,Hide,,STYLE1
  DIALOG ADD,PROGRESS,PROGRESS1,128,10,351,20,0
  DIALOG ADD,TASKICON,TASKICON1
  INIFILE OPEN, Settings.ini
  DIALOG SET, BackupPath, @iniread(Options,BackupPath)
  DIALOG SET, Monday, @iniread(Days,Monday)
  DIALOG SET, Tuesday, @iniread(Days,Tuesday)
  DIALOG SET, Wednesday, @iniread(Days,Wednesday)
  DIALOG SET, Thursday, @iniread(Days,Thursday)
  DIALOG SET, Friday, @iniread(Days,Friday)
  DIALOG SET, Saturday, @iniread(Days,Saturday)
  DIALOG SET, Sunday, @iniread(Days,Sunday)
  DIALOG SET, ROS, @iniread(ROS,ROS)
  DIALOG SET, Hour, @iniread(Options,Hour)
  DIALOG SET, Min, @iniread(options,min)
  DIALOG SET, Status1, Last Backup Was on @iniread(Info,LastBackup)
  LIST LOADFILE, LIST1, @path(%0)Backup.dat
  LIST CREATE, 1
  LIST CREATE, 2
  DIALOG SHOW
  IF %1
  goto HideBUTTON
  end
:Evloop
DIALOG CURSOR
  wait event,0
  goto @event()
:Timer
%%backuppath = @iniread(Options,BackupPath)
%%Monday = @iniread(Days,Monday)
%%Tuesday = @iniread(Days,Tuesday)
%%Wednesday = @iniread(Days,Wednesday)
%%Thursday = @iniread(Days,Thursday)
%%Friday = @iniread(Days,Friday)
%%Saturday = @iniread(Days,Saturday)
%%Sunday = @iniread(Days,Sunday)
%%gettimehour = @datetime(h)
%%getsettime = @iniread(Options,Hour)
%%gettimemin = @datetime(n)
%%getsetmin = @iniread(Options,Min)
%%ROS = @iniread(ROS,ROS)
If %%Monday
IF @equal(@datetime(dddd),Monday)
REM --- Check Time ----
if @equal(%%gettimehour,%%getsettime)
 if @equal(%%gettimemin, %%getsetmin)
 %%timedrun = 1
 gosub backup
 end
end
REM --- End Check Time ---
end
end
If %%Tuesday
IF @equal(@datetime(dddd),Tuesday)
REM --- Check Time ----
if @equal(%%gettimehour,%%getsettime)
 if @equal(%%gettimemin, %%getsetmin)
 %%timedrun = 1
 gosub backup
 end
end
REM --- End Check Time ---
end
end
If %%Wednesday
IF @equal(@datetime(dddd),Wednesday)
REM --- Check Time ----
if @equal(%%gettimehour,%%getsettime)
 if @equal(%%gettimemin, %%getsetmin)
 %%timedrun = 1
 gosub backup
 end
end
REM --- End Check Time ---
end
end
If %%Thursday
IF @equal(@datetime(dddd),Thursday)
REM --- Check Time ----
if @equal(%%gettimehour,%%getsettime)
 if @equal(%%gettimemin, %%getsetmin)
  %%timedrun = 1
 gosub backup
 end
end
REM --- End Check Time ---
end
end
If %%Friday
IF @equal(@datetime(dddd),Friday)
REM --- Check Time ----
if @equal(%%gettimehour,%%getsettime)
 if @equal(%%gettimemin, %%getsetmin)
  %%timedrun = 1
 gosub backup
 end
end
REM --- End Check Time ---
end
end
If %%Saturday
IF @equal(@datetime(dddd),Saturday)
REM --- Check Time ----
if @equal(%%gettimehour,%%getsettime)
 if @equal(%%gettimemin, %%getsetmin)
 %%timedrun = 1
 gosub backup
 end
end
REM --- End Check Time ---
end
end
If %%Sunday
IF @equal(@datetime(dddd),Sunday)
REM --- Check Time ----
if @equal(%%gettimehour,%%getsettime)
 if @equal(%%gettimemin, %%getsetmin)
 %%timedrun = 1
 gosub backup
 end
end
REM --- End Check Time ---
end
end
goto evloop
:HourCLICK
IF @greater(@dlgtext(Hour),23)
DIALOG SET, Hour, 23
WARN Only 24 hours in a day
goto evloop
end
goto evloop
:MinClick
IF @GREATER(@DLGTEXT(Min),59)
DIALOG SET, Min, 59
WARN Only 60 Minutes in a Hour
goto evloop
end
goto evloop
:LIST1DBLCLICK
LIST DELETE, LIST1
  goto evloop
:Backup
REM --- Backup Here ---
DIALOG CURSOR, WAIT
INIFILE OPEN, Settings.ini
LIST SEEK, LIST1,0
%c = @count(LIST1)
repeat
%%curfile = @next(list1)
DIALOG SET, STATUS1, Copying %%curfile to %%backuppath
FILE COPY, %%curfile, %%backuppath
%%filename = @name(%%curfile).@ext(%%curfile)
wait
FILE RENAME, %%backuppath\%%filename, %%backuppath\@datetime(dd_mm_yy)_%%filename
if @not(@ok())
%R = @msgbox(File copy of %%curfile did not succeed. @cr()Please make sure the file is not in use!,Failure,$040)
INIFILE WRITE, Info, LastBackup, Last Backup failed on @datetime(dd/mm/yy)
end
%x = @succ(%x)
until @equal(%c,%x)
INIFILE WRITE, Info, LastBackup, @datetime(dddd) the @datetime(dd) of @datetime(mmmm)
DIALOG SET, STATUS1, Backup Finished!
exit
:BackupFilesBUTTON
%%timedrun = 0
  gosub backup
  goto evloop
:DirBUTTON
  %%BackupDir = @DIRDLG(Select a Backup Directory,,1)
  DIALOG SET, BACKUPPATH, %%Backupdir
  GOSUB SaveSettings
  goto evloop
:AddFilesBUTTON
  LIST CLEAR, 1
  %%AddFile = @FILEDLG(Backup Files,Select which files to backup,,MULTI)
  LIST APPEND, 1, %%Addfile
  %e = @count(2)
  REM -- CHECK TO SEE IF THE SELECTED FILE(S) ARE NOT ALREADY IN THE LIST
  IF @equal(%e,0)
  goto append
  end
  %x = @count(2)
  %c  = 0
  %l = @count(1)
  list seek,1,0
  if @not(@greater(%l,%x))
  repeat
    %M = @match(1, @item(2,%c))
    if %M
      rem If we have a match in list 2 from list 1, delete the item in list 2
      list seek,1,@index(1)
      list delete,1
    end
    %c = @succ(%c)
  until @equal(%c,%x)
  else
  repeat
  LIST SEEK, 1, 0
    %M = @match(1, @item(2,%c))
    if %M
      rem If we have a match in list 2 from list 1, delete the item in list 2
      list seek,1,@index(1)
      list delete,1
    end
    %c = @succ(%c)
  until @equal(%c,%l)
  end
  :append
  LIST APPEND, 2,1
  LIST APPEND, LIST1, 1
  goto evloop
:SaveSettings
INIFILE OPEN, SETTINGS.ini
INIFILE WRITE, Options, BackupPath, @dlgtext(BackupPath)
INIFILE WRITE, Days, Monday, @dlgtext(Monday)
INIFILE WRITE, Days, Tuesday, @dlgtext(Tuesday)
INIFILE WRITE, Days, Wednesday, @dlgtext(Wednesday)
INIFILE WRITE, Days, Thursday, @dlgtext(Thursday)
INIFILE WRITE, Days, Friday, @dlgtext(Friday)
INIFILE WRITE, Days, Saturday, @dlgtext(Saturday)
INIFILE WRITE, Days, Sunday, @dlgtext(Sunday)
INIFILE WRITE, ROS,ROS,@dlgtext(ROS)
if @equal(@dlgtext(ros),1)
REGISTRY WRITE, LOCAL, Software\Microsoft\Windows\CurrentVersion\Run, Backup Manager, @path(%0)@name(%0).@ext(%0) /q
else
REGISTRY DELETE, LOCAL, Software\Microsoft\Windows\CurrentVersion\Run, Backup Manager
end
INIFILE WRITE, Options,Hour,@dlgtext(Hour)
INIFILE WRITE, Options,Min,@dlgtext(Min)
LIST SAVEFILE, LIST1, @path(%0)Backup.dat
DIALOG SET, STATUS1, Configuration Saved!
exit
:SaveBUTTON
gosub savesettings
goto evloop
:HideBUTTON
WINDOW HIDE, Backup Manager
  goto evloop
:TASKICON1CLICK
WINDOW NORMAL, Backup Manager
goto evloop
:Close
  exit
Back to top
View user's profile Send private message
Dr. Dread
Professional Member
Professional Member


Joined: 03 Aug 2001
Posts: 1065
Location: Copenhagen, Denmark

PostPosted: Thu Oct 28, 2004 6:05 am    Post subject: Reply with quote

Make yourself a parameter somewhere - registry/INI file/directly in VDS - that records the
date of your latest backup upon completion of the backup section. Then check that the
current date is newer than the value in that parameter before running the backup routine
again:

Code:
%%lastrun = @datetime(yy)@datetime(mm)@datetime(dd)


and check

Code:
%%curdate = @datetime(yy)@datetime(mm)@datetime(dd)
if @greater(%%curdate,%%lastrun)
 REM Do your backup
end


Greetz
Dread

_________________
~~ Alcohol and calculus don't mix... Don't drink and derive! ~~

String.DLL * advanced string processing
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group