I did a search of the message board looking for an easier way to create an AEX file and then to delete all the scripts and UDF functions. Steve Workings posted a script that he used.
While it worked for me, I was getting some errors when running the script. I did get a little carried away, but this script works very well now.
Caution, backup your databse, scripts and functions before running this script.
While it worked for me, I was getting some errors when running the script. I did get a little carried away, but this script works very well now.
Caution, backup your databse, scripts and functions before running this script.
Code:
'Date Created: 30-Nov-2012 10:07:53 PM 'Last Updated: 07-Jan-2013 03:58:23 PM 'Created By : Ron 'Updated By : Ron ''CAUTION, THE USE OF THIS SCRIPT IS AT THE USERS OWN RISK ''I HAVE USED THIS IN VERSION 11 AND IT APPEARS TO WORK CORRECTLY ''this script is designed to create an aex file. Then after creating the file ''it will delete all scripts and udf's from the code tab. Make a copy of your database before ''using this script. The variable vcName is the name of your database. You will need to ''edit this variable before running the script. DIM SHARED vcConfirm as C DIM SHARED vcConfirm2 as C 'set the name of your database here dim vcName as C vcName = a5.Get_Path() + "\phone" DIM SHARED vDlg_Title as C DIM SHARED vMsg as C vMsg="This Script Will Delete All Scripts And Functions While Creating An AEX File To Be Used In Place Of The Idividual Scripts And Functions."+crlf(2)+ "It is Imperative to Create An Export From The Code Tab To Backup All Scripts And Functions before continuing." DIM SHARED varC_result as C DIM XDialogStyle as P XDialogStyle.AccentColor = "Off White" XDialogStyle.Color = "Blue White" vDlg_Title="WARNING" dlg_text = <<%dlg% {Windowstyle=Gradient Horizontal} {font=calibri,15,b}{units=F}{xmargin=4,4}{ysize=.3}; {color=red on white} {text=%H=R%55,7vMsg};; {color=black on white} {region} Type "YES" to Confirm:| [.10vcConfirm]; Type "YES" to Confirm:| [.10vcConfirm2]; {endregion}; {line=0};;{justify=center,Center} <12,1.5OK>{sp=2} <*12,1.5Cancel>{sp=2} %dlg% varC_result=ui_dlg_box(vdlg_title, dlg_text, <<%code% %code%) IF varC_result <> "OK" THEN END END IF 'Show PleaseWait125 Function, msg declared for title dim shared msg as C dim shared curfile as C = "" dim count as n msg = " Creating AEX File" count = 11 PleaseWait125(.t.,msg) curfile = "Startup" pct = round((0/count)*99,0) ui_modeless_dlg_refresh(msg) ui_yield() if vcConfirm = "YES" .and. vcConfirm2 = "YES" then '' Make AEX --------------------------------------------------------------------------------- a5_compile_scripts() curfile = "AEX file Created" pct = round((1/count)*99,0) ui_modeless_dlg_refresh(msg) ui_yield() ' Make new AEX temp file --------------------------------------------------------------------- curfile = "copy file "+vcName+".alb to aex.dbf" pct = round((2/count)*99,0) ui_modeless_dlg_refresh(msg) ui_yield() file.copy(vcName+".alb", a5.Get_Path() + "\aex.dbf") curfile = "copy file "+vcName+".alm to aex.fpt" pct = round((3/count)*99,0) ui_modeless_dlg_refresh(msg) ui_yield() file.copy(vcName+".alm", a5.Get_Path() + "\aex.fpt") curfile = "copy file "+vcName+".alx to aex.cdx" pct = round((4/count)*99,0) ui_modeless_dlg_refresh(msg) ui_yield() file.copy(vcName+".alx", a5.Get_Path() + "\aex.cdx") ' add the AEX temp file to the current database ------------------------------------------------- curfile = "Adding the AEX table to the database" pct = round((5/count)*99,0) ui_modeless_dlg_refresh(msg) ui_yield() file_add_to_db(a5.Get_Path() + "\AEX.dbf") xbasic_wait_for_idle() ' Remove scrips and UDFs ------------------------------------------------------------------------- curfile = "Remove Scripts and UDF's" pct = round((6/count)*99,0) ui_modeless_dlg_refresh(msg) ui_yield() t = table.open("AEX") filter = "type = 'scrp' .or. type = 'gudf'" t.delete_range(filter) t.pack() t.close() ' Replace al* files with new dictionary ----------------------------------------------------------- curfile = "copy aex.dbf to "+ vcName+".alb" pct = round((7/count)*99,0) ui_modeless_dlg_refresh(msg) ui_yield() file.copy(a5.Get_Path() + "\aex.dbf", vcName+".alb") curfile = "copy aex.fpt to "+ vcName+".alm" pct = round((8/count)*99,0) ui_modeless_dlg_refresh(msg) ui_yield() file.copy(a5.Get_Path() + "\aex.fpt", vcName+".alm") curfile = "copy aex.cdx to "+ vcName+".alx" pct = round((9/count)*99,0) ui_modeless_dlg_refresh(msg) ui_yield() file.copy(a5.Get_Path() + "\aex.cdx", vcName+".alx") ' Erase the AEX temp table -------------------------------------------------------------------------- curfile = "Erase the temp table AEX" pct = round((10/count)*99,0) ui_modeless_dlg_refresh(msg) ui_yield() dim tbl as p tbl = A5.GET_PATH()+ "\aex.dbf" table.erase(tbl, .t.) PleaseWait125(.f.,msg) ui_msg_box("","Completed") end if END FUNCTION PleaseWait125 AS C (Show = .T.,msg="") IF show = .F. THEN IF ui_modeless_dlg_exist(msg) THEN ui_modeless_dlg_close(msg) END IF exit function END IF PleaseWait125 = "" IF msg = "" THEN msg = " Creating AEX File" END IF dim shared pct as N box_code = <<%dlg% {background=Dirty White} {font=arial,26,i} Please Wait! {'}; {font=arial,12} {sp=32}{text=4pct}%; {progress=60pct} {'}; {'}; {font=arial,9} {text=65curFile}; %dlg% box_event = <<%code% 2=2 %code% ui_modeless_dlg_box(msg,box_code,box_event) ui_modeless_dlg_setfocus(msg) ui_modeless_dlg_refresh(msg) END FUNCTION
Comment