home *** CD-ROM | disk | FTP | other *** search
- /*
- Control Tower Arexx Script
- Written By J.L. White
- (C)1995 Merlin's Software
- */
-
- signal on error
- signal on syntax
- Options Results
-
- Main:
- call OpenStuff()
- call Docs()
- call Routine()
- call CloseStuff()
- exit
- return
-
- GetFile:
- parse Arg Title, Path
- Address FLY_1 SetString Path
- Address FLY_1 GetFileNameNT Title
- return result
-
-
- GetPath:
- parse Arg Title, Path
- Address FLY_1 SetString Path
- Address FLY_1 GetPathNameNT Title
- return result
-
- GetText:
- parse Arg Title, Text
- Address FLY_1 SetString Text
- Address FLY_1 GetStringNT Title
- return result
-
-
- OpenStuff:
- address command "run CT:FLY"
- do while (POS('FLY_1',SHOW('Ports')) = 0)
- address command "wait 1"
- end
- TOASTERLIB="ToasterARexx.port"
- call remlib('ToasterARexx.port')
- call remlib('PROJECT_REXX_PORT')
- call addlib('PROJECT_REXX_PORT' , 0)
- call addlib(TOASTERLIB,0)
- return
-
- CloseStuff:
- Address FLY_1 Quit
- call remlib('ToasterARexx.port')
- call remlib('PROJECT_REXX_PORT')
- exit
- return
-
- YesOrNo: procedure
- parse Arg Title,Yes,No
- Address FLY_1 OK_TEXT Yes
- Address FLY_1 CANCEL_TEXT No
- Address FLY_1 AskYesNoNT Title
- if result = "OK" then YesNo = 1
- else YesNo = 0
- return YesNo
-
- Info:
- parse Arg Title,Yes
- Address FLY_1 OK_TEXT Yes
- Address FLY_1 FYINT Title
- return
-
- FindDrive:
- address command "C:Info >RAM:FLY-List"
- call open TempFile,"RAM:FLY-List",R
- do until eof(TempFile)
- line = readln(TempFile)
- parse var line Drive" "Rest
- if Drive = "FA0:" then
- Volume = word(Rest,7)":"
- end
- call close TempFile
- address command "Delete >NIL: RAM:FLY-List"
- return Volume
-
- GetFileName: procedure
- ARG CompleteName
- c = lastpos("/",CompleteName)
- if c = 0 then c = lastpos(":",CompleteName)
- return substr(CompleteName, c + 1)
-
-
- GetPathName: procedure
- ARG CompleteName
- c = lastpos(":",CompleteName)
- if c = 0 then c = lastpos(":",CompleteName)
- return left(CompleteName,c)
-
- Docs:
- Answer = YesOrNo(" Do You Need Instructions?"," YES "," NO ")
- if Answer = 0 then return
- Text = "This Macro will fix a project where the Flyer can't\
- find certain croutons. If you have moved files around\
- and the project you had can not find them this will\
- check each crouton and when it can not find a matching\
- file, it will come up with a requester to select a new\
- file to replace it with."
- Answer = YesOrNo(Text," Continue "," Exit ")
- if Answer = 0 then call CloseStuff()
-
- return
-
-
- Routine:
- start_loc=croutonspot()
- call croutonpick(LAST)
- project_end=croutonspot()
- call croutonpick(FIRST)
- current_spot=0
-
- do while (current_spot<project_end+1)
- call croutonpick(current_spot)
- current_spot=current_spot+1
- Location=(croutongettag(OriginalLocation))
- if ~exists(Location) then call FixCrouton(croutonname())
- end
- call croutonpick(start_loc)
- Address FLY_1 FYINT "Project Has Been Fixed!"
-
- return
-
-
- FixCrouton:
- parse arg oldcrouton
-
- if lastpos('/',oldcrouton,length(oldcrouton)-1)~=0 then do
- filenam2=right(oldcrouton,(length(oldcrouton)-lastpos('/',oldcrouton,length(oldcrouton)-1)))
- path2=left(oldcrouton,(lastpos('/',oldcrouton,length(oldcrouton))-1))
- end
- else do
- filenam2=right(oldcrouton,(length(oldcrouton)-lastpos(':',oldcrouton,length(oldcrouton)-1)))
- path2=left(oldcrouton,(lastpos(':',oldcrouton,length(oldcrouton))))
- end
-
- Title = "Select New Crouton For "filenam2"! "
- FileName = GetFile(Title,path2)
-
- call croutonpick(current_spot-1)
- call CROUTONSETTAG('OriginalLocation',FileName)
-
- return
-
- syntax:
- error:
- Address FLY_1 OK_TEXT " OK "
- Title = "An Error Was Found With This Macro On Line #"SIGL"!"
- Address FLY_1 FYINT Title
- Address FLY_1 Quit
- exit
-