Problem compiling a file in MapBasic v 10.5

المشرف العام

Administrator
طاقم الإدارة
There are 4 error messages with the script below. Can anybody find out how to solve them please? Everything seemed to match up in Notepad + + Any other hints would be gratefully received.

Thank you

Rob

The error messages:

[End sub] found without corresponding sub statement.Found [] while searching for [next].If without End If.Sub/Function without End Sub/Function.The script:

Include "mapbasic.def"Include "icons.def"Declare Sub MainDeclare Sub button_promptSub mainAlter ButtonPad "Main" Add Separator Add PushButton Icon MI_ICON_TRANSPORT_8 Calling button_prompt HelpMsg "Use for checking protected riverine species\nCheck for riverine species in Stroud district" showEnd SubSub button_promptDim strUserGrid as stringDim strUser100kSq,picname as stringdim strNorthings as stringdim strEastings as stringdim strAppref as stringDim strRadius as stringDim intLenUserGrid as integerDim intUserEast as integerDim intUserNorth as integerDim intMapWinId as integerdim editablelayer, objtype as integerdim obj_found,i_row_id,i,iii as integerdim cosname as stringdim s_table As Aliasdim s_row as stringdim appPoint, appBuffer, distBuffer as objectdim numrows, numrows2 as integerdim fileout, tableout, layername as stringdim dist, x2,y2 as floatdim win_id,layout_win,no_layers as integerdim width_units as floatdim c_group, c_sci_name, c_eng_name, c_gridref, c_year, c_status, c_location, c_loc_detail as stringdim spCheck as logicaldim strTitle as stringDim intAppref, aa, intstrChar as integerDim strChar, strLegalName as stringDim i_app_type as integerDim int_buffer as float'Check to see if map window is openintMapWinId=frontwindow()if intmapwinid = 0 then Note "Program can only be run in a map window" exit subend ifif windowinfo(intMapWinId,Win_Info_Type)WIN_MAPPER then Note "Program can only be run in a map window" exit subend if'Delete all from cosmetic layerdelete from windowinfo(frontwindow(),win_info_table)editablelayer=mapperinfo(frontwindow(),mapper_info_edit_layer)do case editablelayercase 0case else set map layer 0 editable onend caseDialog Title "Planning Check" Position 200, 200 width 200 height 200 Control statictext Position 20, 20 Title "Planning App. Ref:" Control EditText Position 100, 20 Into strAppref Control StaticText Position 20, 40 Title "Eastings:" Control EditText Position 100, 40 Into strEastings Control statictext Position 20, 60 Title "Northings:" Control EditText Position 100, 60 Into strNorthings Control RadioGroup Title "&Very large App;Specified Radius(m)" Value 2 Into i_app_type Control EditText Position 100, 100 Into strRadius Control OKButton Position 60, 140 Control CancelButton 'strEastings="372990" 'strNorthings="229380" 'strAppref="a" 'Validate input if CommandInfo (CMD_INFO_DLG_OK) Then intLenUserGrid = Len(strEastings) if intLenUserGrid 6 then note "Eastings need 6 characters" exit sub end if intLenUserGrid = Len(strNorthings) if intLenUserGrid 6 then note "Northings need 6 characters" exit sub end if intUserEast=val(strEastings) intUserNorth=val(strNorthings) if intUserEast = 0 or intUserNorth = 0 then note "You have not entered a valid grid reference" exit sub end if 'Check app ref if strAppref="" then note "You have not entered an application reference" exit sub else 'Remove illegal filename characters intAppref=len(strAppref) for aa=1 to intAppref strChar=mid$(strAppref,aa,1) intstrChar=asc(strChar) if intstrChar < 48 then strChar="_" elseif intstrChar > 57 and intstrChar < 65 then strChar="_" elseif intstrChar >90 and intstrChar < 97 then strChar="_" elseif intstrChar > 122 then strChar="_" end if strLegalName=strLegalName & strChar next end if if i_app_type = 2 then int_buffer = 5 else int_buffer = val(strRadius) / 1000 end if if int_buffer = 0 then note "You have not entered a valid radius" exit sub end if else exit sub end if 'Set location of output files, and delete old files if necessary tableout=getfolderpath$(folder_mydocs) & "\" & strLegalName & "_planning_application.dbf" if FileExists(tableout) then kill tableout end if fileout=getfolderpath$(folder_mydocs) & "\" & strLegalName & "_planning_application_export.xls" if FileExists(fileout) then kill fileout end if 'Create work table for building up output details create table PlanAppCheck (A char(60), B char(180), C char(200), D char(40), E char(35), F char(30), G char(250), H char(254)) file tableout type dbf insert into PlanAppCheck (A, D, E) values ("Produced using data held at the", "GCER report for planning application:", strLegalName) insert into PlanAppCheck (A, D, E) values ("Gloucestershire Centre for", "Search area: " + int_buffer*1000 + "m from:", "Eastings(" + strEastings +"), Northings(" + strNorthings + ")") insert into PlanAppCheck (A) values ("Environmental Records") insert into PlanAppCheck (A) values ("") insert into PlanAppCheck values ("Taxon Group", "Latin Name", "Common Name", "Grid Reference", "Year last recorded", "Distance from app point(m)", "Location", "Status") commit table PlanAppCheck Set CoordSys Earth Projection 8, 79, "m" , -2, 49, 0.9996012717, 400000, -100000 Bounds (-6178818.52026, -12100120.7595) (6979076.21676, 1057773.97751) Set Map Center (intUserEast,intUserNorth) 'choose style of buffer object set style brush makebrush(51,yellow,-1) set style pen makepen(2,2,yellow) create point into variable appPoint(intUserEast,intUserNorth) appBuffer=buffer(appPoint,20,int_buffer,"km") cosname=windowinfo(frontwindow(),win_info_table) set event processing off '******************************************************************************* ************ 'Check for protected species etc within buffer select * from stroud_district_riverine_species where obj within appBuffer into specieslist order by Group, Grid, Latin, Year desc numrows=TableInfo(specieslist,TAB_INFO_NROWS) if numrows=0 then spCheck=FALSE insert into PlanAppCheck (A) Values ("No Species Records Selected") else spCheck=TRUE c_sci_name = "" c_gridref = "" for i=1 to (numrows) select * from specieslist where RowID=i into results if results.gridref = c_gridref and results.sci_name = c_sci_name then 'ignore this record as it's effectively a duplicate (for the purposes of this program) else if c_sci_name = "" then insert into PlanAppCheck (A) values ("Legally Protected Riverine Species - International") end if c_group = results.group c_sci_name = results.sci_name c_eng_name = results.eng_name c_gridref = results.gridref c_year = results.year c_status = results.status c_location = results.location width_units = 0 numrows2 = 0 do until numrows2 > 0 width_units=width_units + 5 distBuffer= Buffer(appPoint, 60, width_units, "m") select * from results where obj within distBuffer numrows2=SelectionInfo(SEL_INFO_NROWS) loop dist=width_units insert into PlanAppCheck (A, B, C, D, E, F, G, H) values (c_taxongroup, c_latin, c_english, c_grid, c_year, dist, c_location, c_status) drop table resultsend ifdrop table specieslistinsert into PlanAppCheck (A) values ("")commit table PlanAppCheck'*******************************************************************************************'Export data to fileexport PlanAppCheck into fileout type "dbf" overwritedrop table PlanAppCheck'*******************************************************************************************'Create image file of planning app locationset event processing onwin_id=frontwindow()if spCheck=TRUE then set event processing off map from all2 position (5,5) width 5 height 5 set map layer 0 editable on cosname=windowinfo(frontwindow(),win_info_table) create point (intUserEast,intUserNorth) symbol (34,red,12) create object as buffer from cosname into table cosname width (int_buffer) units "km" resolution 60 set map center (intUserEast,intUserNorth) if i_app_type=2 then set map zoom 90000 units "cm" end if set event processing on win_id=frontwindow() set window win_id position (0,0) Units "cm" width 5 Units "cm" height 5 Units "cm" picname=getfolderpath$(folder_mydocs) & "\" & strLegalName & "_picture.jpg" save Window win_id as picname type "JPEG" width 9 Units "Cm" height 9 units "Cm" Copyright "Based on the Ordnance Survey Map. Licence No. 100046783" remove map layer "all2"end if'*******************************************************************************************'make original layer editable againwin_id=frontwindow()set window win_id Maxdo case editablelayercase -1 set map layer editablelayer editable onend caseend sub

أكثر...
 
أعلى