| View previous topic :: View next topic |
| Author |
Message |
xearo Newbie
Joined: 01 Oct 2004 Posts: 18
|
Posted: Tue Oct 26, 2004 1:36 am Post subject: Need Help with my script |
|
|
| 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, @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)
info Time to 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)
info Time to 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)
info Time to 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)
info Time to 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)
info Time to 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)
info Time to 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)
info Time to Backup
end
end
REM --- End Check Time ---
end
end
goto evloop
:HourCLICK
IF @greater(@dlgtext(Hour),24)
DIALOG SET, Hour, 24
WARN Only 24 hours in a day
goto evloop
end
goto evloop
:MinClick
IF @GREATER(@DLGTEXT(Min),60)
DIALOG SET, Min, 60
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)
FILE COPY, %%curfile, %%backuppath
if @not(@ok())
WARN File copy not successful. Please make sure the file is not in use
INIFILE WRITE, Info, LastBackup, Last Backup failed
end
%x = @succ(%x)
until @equal(%c,%x)
INIFILE WRITE, Info, LastBackup, @datetime(dddd) the @datetime(dd) of @datetime(mmmm)
goto evloop
:BackupFilesBUTTON
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
|
sorry for the lack of REM statements
can anyone tell me why this does not worked when it is compiled ??
seems to work fine on my comp, then run it on another and the program dies with error 2 at line 181
it dies when it goes to run the backup routine
and i cant work it out!
all it is MEANT to do is copy a list of files to a specified path at a specified day and time
any suggestions
feel free to use this code as you like |
|
| Back to top |
|
 |
SnarlingSheep Professional Member


Joined: 13 Mar 2001 Posts: 759 Location: Michigan
|
Posted: Tue Oct 26, 2004 2:18 am Post subject: |
|
|
I didn't get the error you mentioned, but a few things I noticed, after fixing these it ran just fine:
1.) Under ":AddFilesBUTTON" it should be LIST ADD,1,%%AddFile, not LIST APPEND, since you clear the list just before that. Either that or don't clear the list there first..
2.) Under ":DirBUTTON" it should be %%BackupDir = @DIRDLG(Select a Backup Directory) not @DIRDLG(Select a Backup Directory,,1)
3.) Finally(I think) instead of a "goto evloop" at the end of the backup sub, it should be exit, or else you have to click the Close button twice. _________________ -Sheep
My pockets hurt... |
|
| Back to top |
|
 |
Boo Valued Contributor


Joined: 31 Oct 2003 Posts: 599 Location: Gulf Breeze, Florida USA
|
Posted: Tue Oct 26, 2004 3:05 am Post subject: |
|
|
Hi Xearo,
Here is some revised code. I believe the problem was with the Backup label? No sure, but see if this works. See changes below.
FYI: Be sure to also implement Sheep's recommended changes...
Cheers,
- Boo
| Code: |
:Backup
rem --- Backup Here ---
DIALOG CURSOR, WAIT
INIFILE OPEN, Settings.ini
LIST SEEK, LIST1,0
rem ---------------Begin Changes--------------------
repeat
%%curfile = @next(list1)
if @not(@null(%%curfile))
FILE COPY, %%curfile, %%backuppath
if @not(@ok())
WARN File copy not successful. Please make sure the file is not in use
INIFILE WRITE, Info, LastBackup, Last Backup failed
end
end
until @null(%%curfile)
rem ----------------End Changes------------------------
INIFILE WRITE, Info, LastBackup, @datetime(dddd) the @datetime(dd) of @datetime(mmmm)
exit
|
|
|
| Back to top |
|
 |
xearo Newbie
Joined: 01 Oct 2004 Posts: 18
|
Posted: Tue Oct 26, 2004 3:23 am Post subject: |
|
|
Thanx for the improvements guys
still can't figure out the problem i keep getting on 1 computer i made the program to run on hehe
hmmm
looks like im gunna run it from the computer i am copying too rather than the computrer i am copying from as it now seems to work that way]
thanx guys |
|
| Back to top |
|
 |
Boo Valued Contributor


Joined: 31 Oct 2003 Posts: 599 Location: Gulf Breeze, Florida USA
|
Posted: Tue Oct 26, 2004 3:30 am Post subject: |
|
|
Hi Again,
When you copy the program over to the other PC, are you also copying the inifile, etc.? Or are you only copying the .exe and runtime .dll? |
|
| Back to top |
|
 |
xearo Newbie
Joined: 01 Oct 2004 Posts: 18
|
Posted: Tue Oct 26, 2004 4:00 am Post subject: |
|
|
That shouldn't make a a difference should it ?
as the .INI file is created after the settings have been saved
but hang on i will try it
........................................................
still the same prob
i think it might have something to do with the network settings on the comp i am using
ta
Xearo |
|
| Back to top |
|
 |
Boo Valued Contributor


Joined: 31 Oct 2003 Posts: 599 Location: Gulf Breeze, Florida USA
|
Posted: Tue Oct 26, 2004 4:03 am Post subject: |
|
|
Was just trying to get my bearings. (Sometimes it is hard to know what is going on without being there.)
Yeppers, it very well could be a network issue. Try running your app. on a third computer to see if it works there... |
|
| Back to top |
|
 |
|
|
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
|
|