JNAbout.lbtClose'Name: JNAbout.lbtClose 'Author/Date: Andy Lyons, April 1998 'Updated_by/Date: 'Course: URP6272, Spring '98 'Prepared at: GeoPlan Center, University of Florida '--------------------------------------------------- 'Description: Closes the JNAbout dialog 'Requires: 'Calls: 'Is called by: 'Self: 'Returns: 'FileName: '--------------------------------------------------- Self.GetDialog.Close
top
JNAboutOpen'Name: JNAboutOpen 'Author/Date: Andy Lyons, April 1998 'Updated_by/Date: 'Course: URP6272, Spring '98 'Prepared at: GeoPlan Center, University of Florida '--------------------------------------------------- 'Description: Opens the JNAbout dialog 'Requires: 'Calls: 'Is called by: 'Self: 'Returns: 'FileName: '--------------------------------------------------- av.GetProject.FindDialog("JNAbout").Open
top
JNBaseLayers.lbtCancel'Name: JNBaseLayers.lbtCancel 'Author/Date: Andy Lyons, April 1998 'Updated_by/Date: 'Course: URP6272, Spring '98 'Prepared at: GeoPlan Center, University of Florida '--------------------------------------------------- 'Description: Closes the JNBaseLayers dialog '--------------------------------------------------- Self.GetDialog.Close
top
JNBaseLayers.lbtOK'Name: JNBaseLayers.lbtOK 'Author/Date: Andy Lyons, April 1998 'Updated_by/Date: 'Course: URP6272, Spring '98 'Prepared at: GeoPlan Center, University of Florida '--------------------------------------------------- 'Description: Adds the themes that the user ' selected to the View then closes the dialog ' then closes JNColorByDate dialog '--------------------------------------------------- theListBox = self.GetDialog.FindByName("lbxThemes") selectedThemesList = theListBox.GetSelection if (selectedThemesList.Count = 0) then MsgBox.Warning("You did not select a base layer to add to the view.", "Nothing Selected") return nil end checkboxValue = self.GetDialog.FindByName("chk_DisplayThemes").IsSelected Self.GetDialog.Close baseVTab = av.FindDoc("Base Layers").GetVTab if (baseVTab = NIL) then MsgBox.Warning("Could not find the 'Base Layers' table." + "You will have to add base layers manually.","") Return Nil end 'Make a dictionary for easy look up descriptField = baseVTab.FindField("Descript") shapeField = baseVTab.FindField("Shapfile") dataDict = Dictionary.Make (2) for each rec in baseVTab theDescript = baseVTab.ReturnValue(descriptField, rec) theShapeFile = baseVTab.ReturnValue(shapeField, rec) dataDict.Add(theDescript, theShapeFile) end thisView = av.GetActiveDoc for each newThemeDescript in selectedThemesList aFileNameString = FileName.Merge (_pathToData, dataDict.Get(newThemeDescript)).AsString 'aFileNameString = _pathToData + dataDict.Get(newThemeDescript) dataSrc = SrcName.Make(aFileNameString) if (dataSrc = NIL) then MsgBox.Warning("Couldn't open " + aFileNameString,"Couldn't Open Shape File") Continue end newTheme = Theme.Make(dataSrc) newTheme.SetName(newThemeDescript) newTheme.SetVisible(checkboxValue) 'If a legend has been saved for this layer, load it. avlFN = (aFileNameString.Left(aFileNameString.Count-3) + "avl").AsFileName if (File.Exists(avlFN)) then newTheme.GetLegend.Load(avlFN, #LEGEND_LOADTYPE_ALL) end thisView.AddTheme(newTheme) newTheme.UpdateLegend end
top
JNBaseLayers.Open'Name: JNBaseLayers.Open 'Author/Date: Andy Lyons, April 1998 'Updated_by/Date: 'Course: URP6272, Spring '98 'Prepared at: GeoPlan Center, University of Florida '--------------------------------------------------- 'Description: Fills the lbxThemes list box on the ' JNBaseLayers dialog 'Calls: 'Is called by: JNBaseLayers Open event '--------------------------------------------------- baseVTab = av.FindDoc("Base Layers").GetVTab if (baseVTab = NIL) then MsgBox.Warning("Could not find the 'Base Layers' table." + "You will have to add base layers manually.","") Return Nil end descriptField = baseVTab.FindField("Descript") themesBox = self.FindByName("lbxThemes") themesBox.DefineUniqueFromVTab (baseVTab, descriptField, FALSE, FALSE, TRUE) 'Set the value of the checkbox self.FindByName("chk_DisplayThemes").SetSelected(TRUE)
top
JNBaseLayers.OpenWindow'Name: JNBaseLayers.OpenWindow 'Author/Date: Andy Lyons, April 1998 'Updated_by/Date: 'Course: URP6272, Spring '98 'Prepared at: GeoPlan Center, University of Florida '--------------------------------------------------- 'Description: Opens the JNBaseLayers dialog 'Is called by: Menu item on View GUI '--------------------------------------------------- av.GetProject.FindDialog("JNBaseLayers").Open
top
JNCalcEventFrequencies'Name: JNCalcEventFrequencies 'Author/Date: Andy Lyons, April 1998 'Updated_by/Date: 'Course: URP6272, Spring '98 'Prepared at: GeoPlan Center, University of Florida '--------------------------------------------------- 'Description: Looks at the 'Journey North Data' table, then goes through it ' and calculates the number of observations for each ' type of event, then saves that in a table. ' This info will be loaded into the dialog box 'Requires: 'Calls: 'Is called by: JNImportCritters '--------------------------------------------------- 'Get the critters VTab crittersVTab = av.FindDoc("Journey North Data").GetVTab if (crittersVTab = NIL) then MsgBox.Warning("Could not find 'Journey North Data' table.","") Return Nil end if (crittersVTab.StartEditingWithRecovery.Not) then MsgBox.Warning("Could not edit the 'Journey North Data' file. " + "Please make sure jn_data.dbf is not write-protected.", "Could not open file") return nil end 'First we must add a field to the critterVTab. This field will 'save the event & month of each observation in the format that will 'eventually be used in the Migration Data Control Panel dialog newField = Field.Make("Event_Month",#FIELD_CHAR,64,0) crittersVTab.AddFields({newField}) crittersVTab.GetSelection.ClearAll calcExpr = "[Event] + ""|"" + [Obsdate].AsDate.SetFormat(""MMM, yyyy"").AsString" crittersVTab.Calculate(calcExpr,newField) 'Next we will summarize this table, counting up the number of 'observations for each value of the new field, and save the results 'the results in a new dbf. dateField = crittersVTab.FindField("obsdate") tempDBFFile = FileName.GetTmpDir.MakeTmp ("jn_sum", "dbf") summaryVTab = crittersVTab.Summarize(tempDBFFile, dBase, newField, {dateField}, {#VTAB_SUMMARY_COUNT}) 'Now that we have created a new dbf with the data that summarizes 'the frequency of each event-month, we don't need to save the 'edits that we made to the crittersVTab. crittersVTab.StopEditingWithRecovery(FALSE) 'Next we are going to take the data from our new dbf, reformat it, 'and save the results in the 'Event Frequencies by Month' table. This 'table will be used to populate the Months listbox in the Migration 'Data Control Panel dialog. First get the VTab eventFreqVTab = av.FindDoc("Event Frequencies by Month").GetVTab if (eventFreqVTab = NIL) then MsgBox.Warning("Can't find the table 'Event Frequencies by Month'.","Table Not Found") return nil end 'Check to see if the base table is writable. If it's write 'protected, then the vtab has to be exported to a new place 'before you can append records to it. srcFN = eventFreqVTab.GetBaseTableFileName if (File.IsWritable (srcFN).Not) then 'If this one isn't writable, then put it in the same place as 'the Journey North Migration Data table Jn_dataFN = av.GetProject.FindDoc("Journey North Data").GetVTab.GetBaseTableFileName Jn_dataDir = Jn_dataFN.ReturnDir Jn_dataDir.MergeFile("jn_freq.dbf") eventFreqVTab = eventFreqVTab.Export(Jn_dataDir, dBase, FALSE) av.GetProject.RemoveDoc (av.GetProject.FindDoc("Event Frequencies by Month")) newTable = Table.Make(eventFreqVTab) newTable.SetName("Event Frequencies by Month") end 'If there are already records in this table, delete them all. eventFreqVTab.SetEditable(TRUE) if (eventFreqVTab.GetNumRecords > 0) then mySelection = eventFreqVTab.GetSelection mySelection.SetAll eventFreqVTab.RemoveRecords(mySelection) end 'We are going to append the records from the new dbf file, after 'some reformatting, to the now empty 'Event Frequencies by 'Month' table. Set up fields. outputFieldEvent = eventFreqVTab.FindField("Event") outputFieldMonthFreq = eventFreqVTab.FindField("Month_Freq") inputFieldEventMonth = summaryVTab.FindField("Event_mont") inputFieldFreq = summaryVTab.FindField("Count") 'We are going to use the status bar while we go through the 'new dbf VTab. numNewRecs = summaryVTab.GetNumRecords av.SetStatus(0) av.ShowMsg ("Formatting data. Please wait...") for each rec in summaryVTab av.SetStatus (rec/numNewRecs * 100) sourceString = summaryVTab.ReturnValue(inputFieldEventMonth,rec) freqString = "(" + summaryVTab.ReturnValue(inputFieldFreq,rec).AsString + ")" separateItems = sourceString.AsTokens("|") if (separateItems.Count = 2) then eventOnly = separateItems.Get(0) month_freqOnly = separateItems.Get(1) newRec = eventFreqVTab.AddRecord eventFreqVTab.SetValue(outputFieldEvent, newRec, eventOnly) eventFreqVTab.SetValue(outputFieldMonthFreq, newRec, month_freqOnly ++ freqString) end end av.SetStatus(0) av.ClearMsg 'Save the changes to the table. eventFreqVTab.SetEditable(FALSE) av.PurgeObjects av.DelayedRun ("View.DeleteFileNames", {tempDBFFile}, 10) MsgBox.Info("Done.","Finished Calculating Frequencies by Month")
top
JNColorByDate.lbtCancel'Name: JNColorByDate.lbtCancel 'Author/Date: Andy Lyons, April 1998 'Updated_by/Date: 'Course: URP6272, Spring '98 'Prepared at: GeoPlan Center, University of Florida '--------------------------------------------------- 'Description: Closes the JNColorByDate dialog '--------------------------------------------------- Self.GetDialog.Close
top
JNColorByDate.lbtOK'Name: JNColorByDate.lbtOK 'Author/Date: Andy Lyons, April 1998 'Updated_by/Date: 'Course: URP6272, Spring '98 'Prepared at: GeoPlan Center, University of Florida '--------------------------------------------------- 'Description: Changes the legend of the active themes ' then closes JNColorByDate dialog '--------------------------------------------------- thisDialog = Self.GetDialog activeThemes = av.GetActiveDoc.GetActiveThemes for each pointTheme in activeThemes thisLegend = pointTheme.GetLegend thisLegend.SetLegendType(#LEGEND_TYPE_COLOR) 'Classify the legend according to the user's settings if (thisDialog.FindByName("GroupingOptions").GetSelected.GetName = "radQuantile") then numClasses = thisDialog.FindByName("txlNumGroups").GetText.AsNumber thisLegend.Quantile (pointTheme, "Obsdate", numClasses) else 'Since Avenue doesn't have a request to set the width of the intervals, 'we must try to guess the number of intervals by dividing the 'total range of dates by the user defined number of days. Then we will 'manually set the upper and lower limit for each classification 'First find the total range of dates in this theme earliestDate = 99999999 latestDate = 0 myVTab = pointTheme.GetFTab dateField = myVTab.FindField("Obsdate") for each rec in myVTab thisDate = myVTab.ReturnValue(dateField, rec) if (thisDate > latestDate) then latestDate = thisDate end if (thisDate < earliestDate) then earliestDate = thisDate end end numSecsInDay = (60 * 60 * 24) dateRangeInDays = ((latestDate.AsDate - earliestDate.AsDate).AsSeconds / numSecsInDay).Round 'Now that we know the number of days, calculate the number of intervals 'and userDaysInterval = thisDialog.FindByName("txlNumDays").GetText.AsNumber numClasses = (dateRangeInDays / userDaysInterval).Round thisLegend.Interval (pointTheme, "Obsdate", numClasses) 'Because the way the way that Avenue creates the equal intervals, some of 'the upper and lower bounds are meaningless in terms of dates. So we have 'to go through these manually and clean them up. classList = thisLegend.GetClassifications lowerLimitDate = earliestDate.AsDate for each indexNum in 0..(numClasses-1) thisClassification = classList.Get(indexNum) thisClassification.SetMinimum(lowerLimitDate.SetFormat("yyyyMMdd").AsString.AsNumber) upperLimitDate = lowerLimitDate + userDaysInterval.AsDays thisClassification.SetMaximum(upperLimitDate.SetFormat("yyyyMMdd").AsString.AsNumber) lowerLimitDate = upperLimitDate + 1.AsDays end end 'Now update the legend label for each classification classList = thisLegend.GetClassifications for each classif in classList minValue = classif.ReturnMinimum maxValue = classif.ReturnMaximum if (minValue > 0) then 'msgbox.info(minValue.GetClass.GetClassName,"") minDateString = minValue.AsDate.SetFormat("MMM d").AsString maxDateString = maxValue.AsDate.SetFormat("MMM d").AsString newRangeString = minDateString ++ "-" ++ maxDateString classif.SetLabel(newRangeString) end end 'Set the colors toColor = thisDialog.FindByName("cbxToColor").GetCurrentValue thisLegend.GetSymbols.RampSavedColors (toColor) pointTheme.InvalidateLegend pointTheme.UpdateLegend end av.GetActiveDoc.InvalidateTOC(TRUE) Self.GetDialog.Close
top
JNColorByDate.Open'Name: JNColorByDate.Open 'Author/Date: Andy Lyons, April 1998 'Updated_by/Date: 'Course: URP6272, Spring '98 'Prepared at: GeoPlan Center, University of Florida '--------------------------------------------------- 'Description: Sets initial values of radio buttons and combo box 'Called by: JNColorByDate open event '--------------------------------------------------- Self.FindByName("radQuantile").Select cbxTo = Self.FindByName("cbxToColor") cbxTo.DefineFromList(SymbolList.GetPredefined(#SYMLIST_TYPE_COLORRAMP)) cbxTo.GoFirst cbxTo.SelectCurrent
top
JNColorFromRGBString'Name: JNColorFromRGBString 'Author/Date: Andy Lyons, April, 1998 'Updated_by/Date: 'Course: URP6272, Spring '98 'Prepared at: GeoPlan Center, University of Florida '--------------------------------------------------- 'Description: Gets a string in the form of "123255234" ' and returns a color from RGB values 'Is called by: JNMakeOvals.lbtOK 'Self: String 'Returns A color or NIL '--------------------------------------------------- RGBString = Self if (RGBString.Count <> 9) then msgbox.warning("Invalid string passed:" ++ RGBString,"Can't Make Color") return nil end RGBString = RGBString.Split({3, 6}, ":") RGBList = RGBString.AsTokens(":") for each indexNum in 0..(RGBList.Count - 1) stringValue = RGBList.Get(indexNum) RGBList.Set(indexNum, stringValue.AsNumber) end thisColor = Color.Make thisColor.SetRgbList(RGBList) return thisColor
top
JNControlPanel.cbxEvents.Select'Name: JNControlPanel.cbxEvents.Select 'Author/Date: Andy Lyons, April 1998 'Updated_by/Date: 'Course: URP6272, Spring '98 'Prepared at: GeoPlan Center, University of Florida '--------------------------------------------------- 'Description: After the user has selected an event to show, this script ' will update the lbxDates with valid dates. 'Is called by: JNControlPanel.cbxEvents Select event '--------------------------------------------------- 'Note this script is called by both the cbxEvent select event and also the 'the dialog open event, so we can't use the Self object in avenue. dlgJNControlPanel = av.GetProject.FindDialog("JNControlPanel") eventfreqVTab = av.FindDoc("Event Frequencies by Month").GetVTab if (eventfreqVTab = NIL) then MsgBox.Warning("Could not find the 'Event Frequencies by Month' table. " + "Try importing the data again.","") Return Nil end 'Select only those records in the VTab that are of the chosen event type eventChosen = dlgJNControlPanel.FindByName("cbxEvents").GetCurrentValue eventfreqBitmap = eventfreqVTab.GetSelection expr = "[Event] = """ + eventChosen + """" eventfreqVTab.Query(expr, eventfreqBitmap, #VTAB_SELTYPE_NEW) 'Fill list box. The tricky part is to make the items appear in chronological 'order. To do this we need to create a list and fill the listbox from the list 'As we loop through the selected records, we will create a list of numbers that 'represent each month, This list will eventually be sorted in descending order. 'We will also create a dictionary with these same numeric representations of 'each month, in addition to the original value. We will then create a new list 'whose order will be based on the sorted values in the number list, and whose 'items will come from the value of each item in the dictionary. freqField = eventfreqVTab.FindField("Month_freq") months_as_nums_list = List.Make months_event_dict = Dictionary.Make (2) for each rec in eventfreqVTab.GetSelection month_freq_string = eventfreqVTab.ReturnValue(freqField,rec) month_only_string = month_freq_string.AsTokens("(").Get(0).Trim month_only_date = Date.Make(month_only_string, "MMM, yyyy") month_only_number = month_only_date.SetFormat("yyyyMMdd").AsString.AsNumber months_as_nums_list.Add(month_only_number) months_event_dict.Add(month_only_number,month_freq_string) end months_as_nums_list.Sort(FALSE) list_for_listbox = List.Make for each item in months_as_nums_list list_for_listbox.Add(months_event_dict.Get(item)) end datesListBox = dlgJNControlPanel.FindByName("lbxDates") datesListBox.DefineFromList(list_for_listbox)
top
JNControlPanel.lbtClose'Name: JNControlPanel.lbtClose 'Author/Date: Andy Lyons, April 1998 'Updated_by/Date: 'Course: URP6272, Spring '98 'Prepared at: GeoPlan Center, University of Florida '--------------------------------------------------- 'Description: Closes the JNControlPanel dialog '--------------------------------------------------- Self.GetDialog.Close
top
JNControlPanel.lbtColorByDate'Name: JNControlPanel.lbtColorByDate 'Author/Date: Andy Lyons, April, 1998 'Updated_by/Date: 'Course: URP6272, Spring '98 'Prepared at: GeoPlan Center, University of Florida '--------------------------------------------------- 'Description: Colors the points in the active theme 'Is called by: Color points button on JNControlPanel '--------------------------------------------------- if (System.IsShiftKeyDown) then myMsg = "COLOR BY DATE" + NL + NL + "This button will allow you to color the observation points " + NL + "from a theme that shows migration data. In order for this" + NL + "button to work, you must make one or more of the migration" + NL + "themes active by clicking on the name of the theme once so" + NL + "that it appears raised. You can specify how you want the " + NL + "points colored (i.e., by week, two weeks, etc.)" MsgBox.Report(myMsg,"Shift+Click Button Help") return nil end if (av.Run("JNControlPanel.PointThemeActive", NIL)) then av.GetProject.FindDialog("JNColorByDate").Open end
top
JNControlPanel.lbtCreateOvals'Name: JNControlPanel.lbtCreateOvals 'Author/Date: Andy Lyons, April, 1998 'Updated_by/Date: 'Course: URP6272, Spring '98 'Prepared at: GeoPlan Center, University of Florida '--------------------------------------------------- 'Description: Creates ovals of the color ranges of the active ' themes 'Is called by: Create Ovals button on JNControlPanel '--------------------------------------------------- if (System.IsShiftKeyDown) then myMsg = "CREATE OVALS" + NL + NL + "This button will draw one or more ovals which represent" + NL + "the center of the area defined by observation points." + NL + "There will be one oval for each color in the legend." + NL + NL + "In order for this button to work, you must make one or more" + NL + "themes active by clicking on the name of a theme once so" + NL + "that it appears raised." MsgBox.Report(myMsg,"Shift+Click Button Help") return nil end if (av.Run("JNControlPanel.PointThemeActive", NIL).NOT) then Return NIL end av.GetProject.FindDialog("JNMakeOvals").Open
top
JNControlPanel.lbtCreateTheme'Name: JNControlPanel.lbtCreateTheme 'Author/Date: Andy Lyons, April 1998 'Updated_by/Date: 'Course: URP6272, Spring '98 'Prepared at: GeoPlan Center, University of Florida '--------------------------------------------------- 'Description: Creates an event theme based on the criteria in ' in the event and months box 'Is called by: JNControlPanel.lbtCreateTheme click event '--------------------------------------------------- if (System.IsShiftKeyDown) then myMsg = "MAKE MIGRATION THEME" + NL + NL + "This button will create a theme showing the observation points " + NL + "for the type of event and months you selected. Before you can " + NL + "create a theme, you must select and event and one or more months." + NL + "To select more than one month, hold shift down as you select months." MsgBox.Report(myMsg,"Shift+Click Button Help") return nil end eventCombo = self.GetDialog.FindByName("cbxEvents") monthListbox = self.GetDialog.FindByName("lbxDates") 'See if at least one month as selected selectedMonthsList = monthListBox.GetSelection eventChosen = eventCombo.GetCurrentValue if (selectedMonthsList.Count = 0) then MsgBox.Report("Please select one or more months for which you want " + NL + "the observations of " + eventChosen + NL + "to be displayed. To select more than one month," + NL + "hold shift down as you click.","No Months Selected") return nil end 'See if there is a view open theView = av.GetActiveDoc if (theView.Is(View).Not) then myMsg = "Please make certain that there is a view open before you try " + "to add a theme." MsgBox.Warning(myMsg,"Can't Add View") return nil end critsVTAb = av.FindDoc("Journey North Data").GetVTab if (critsVTAb = NIL) then MsgBox.Warning("Could not find the 'Journey North Data' table. ","") Return Nil end 'Build an expression for defining those observations that meet 'the user's criteria 'Criteria one: the event eventExpr = "[Event] = " + eventChosen.Quote 'Criteria two: the months. To build this part of the expression, we will 'first build a list. The items in this list will be two-item lists which 'are the first and last dates of each month (or groups of contiguous 'months) that the user has selected. The selected items in the lbxDates 'are in descending chronological order, however I will go through them 'in reverse order okDatesList = List.Make for each indexNum in (selectedMonthsList.Count - 1)..0 by -1 thisMonth = selectedMonthsList.Get(indexNum) month_only = thisMonth.AsTokens("(").Get(0).Trim beginDate = Date.Make(month_only + " 01","MMM, yyyy dd") beginDateString = beginDate.SetFormat("yyyyMMdd").AsString if (beginDate.GetMonthOfYear = 12) then endDateSource = (beginDate.GetYear + 1).AsString ++ "01 01" else endDateSource = beginDate.GetYear.AsString ++ (beginDate.GetMonthOfYear + 1).AsString ++ "01" end endDate = Date.Make(endDateSource, "yyyy MM dd") endDateString = EndDate.SetFormat("yyyyMMdd").AsString if (okDatesList.Count = 0) then 'If this is the first month to be encountered, then add it to okDatesList okDatesList.Add({beginDateString, endDateString}) else 'At least one other month has been entered in okDatesList. So see 'if this new month is contiguous with the most recently entered month 'in okDatesList, and if it is then simply modify the ending date on 'that one. And if not then add a new item to the okDatesList endlastSavedDate = okDatesList.Get(okDatesList.Count - 1).Get(1) if (beginDateString = endlastSavedDate) then okDatesList.Get(okDatesList.Count - 1).Set(1, endDateString) else okDatesList.Add({beginDateString, endDateString}) end end end 'Next we will go through our list of ok Dates and build an 'expression that can be used to define the records that will 'be used when creating the event theme dateExpr = "" for each listItem in okDatesList okBeginDateString = listItem.Get(0) okEndDateString = listItem.Get(1) dateExpr = dateExpr + "(([Obsdate] >= " + okBeginDateString + ") AND ([Obsdate] < " + okEndDateString + ")) OR " end 'Remove the last ' OR ' dateExpr = dateExpr.Left(dateExpr.Count - 4) 'Combine the event criteria and the date criteria expr = eventExpr + " AND (" + dateExpr + ")" 'Select only the appropriate observations in the VTab critsBitmap = critsVTAb.GetSelection eventChosen = eventCombo.GetCurrentValue critsVTAb.SetDefinition(expr) theXField = critsVTAb.FindField("Obslong") theYField = critsVTAb.FindField("Obslat") aXYSrc = XYName.Make(critsVTAb, theXField, theYField ) theEventTheme = Theme.Make(aXYSrc) 'Come up with a good name for this view numChars = eventChosen.Count + 1 biggestNumYet = 0 allThemesList = theView.GetThemes for each someTheme in allThemesList someThemeName = someTheme.GetName if (someThemeName.Left(numChars) = (eventChosen + " ")) then someThemeNameBrokenList = someThemeName.AsTokens(" ") lastDigits = someThemeNameBrokenList.Get(someThemeNameBrokenList.Count - 1) if (lastDigits.IsNumber) then lastNum = lastDigits.AsNumber if (lastNum > biggestNumYet) then biggestNumYet = lastNum end end end end aGoodName = eventChosen ++ (biggestNumYet + 1).AsString theEventTheme.SetName(aGoodName) theEventTheme.SetVisible(TRUE) theView.AddTheme(theEventTheme) theView.Invalidate
top
JNControlPanel.lbtDeleteOvals'Name: JNControlPanel.lbtDeleteOvals 'Author/Date: Andy Lyons, April, 1998 'Updated_by/Date: 'Course: URP6272, Spring '98 'Prepared at: GeoPlan Center, University of Florida '--------------------------------------------------- 'Description: Creates ovals of the color ranges of the active ' themes 'Is called by: Create Ovals button on JNControlPanel '--------------------------------------------------- if (System.IsShiftKeyDown) then myMsg = "DELETE OVALS" + NL + NL + "This button will delete any ovals drawn on the active" + NL + "theme(s)." ' Other graphics will not be affected. MsgBox.Report(myMsg,"Shift+Click Button Help") return nil end if (av.Run("JNControlPanel.PointThemeActive", NIL).NOT) then Return NIL end If (MsgBox.YesNo ("Delete ovals from active theme(s)?", "Delete Ovals", TRUE).NOT) then return nil end theViewGraphicList = av.GetActiveDoc.GetGraphics DeletedAtLeastOneGraphic = FALSE activeThemes = av.GetActiveDoc.GetActiveThemes for each aPointTheme in activeThemes theThemeGraphicSet = aPointTheme.GetGraphics for each someGraphic in theThemeGraphicSet.Clone 'I have not yet figured out how to differentiate oval shapes 'from non-oval shapes. Ideally, we only want to delete oval 'graphics, and not other graphics added by the user. 'msgbox.info(someGraphic.GetShape.GetClass.GetClassName,"") 'if (someGraphic.GetShape.Is(Oval)) then theThemeGraphicSet.RemoveObj (someGraphic) theViewGraphicList.RemoveObj (someGraphic) DeletedAtLeastOneGraphic = TRUE 'end if (DeletedAtLeastOneGraphic) then aPointTheme.UpdateLegend end end end 'for each active theme if (DeletedAtLeastOneGraphic.Not) then MsgBox.Info("No ovals were found on any of the active themes.","No Ovals Found") end
top
JNControlPanel.lbtHelp'Name: JNControlPanel.lbtHelp 'Author/Date: Andy Lyons, April, 1998 'Updated_by/Date: 'Course: URP6272, Spring '98 'Prepared at: GeoPlan Center, University of Florida '--------------------------------------------------- 'Description: Displays a message. 'Is called by: Help button on JNControlPanel '--------------------------------------------------- MsgBox.Report("To see a short description of any of the " + NL + "buttons on the Migration Data Control Panel," + NL + "press shift down as you click the button.","Button Help")
top
JNControlPanel.lbtImport'Name: JNControlPanel.lbtImport 'Author/Date: Andy Lyons, April, 1998 'Updated_by/Date: 'Course: URP6272, Spring '98 'Prepared at: GeoPlan Center, University of Florida '--------------------------------------------------- 'Description: Imports data from text file and saves it in ' jn_data.dbf 'Is called by: Import button on JNControlPanel '--------------------------------------------------- if (System.IsShiftKeyDown) then myMsg = "IMPORT DATA" + NL + NL + "This button will allow you to import new migration data. You " + NL + "should use this button if you have downloaded a file from the " + NL + "the Journey North web site which contains new observations " + NL + "of migration events." + NL + NL + "Before you use this button, make certain you know where " + NL + "on your hard drive you have saved the new data file. You only" + NL + "have to import a data file once. If you import data from the " + NL + "same file more than once, you will get duplicate observations." MsgBox.Report(myMsg,"Shift+Click Button Help") return nil end myMsg = "This will import new data from Journey North about " + "observations. Do you want to continue?" If (MsgBox.YesNo (myMsg, "Import Data", TRUE).NOT) then return nil end 'Get the file name of the text file that has the new observations crittersFileName = FileDialog.Show("*.txt","Text File","Where is critters.txt?") if (crittersFileName = NIL) then myMsg = "To import data, please download a new data file from Journey North." MsgBox.Warning(myMsg,"File Not Found") return nil end 'Make a VTab based on the new text file. This assumes it has been formatted 'correctly. newDataVTab = VTab.Make(crittersFileName, false, false) if (newDataVTab.HasError) then myMsg = "Unable to import data from " + crittersFileName.AsString MsgBox.Warning(myMsg,"Import Error") return nil end newFields = newDataVTab.GetFields oldDataVTab = av.GetProject.FindDoc("Journey North Data").GetVTab oldFields = oldDataVTab.GetFields 'Error checking, see if # fields match and names of fields match fieldsMatch = TRUE if (oldFields.Count <> newFields.Count) then 'msgbox.info("Count of fields is off." ++ oldFields.Count.AsString ++ newFields.Count.AsString,"") fieldsMatch = FALSE else for each i in 0..(oldFields.Count-1) if (oldFields.Get(i).GetName <> newFields.Get(i).GetName) then 'msgbox.info("Name of fields is off.","") fieldsMatch = FALSE end end end 'Send an error message if the fields didn't match if (fieldsMatch.Not) then myMsg = "Sorry, the fields in the new data file don't seem to match the existing data." MsgBox.Warning(myMsg,"Fields Don't Match") return nil end 'See if first record of newData already exists in oldData newIdField = newDataVTab.FindField("Id") if (newIdField = NIL) then MsgBox.Warning("Can't find Id field.","") return nil end firstNew = newDataVTab.ReturnValue(newIdField,0).SetFormat("ddddddddd").AsString oldIdField = oldDataVTab.FindField("Id") firstNewAlreadyExists = FALSE for each rec in oldDataVTab if (oldDataVTab.ReturnValue(oldIdField,rec) = firstNew) then firstNewAlreadyExists = TRUE Break end end if (firstNewAlreadyExists) then myMsg = "At least one of the new records already exists in the old data. " + "If you import them it may cause duplicates. Are you sure you want to continue?" if (MsgBox.YesNo(myMsg,"",FALSE).Not) then return NIL end end 'Check to see if the base table is writable. If it's write 'protected, then the vtab has to be exported to a new place 'before you can append records to it. srcFN = oldDataVTab.GetBaseTableFileName if (File.IsWritable (srcFN).Not) then myMsg = "The main source file for the migration data is" + NL + "write-protected. Before we can append the new " + NL + "data to it, it must be saved to a new folder." MsgBox.Report(myMsg, "Can't Write To File") newFN = FileDialog.Put( "jn_data.dbf".AsFileName, "*.dbf", "Save File To...") if (newFN = NIL) then return nil end oldDataVTab = oldDataVTab.Export(newFN, dBase, FALSE) av.GetProject.RemoveDoc (av.GetProject.FindDoc("Journey North Data")) newTable = Table.Make(oldDataVTab) newTable.SetName("Journey North Data") oldFields = oldDataVTab.GetFields oldIdField = oldDataVTab.FindField("Id") end 'Prepare old table to get the new records oldDataVTab.SetEditable(TRUE) if (oldDataVTab.CanAddRecord.Not) then myMsg = "Sorry, can't add records to the existing data file. Please make " + "certain the jn_data.dbf file is not write-protected." MsgBox.Warning(myMsg,"Can't Add Records") return nil end 'Prepare status bar numNewRecs = newDataVTab.GetNumRecords av.SetStatus(0) av.ShowMsg ("Importing data. Please wait...") 'Go through line by line in new data, and append to old for each newDataRec in newDataVTab av.SetStatus (newDataRec/numNewRecs * 100) newRecInOld = oldDataVTab.AddRecord for each fieldIndex in 0..(newFields.Count-1) if (fieldIndex = 0) then 'need to do this for the first field oldDataVTab.SetValue (oldFields.Get(fieldIndex), newRecInOld, newDataVTab.ReturnValue(newFields.Get(fieldIndex), newDataRec).SetFormat("ddddddddd").AsString) else oldDataVTab.SetValue (oldFields.Get(fieldIndex), newRecInOld, newDataVTab.ReturnValue(newFields.Get(fieldIndex), newDataRec)) end end end oldDataVTab.SetEditable(FALSE) av.SetStatus(0) av.ClearMsg myMsg = "Next, ArcView will calculate frequencies of the new data for future use. " + "This will take a couple of minutes. Please be patient." MsgBox.Info(myMsg,"Calculate Frequencies") av.Run("JNCalcEventFrequencies", NIL)
top
JNControlPanel.lbtMakeChart'Name: JNControlPanel.lbtMakeChart 'Author/Date: Andy Lyons, April, 1998 'Updated_by/Date: 'Course: URP6272, Spring '98 'Prepared at: GeoPlan Center, University of Florida '--------------------------------------------------- 'Description: Creates a chart of the active ' theme 'Is called by: Create Charts button on JNControlPanel '--------------------------------------------------- if (System.IsShiftKeyDown) then myMsg = "MAKE CHART" + NL + NL + "This button will create a chart from the data" + NL + "on the active theme." MsgBox.Report(myMsg,"Shift+Click Button Help") return nil end if (av.Run("JNControlPanel.PointThemeActive", NIL).NOT) then Return NIL end activeThemes = av.GetActiveDoc.GetActiveThemes if (activeThemes.Count > 1) then myMsg = "There is more than one active theme. Please " + NL + "select only one theme to be active and try again." MsgBox.Report(myMsg, "More Than One Theme Active") Return NIL end 'Avenue can't seem to chart data from an event theme very well, 'so first I'm going to convert the event theme to a shapefile. thisTheme = activeThemes.Get(0) 'thisFTab = thisTheme.GetFTab tempShpFile= FileName.GetTmpDir.MakeTmp ("jn_sum", "shp") thisFTab = thisTheme.ExportToFtab(tempShpFile) oldLatField = thisFTab.FindField("Obslat") oldLongField = thisFTab.FindField("Obslong") dateField = thisFTab.FindField("Obsdate") newLatField = Field.Make("LatNum", #FIELD_DOUBLE, 12, 6) newLongField = Field.Make("LongNum", #FIELD_DOUBLE, 12, 6) 'Add fields and update if (thisFTab.StartEditingWithRecovery.Not) then MsgBox.Warning("Could not edit the thisFTab", "") return nil end thisFTab.AddFields({newLatField, newLongField}) for each rec in thisFTab oldLat = thisFTab.ReturnValue(oldLatField, rec) oldLong = thisFTab.ReturnValue(oldLongField, rec) thisFTab.SetValue(newLatField, rec, oldLat.AsNumber) thisFTab.SetValue(newLongField, rec, oldLong.AsNumber) end thisFTab.StopEditingWithRecovery(TRUE) 'Select only 50 records if there are more thisFTab.GetSelection.ClearAll if (thisFTab.GetNumRecords > 50) then myMsg = "This theme has more than 50 points. ArcView will only chart the first 50 records." MsgBox.Warning(myMsg, "Too Many Records") thisFTab.GetSelection.ClearAll thisFTab.GetSelection.SetRange(0, 50) end theChart = Chart.Make(thisFTab, {dateField, newLatField}) theChart.SetSeriesFromRecords(TRUE) theChartDisplay = theChart.GetChartDisplay theChartDisplay.SetType(#CHARTDISPLAY_XYSCATTER) theChartDisplay.SetStyle(#CHARTDISPLAY_VIEW_SIDEBYSIDE) theChart.SetName(thisTheme.GetName ++ " Chart") theChart.GetChartLegend.SetVisible(FALSE) theChart.GetTitle.SetVisible(FALSE) theChart.GetWin.Open theChart.GetXAxis.SetName("Date") theChart.GetXAxis.SetLabelVisible(TRUE) theChart.GetYAxis.SetName("Latitude") theChart.GetYAxis.SetLabelVisible(TRUE)
top
JNControlPanel.Open'Name: JNControlPanel.Open 'Author/Date: Andy Lyons, April 1998 'Updated_by/Date: 'Course: URP6272, Spring '98 'Prepared at: GeoPlan Center, University of Florida '--------------------------------------------------- 'Description: Fills the Event combo box and the Date(s) list box on ' JNControlPanel dialog, based on critters.txt values 'Calls: JNControlPanel.cbxEvent.Select 'Is called by: JNControlPanel Open event '--------------------------------------------------- freqVTab = av.FindDoc("Event Frequencies by Month").GetVTab if (freqVTab = NIL) then MsgBox.Warning("Could not find the 'Event Frequencies by Month' table. Try importing the data again.","") Return Nil end EventsField = freqVTab.FindField("Event") eventsComboBox = self.FindByName("cbxEvents") eventsComboBox.DefineUniqueFromVTab (freqVTab, EventsField, FALSE, FALSE, TRUE) 'Fill weeks list box av.Run("JNControlPanel.cbxEvents.Select", NIL)
top
JNControlPanel.OpenWindow'Name: JNControlPanel.OpenWindow 'Author/Date: Andy Lyons, April 1998 'Updated_by/Date: 'Course: URP6272, Spring '98 'Prepared at: GeoPlan Center, University of Florida '--------------------------------------------------- 'Description: Opens the JNControlPanel dialog window 'Is called by: Menu item on View GUI '--------------------------------------------------- av.GetProject.FindDialog("JNControlPanel").Open
top
JNControlPanel.PointThemeActive'Name: JNControlPanel.PointThemeActive 'Author/Date: Andy Lyons, April, 1998 'Updated_by/Date: 'Course: URP6272, Spring '98 'Prepared at: GeoPlan Center, University of Florida '--------------------------------------------------- 'Description: Tests to see if at least one point theme is active 'Is called by: Scripts for Color By Date, Create Chart, and ' Create Ovals 'Returns: Boolean '--------------------------------------------------- 'See if there is a view open theView = av.GetActiveDoc if (theView.Is(View).Not) then myMsg = "Please make certain that there is a view open before you" + NL + "use this button." MsgBox.Report(myMsg,"No View Open") return FALSE end 'See if there is at least one active theme activeThemes = av.GetActiveDoc.GetActiveThemes if (activeThemes.Count = 0) then myMsg = "Please make one or more themes of migration data active" + NL + "before you try to use this button. You can make a" + NL + "migration data theme active by clicking on the name of the " + NL + "once so that it appears raised." MsgBox.Report(myMsg,"No Theme Active") return FALSE end 'Make certain that all active themes are event themes allActiveThemesArePointThemes = TRUE for each pointTheme in activeThemes 'See if pointTheme is really a point theme if (pointTheme.GetSrcName.Is(XYName).Not) then allActiveThemesArePointThemes = FALSE end end if (allActiveThemesArePointThemes.Not) then myMsg = "One or more of the active themes does not seem " + NL + "to be a theme of observation points. Please select only" + NL + "point themes, then try again." MsgBox.Report(myMsg,"Not A Point Theme") return FALSE end return TRUE
top
JNControlPanel.tolIdentify'Name: JNControlPanel.tolIdentify 'Author/Date: Andy Lyons, 3/4/98 'Updated_by/Date: 'Course: URP6272, Spring '98 'Prepared at: GeoPlan Center, University of Florida '--------------------------------------------------- 'Description: Identifies the point that the user clicks on ' and displays the fields in a custom dialog. 'Is called by: Identify button of JNControlPanel '--------------------------------------------------- 'Get point from user theView = av.GetActiveDoc if (theView.Is(View).Not) then return nil end p = theView.GetDisplay.ReturnUserPoint av.UseWaitCursor FoundAFeature = FALSE theActiveThemes = theView.GetActiveThemes 'See if there are any points in the active themes 'that contain this user point. We only need one, so 'after that we'll break out of the search and move on 'to the display of the data. for each aTheme in theActiveThemes thisFTab = aTheme.GetFTab 'First see if this is a Migration Data theme. 'If it isn't, then move on. if (thisFTab.FindField("Obsdate") = NIL) then Continue end 'Look for a feature in this theme. If we find one, 'then we don't have to go through the other active 'themes. FeatureList = aTheme.FindByPoint(p) if (FeatureList.Count > 0) then FoundAFeature = TRUE Break end end if (FoundAFeature.Not) then System.Beep Return NIL end thisRecNum = FeatureList.Get(0) 'Get lots of data from the fields obsFNameField = thisFTab.FindField("Obsfname") obsFName = thisFTab.ReturnValue(obsFNameField, thisRecNum) obsLNameField = thisFTab.FindField("Obslname") obsLName = thisFTab.ReturnValue(obsLNameField, thisRecNum) obsEventField = thisFTab.FindField("Event") obsEvent = thisFTab.ReturnValue(obsEventField, thisRecNum) obsDateField = thisFTab.FindField("Obsdate") obsDateNum = thisFTab.ReturnValue(obsDateField, thisRecNum) obsDateAsDate = Date.MakeFromNumber(obsDateNum) obsDateAsString = obsDateAsDate.SetFormat("MMMM d, yyyy").AsString obsLatField = thisFTab.FindField("Obslat") obsLat = thisFTab.ReturnValue(obsLatField, thisRecNum) obsLatNum = obsLat.AsNumber if (obsLatNum < 0) then obsLatAsString = "S" else obsLatAsString = "N" end obsLatNum = obsLatNum.Abs obsLatDegrees = obsLatNum.Floor obsLatMinutesDecimal = (obsLatNum - obsLatDegrees) * 60 obsLatMinutes = obsLatMinutesDecimal.Floor obsLatSeconds = ((obsLatMinutesDecimal - obsLatMinutes) *60).Round obsLatAsString = obsLatAsString + obsLatDegrees.AsString + ":" + obsLatMinutes.AsString + ":" + obsLatSeconds.AsString obsLongField = thisFTab.FindField("Obslong") obsLong = thisFTab.ReturnValue(obsLongField, thisRecNum) obsLongNum = obsLong.AsNumber if (obsLongNum < 0) then obsLongAsString = "W" else obsLongAsString = "E" end obsLongNum = obsLongNum.Abs obsLongDegrees = obsLongNum.Floor obsLongMinutesDecimal = (obsLongNum - obsLongDegrees) * 60 obsLongMinutes = obsLongMinutesDecimal.Floor obsLongSeconds = ((obsLongMinutesDecimal - obsLongMinutes) *60).Round obsLongAsString = obsLongAsString + obsLongDegrees.AsString + ":" + obsLongMinutes.AsString + ":" + obsLongSeconds.AsString obsLongLatString = obsLongAsString + " " + obsLatAsString obsCityField = thisFTab.FindField("Obscity") obsCity = thisFTab.ReturnValue(obsCityField, thisRecNum) obsStateField = thisFTab.FindField("Obsstate") obsState = thisFTab.ReturnValue(obsStateField, thisRecNum) tchFNameField = thisFTab.FindField("Tchfname") tchFName = thisFTab.ReturnValue(tchFNameField, thisRecNum) tchLNameField = thisFTab.FindField("Tchlname") tchLName = thisFTab.ReturnValue(tchLNameField, thisRecNum) tchEmailField = thisFTab.FindField("Tchemail") tchEmail = thisFTab.ReturnValue(tchEmailField, thisRecNum) schoolField = thisFTab.FindField("School") school = thisFTab.ReturnValue(schoolField, thisRecNum) gradeField = thisFTab.FindField("Grade") grade = thisFTab.ReturnValue(gradeField, thisRecNum) schCityField = thisFTab.FindField("Schcity") schCity = thisFTab.ReturnValue(schCityField, thisRecNum) schStateField = thisFTab.FindField("Schstate") schState = thisFTab.ReturnValue(schStateField, thisRecNum) commentField = thisFTab.FindField("Comment") comment = thisFTab.ReturnValue(commentField, thisRecNum) dlgID = av.FindDialog("JNObsID") if (dlgID.IsOpen.Not) then dlgID.Open end dlgID.FindByName("txtEvent").SetText(obsEvent) dlgID.FindByName("txtDate").SetText(obsDateAsString) dlgID.FindByName("txtObserver").SetText(obsFName ++ obsLName) dlgID.FindByName("txtObsCity").SetText(obsCity + ", " + obsState) dlgID.FindByName("txtLongLat").SetText(obsLongLatString) dlgID.FindByName("txtSchool").SetText(school) dlgID.FindByName("txtSchCity").SetText(schCity + ", " + schState) dlgID.FindByName("txtGrade").SetText(grade) dlgID.FindByName("txtTeacher").SetText(tchFName ++ tchLName) dlgID.FindByName("txtEmail").SetText(tchEmail) dlgID.FindByName("txtComment").SetText(comment)
top
JNDefaultProjection'Name: JNDefaultProjection 'Author/Date: Andy Lyons, April 1998 'Updated_by/Date: 'Course: URP6272, Spring '98 'Prepared at: GeoPlan Center, University of Florida '--------------------------------------------------- 'Description: Returns the default projection used by new views 'Is called by: JNNewView 'Returns: a projection object '--------------------------------------------------- 'aRect = Rect.MakeXY(-85.45,32,83,35) 'a rectangle surrounding Atlanta, Georgia aRect = Rect.MakeXY(-180,-90,180,90) 'a rectangle for the entire world aPrj = Albers.Make(aRect) aPrj.SetCentralMeridian(-96) aPrj.SetFalseEasting(0) aPrj.SetFalseNorthing(0) aPrj.SetLowerStandardParallel (20) aPrj.SetReferenceLatitude (40) aPrj.SetUpperStandardParallel (60) aPrj.SetSpheroid(#SPHEROID_CLARKE1866) return aPrj
top
JNLatLongToDecDeg'Name: JNLatLongToDecDeg 'Author/Date: Andy Lyons, April, 1998 'Updated_by/Date: 'Course: URP6272, Spring '98 'Prepared at: GeoPlan Center, University of Florida '--------------------------------------------------- 'Description: Convers Longitude or Latitude in the form ' 38:14:47N to Decimal Degrees 'Is called by: JNOtherDataMonWatch 'Self: String like "38:14:47N" 'Returns A Decimal Degrees number, or 0 if unsuccessful '--------------------------------------------------- someString = Self 'First see if this string is convertable CantConvert = FALSE 'See if the last digit is N, W, E, or S LatOrLong = someString.Right(1) if ((LatOrLong = "N") OR (LatOrLong = "E")) then mySign = 1 elseif ((LatOrLong = "W") OR (LatOrLong = "S")) then mySign = -1 else CantConvert = TRUE end someStringMinusLet = someString.Left(someString.Count - 1) someStringList = someStringMinusLet.AsTokens(":") 'See if there are three number strings separated by colons if (someStringList.Count <> 3) then CantConvert = TRUE end for each stringPiece in someStringList if (stringPiece.IsNumber.Not) then CantConvert = TRUE end end if (CantConvert = TRUE) then myMsg = someString ++ "is not in the expected format: xx:xx:xxN|S|E|W" 'MsgBox.Warning(myMsg, "Can't Convert String") return 0 end decDeg = someStringList.Get(0).AsNumber decDeg = decDeg + (someStringList.Get(1).AsNumber / 60) decDeg = decDeg + (someStringList.Get(2).AsNumber / 3600) decDeg = mySign * decDeg return decDeg
top
JNMakeOvals.lbtCancel'Name: JNMakeOvals.lbtCancel 'Author/Date: Andy Lyons, April 1998 'Updated_by/Date: 'Course: URP6272, Spring '98 'Prepared at: GeoPlan Center, University of Florida '--------------------------------------------------- 'Description: Closes the JNMakeOvals dialog '--------------------------------------------------- Self.GetDialog.Close
top
JNMakeOvals.lbtOK'Name: JNMakeOvals.lbtOK 'Author/Date: Andy Lyons, April 1998 'Updated_by/Date: 'Course: URP6272, Spring '98 'Prepared at: GeoPlan Center, University of Florida '--------------------------------------------------- 'Description: Create the Ovals 'Called by: JNMakeOvals OK button '--------------------------------------------------- choiceListBox = Self.GetDialog.FindByName("lbxChoice") userSel = choiceListBox.GetSelection.Get(0) txlStandDevCoeff = Self.GetDialog.FindByName("txlCoef") StandDevCoeff = txlStandDevCoeff.GetText.AsNumber oldStandDevCoeff = txlStandDevCoeff.GetObjectTag if (StandDevCoeff <> oldStandDevCoeff) then txlStandDevCoeff.SetObjectTag(StandDevCoeff) end Self.GetDialog.Close av.UseWaitCursor theView = av.GetActiveDoc activeThemes = theView.GetActiveThemes thisPrj = theView.GetProjection 'Define a symbol which we will use later thePallete = av.GetSymbolWin.GetPalette symbList = thePallete.GetList(#PALETTE_LIST_FILL) mySymbol = symbList.Get(5).Clone for each aPointTheme in activeThemes theFTab = aPointTheme.GetFTab if (theFTab .StartEditingWithRecovery.Not) then MsgBox.Warning("Could not edit the 'Journey North Data' file. " + "Please make sure jn_data.dbf is not write-protected.", "Could not open file") return nil end 'First we must add a field to the FTab. This field will 'store the color of each point which will later be 'used in a summary operation. 'We must also add fields for lat and long, which are currently text newColorField = Field.Make("RGB_Color",#FIELD_CHAR,9,0) newLatField = Field.Make("LatNum", #FIELD_DOUBLE, 12, 6) newLongField = Field.Make("LongNum", #FIELD_DOUBLE, 12, 6) theFTab.AddFields({newColorField, newLatField, newLongField}) 'Next we have to make a dictionary of the classifications and their 'associated symbol color clasifDict = Dictionary.Make (2) themeLegend = aPointTheme.GetLegend classificationsList = themeLegend.GetClassifications symbolsList = themeLegend.GetSymbols for each indexNum in 0..(classificationsList.Count-2) thisClassif = classificationsList.Get(indexNum) if (thisClassif.IsText) then myMsg = "At leasat one of the active themes has not been" + NL + "classified (i.e., colored by date). Please selelct" + NL + "only those themes that have been classified and " + NL + "try again." MsgBox.Report(myMsg, "Theme Not Classified") return nil end thisInterval = thisClassif.ReturnMinimum..thisClassif.ReturnMaximum currentColor = symbolsList.Get(indexNum).GetColor currentColorRGB = "" for each colorNum in currentColor.GetRgbList currentColorRGB = currentColorRGB + (colorNum/1000).SetFormat("d.ddd").AsString.Right(3) end clasifDict.Add(thisInterval, currentColorRGB) end dictKeys = clasifDict.ReturnKeys 'Next we want to go through the FTab and fill the value of the new 'field with the corresponding RGB color from each classification. oldLatField = theFTab.FindField("Obslat") oldLongField = theFTab.FindField("Obslong") oldDateField = theFTab.FindField("Obsdate") for each rec in theFTab oldLat = theFTab.ReturnValue(oldLatField, rec) oldLong = theFTab.ReturnValue(oldLongField, rec) oldObsdate = theFTab.ReturnValue(oldDateField, rec) theFTab.SetValue(newLatField, rec, oldLat.AsNumber) theFTab.SetValue(newLongField, rec, oldLong.AsNumber) for each someInterval in dictKeys if (someInterval.Find(oldObsdate)) then RGBString = clasifDict.Get(someInterval) theFTab.SetValue(newColorField, rec, RGBString) Break end end end 'Now we have an FTAb which has the new fields. So we're ready to 'summarize tempDBFFile = FileName.GetTmpDir.MakeTmp ("jn_sum", "dbf") calcFields = {newLatField, newLatField, newLongField, newLongField} calcFuncts = {#VTAB_SUMMARY_AVG, #VTAB_SUMMARY_STDEV, #VTAB_SUMMARY_AVG, #VTAB_SUMMARY_STDEV} summedVTab = theFTab.Summarize(tempDBFFile, dBase, newColorField, calcFields, calcFuncts) theFTab.StopEditingWithRecovery(FALSE) 'Next, if the user has requested to save the ovals as a theme, then 'we're going to create a new FTab, dump the contents of the summedVTab 'into it (before they're discarded). if (userSel = "New theme") then 'Ask the user for a filename and location for the new shapefile. Exit if user cancels. defname = Filename.GetCWD.MakeTmp("ovals","shp") outputfile = FileDialog.Put(defname,"*.shp","Save Ovals As...") if (outputfile = nil) then return nil end 'Make an FTab which will be the basis of a new theme newFTab = FTab.MakeNew(outputfile , Polygon) 'Add fields from old vtab to the new ftab fieldsInSummedVTab = summedVTab.GetFields fieldsInNewFTab = fieldsInSummedVTab.DeepClone newFTab.AddFields(fieldsInNewFTab) shapeField = newFTab.FindField("Shape") if (shapeField = NIL) then msgbox.info("Shape field is nil","") return nil end 'copy the old vtab into the new ftab row by row for each rec in summedVTab newRec = newFTab.AddRecord for each indexNum in 0..(fieldsInSummedVTab.Count - 1) oldValue = summedVTab.ReturnValue(fieldsInSummedVTab.Get(indexNum), rec) newFTab.SetValue(fieldsInNewFTab.Get(indexNum), newRec, oldValue) end end end XCenterField = summedVTab.FindField("Ave_longnu") YCenterField = summedVTab.FindField("Ave_latnum") XStdDevField = summedVTab.FindField("Stddev_lon") YStdDevField = summedVTab.FindField("Stddev_lat") CountField = summedVTab.FindField("Count") RGBField = summedVTab.FindField("Rgb_color") for each rec in summedVTab if (summedVTab.ReturnValue(CountField, rec) > 1) then centerX = summedVTab.ReturnValue(XCenterField, rec) centerY = summedVTab.ReturnValue(YCenterField, rec) widthX = (summedVTab.ReturnValue(XStdDevField, rec)) * StandDevCoeff heightY = (summedVTab.ReturnValue(YStdDevField, rec)) * StandDevCoeff theOrigin = (centerX - widthX)@(centerY - heightY) theSize = (widthX * 2)@(heightY * 2) theOval = Oval.Make (theOrigin, theSize) if (userSel = "Graphics") then theGraphicOval = GraphicShape.Make(theOval) theGraphicOval.Project (thisPrj) RGBString = summedVTab.ReturnValue(RGBField, rec) thisColor = av.Run("JNColorFromRGBString", RGBString) mySymbol.SetColor (thisColor) mySymbol.SetOlColor (thisColor) theGraphicOval.SetSymbol(mySymbol.Clone) theGraphicList = av.GetActiveDoc.GetGraphics theGraphicList.Add(theGraphicOval) theGraphicSet = aPointTheme.GetGraphics theGraphicSet.Add(theGraphicOval) else newFTab.SetValue(shapeField, rec, theOval.AsPolygon) end 'if user selected graphic end 'if this rec has more than one count end 'for each rec in summed VTAb if (userSel = "New theme") then theFTheme = Ftheme.Make(newFTab) myLegend = theFTheme.GetLegend myLegend.Unique (theFTheme, "RGB_Color") myLegClassifs = myLegend.GetClassifications myLegSymbols = myLegend.GetSymbols for each indexNum in 0..(myLegClassifs.Count - 2) RGBString = myLegClassifs.Get(indexNum).ReturnMinimum thisColor = av.Run("JNColorFromRGBString", RGBString) mySymbol.SetColor (thisColor) mySymbol.SetOlColor (thisColor) myLegSymbols.Set(indexNum, mySymbol.Clone) origLabel = classificationsList.Get(indexNum).GetLabel myLegClassifs.Get(indexNum).SetLabel(origLabel) end theFTheme.SetVisible(TRUE) theFTheme.SetLegendVisible(FALSE) theFTheme.SetName(aPointTheme.GetName ++ "Ovals") theFTheme.SetObjectTag("Made by JNE") theView.AddTheme(theFTheme) theView.Invalidate end end 'for each active theme
top
JNMakeOvals.Open'Name: JNMakeOvals.Open 'Author/Date: Andy Lyons, April 1998 'Updated_by/Date: 'Course: URP6272, Spring '98 'Prepared at: GeoPlan Center, University of Florida '--------------------------------------------------- 'Description: Sets initial values of list box and text line 'Called by: JNMakeOvals dialog open event '--------------------------------------------------- choices = {"New theme", "Graphics"} choiceListBox = Self.FindByName("lbxChoice") choiceListBox.DefineFromList(choices) choiceListBox.GoRow(0) choiceListBox.SelectCurrent(FALSE) txtStandDevCoeff = Self.FindByName("txlCoef") defStandDevCoeff = txtStandDevCoeff.GetObjectTag if (defStandDevCoeff = NIL) then defStandDevCoeff = 1.5 txtStandDevCoeff.SetObjectTag(1.5) end txtStandDevCoeff.SetText(defStandDevCoeff.AsString)
top
JNMoveActiveThemes'Name: JNMoveActiveThemes 'Author/Date: Andy Lyons, April 98 'Course: URP6272, Spring '98 'Prepared at: GeoPlan Center, University of Florida '--------------------------------------------------- 'Description: Moves the active theme(s) up or down in the TOC 'Is called by: JNMoveActiveThemesUp, JNMoveActiveThemesDown 'Self: passed a string object: "up" or "down" 'Returns: NIL '--------------------------------------------------- thisView = av.GetActiveDoc allThemes = thisView.GetThemes 'We must loop through a clone of the allThemes list, otherwise when we 'shuffle the list it'll skip the next one and/or repeat one allThemesClone = allThemes.Clone if (self = "up") then 'If we are sending the active themes to the top, we must loop 'through them backwards in order to preserve the relative order targetIndex = 0 for each i in (allThemesClone.Count-1)..0 by -1 myTheme = allThemesClone.Get(i) if (myTheme.IsActive) then allThemes.Shuffle(myTheme,0) end end elseif (self = "down") then targetIndex = allThemesClone.Count for each i in 0..(allThemesClone.Count-1) myTheme = allThemesClone.Get(i) if (myTheme.IsActive) then allThemes.Shuffle(myTheme,targetIndex) end end end 'Force update, both the TOC and display thisView.InvalidateTOC(nil) thisView.Invalidate return NIL
top
JNMoveActiveThemesDown'Name: JNMoveActiveThemesDown 'Author/Date: Andy Lyons, April 98 'Updated_by/Date: 'Course: URP6272, Spring '98 'Prepared at: GeoPlan Center, University of Florida '--------------------------------------------------- 'Description: Moves the active themes down 'Calls: JNMoveActiveThemes 'Is called by: Button on View GUI '--------------------------------------------------- av.Run("JNMoveActiveThemes","down")
top
JNMoveActiveThemesUp'Name: JNMoveActiveThemesUp 'Author/Date: Andy Lyons, April 98 'Updated_by/Date: 'Course: URP6272, Spring '98 'Prepared at: GeoPlan Center, University of Florida '--------------------------------------------------- 'Description: Moves the active themes up 'Calls: JNMoveActiveThemes 'Is called by: Button on View GUI '--------------------------------------------------- av.Run("JNMoveActiveThemes","up")
top
JNNewView'Name: JNNewView 'Author/Date: Andy Lyons, April, 1998 'Updated_by/Date: 'Course: URP6272, Spring '98 'Prepared at: GeoPlan Center, University of Florida '--------------------------------------------------- 'Description: Creates a new view and opens it 'Is called by: Journey North menu on Project GUI ' and View GUI '--------------------------------------------------- viewName = MsgBox.Input("Enter a name for a new Journey North view:","Enter View Name","") if (viewName = NIL) then return nil end 'Create View newJNView = View.Make newJNView.SetProjection(av.Run("JNDefaultProjection", NIL)) ' Set the diplay units of the projection to lat/long, and map units to miles newJNView.GetDisplay.SetUnits(#UNITS_LINEAR_DEGREES) newJNView.GetDisplay.SetDistanceUnits(#UNITS_LINEAR_MILES) newJNView.SetName(viewName) 'Add themes baseThemeList = List.Make baseThemeList.Add({"world30.shp", "world30.avl", "Oceans"}) baseThemeList.Add({"na_bords.shp", "na_bords.avl", "North America Boundaries"}) for each baseThemeData in baseThemeList srcFileNamePlusPath = FileName.Merge(_pathToData, baseThemeData.Get(0)) naThemeSrc = SrcName.Make(srcFileNamePlusPath.AsString) if (naThemeSrc = NIL) then MsgBox.Warning("Could not open" ++ srcFileNamePlusPath + ".","Can't open source") Continue end naTheme = Theme.Make(naThemeSrc) naThemeLegend = naTheme.GetLegend avlFileNamePlusPath = FileName.Merge(_pathToData, baseThemeData.Get(1)) naThemeLegend.Load((avlFileNamePlusPath), #LEGEND_LOADTYPE_ALL) naTheme.SetLegendVisible(FALSE) newJNView.AddTheme(naTheme) naTheme.SetVisible(True) naTheme.SetName(baseThemeData.Get(2)) end newJNView.Invalidate newJNView.GetWin.Open 'Zoom In To USA aRect = Rect.MakeXY (-2605381, -1974567, 3087250, 2044670) newJNView.GetDisplay.SetExtent(aRect)
top
JNObsID.lbtClose'Name: JNObsID.lbtClose 'Author/Date: Andy Lyons, April 1998 'Updated_by/Date: 'Course: URP6272, Spring '98 'Prepared at: GeoPlan Center, University of Florida '--------------------------------------------------- 'Description: Closes the JNObsID dialog '--------------------------------------------------- Self.GetDialog.Close
top
JNOtherData'Name: JNOtherData 'Author/Date: Andy Lyons, April, 1998 'Updated_by/Date: 'Course: URP6272, Spring '98 'Prepared at: GeoPlan Center, University of Florida '--------------------------------------------------- 'Description: Allows the user to add other data 'Calls: JNOtherDataMonWatch, JNOtherDataWeather 'Is called by: Journey North menu on View GUI '--------------------------------------------------- ChoiceAndScript = Dictionary.Make (2) ChoiceAndScript.Add("Monarch Capture-Recapture Data", "JNOtherDataMonWatch") ChoiceAndScript.Add("Weather Data", "JNOtherDataWeather") myMsg = "Please select the type of data you would like to add." userChoice = MsgBox.ListAsString(ChoiceAndScript.ReturnKeys, myMsg, "Add Other Data") if (userChoice <> NIL) then av.Run(ChoiceAndScript.Get(userChoice),NIL) end
top
JNOtherDataMonWatch'Name: JNOtherDataMonWatch 'Author/Date: Andy Lyons, April, 1998 'Updated_by/Date: 'Course: URP6272, Spring '98 'Prepared at: GeoPlan Center, University of Florida '--------------------------------------------------- 'Description: Loads Capture-Recapture Data From Project Monarch Watch 'Calls JNLatLongToDecDeg 'Is called by: JNOtherData '--------------------------------------------------- myMsg = "Please select the data file from Project Monarch Watch" monWatchFN = FileDialog.Show("*.txt","Text File", myMsg) if (monWatchFN = NIL) then return nil end 'Make a VTab based on the new text file. This assumes it has been formatted 'correctly. txtDataVTab = VTab.Make(monWatchFN, false, false) if (txtDataVTab.HasError) then myMsg = "Unable to import data from " + monWatchFN.AsString MsgBox.Warning(myMsg,"Import Error") return nil end 'See if at least the first field was found tagLatField = txtDataVTab.FindField("Tag_Lat") tagLongField = txtDataVTab.FindField("Tag_Long") recLatField = txtDataVTab.FindField("Rec_Lat") recLongField = txtDataVTab.FindField("Rec_Long") if (tagLatField = NIL) then myMsg = "This does not seem to be a Monarch Watch capture-recapture data file" MsgBox.Warning(myMsg, "File Not Valid") Return NIL end av.UseWaitCursor 'Make an FTab which will be the basis of a new theme 'I can't use a temp file unless my shut down routine, which will delete all 'temp files, also checks for themes which use temp files as a src. And if 'I do that then I need to give the user the option of saving it elsewhere. 'tempDBFFile = FileName.GetTmpDir.MakeTmp ("jn_monw", "dbf") 'Ask the user for a filename and location for the new shapefile. defname = Filename.GetCWD.MakeTmp("capture","shp") someDBFFile = FileDialog.Put(defname,"*.dbf","Save Capture-Recapture Data As...") if (someDBFFile = nil) then return nil end newFTab = FTab.MakeNew(someDBFFile, PolyLine) 'Add fields from old vtab to the new ftab fieldsInTextVTab = txtDataVTab.GetFields fieldsInNewFTab = fieldsInTextVTab.DeepClone newFTab.AddFields(fieldsInNewFTab) shapeField = newFTab.FindField("Shape") if (shapeField = NIL) then msgbox.info("Shape field is nil","") return nil end 'Get View and Projection theView = av.GetActiveDoc if (theView = NIL) then msgbox.info("View not found.","") return nil end 'copy the old vtab into the new ftab row by row for each rec in txtDataVTab newRec = newFTab.AddRecord 'First construct the shape and add it to the Shape field tLatNum = av.Run("JNLatLongToDecDeg", txtDataVTab.ReturnValue(tagLatField, rec)) if (tLatNum = 0) then Continue end tLongNum = av.Run("JNLatLongToDecDeg", txtDataVTab.ReturnValue(tagLongField, rec)) if (tLongNum = 0) then Continue end rLatNum = av.Run("JNLatLongToDecDeg", txtDataVTab.ReturnValue(recLatField, rec)) if (rLatNum = 0) then Continue end rLongNum = av.Run("JNLatLongToDecDeg", txtDataVTab.ReturnValue(recLongField, rec)) if (rLongNum = 0) then Continue end aStartPoint = Point.Make(tLongNum, tLatNum) anEndPoint = Point.Make(rLongNum, rLatNum) lineShape = PolyLine.Make ({{aStartPoint, anEndPoint}}) 'Note for a feature theme, we do NOT want to project the line. '(But for a graphic you do) 'if (theView.GetProjection.IsNull.Not) then ' lineShape = lineShape.ReturnProjected(theProjection) 'end newFTab.SetValue(shapeField, newRec, lineShape) 'Now copy all the data fields for each indexNum in 0..(fieldsInTextVTab.Count - 1) oldValue = txtDataVTab.ReturnValue(fieldsInTextVTab.Get(indexNum), rec) newFTab.SetValue(fieldsInNewFTab.Get(indexNum), newRec, oldValue) end end theFTheme=Ftheme.Make(newFTab) thePallete = av.GetSymbolWin.GetPalette symbList = thePallete.GetList(#PALETTE_LIST_PEN) mySymbol = symbList.Get(20).Clone mySymbol.SetColor (Color.GetBlack) theLegend = theFTheme.GetLegend theLegend.GetSymbols.Set(0, mySymbol) theFTheme.SetVisible(TRUE) theFTheme.SetName("Capture-Recapture") theFTheme.SetObjectTag("Made by JNE") theView.AddTheme(theFTheme) theView.Invalidate
top
JNOtherDataWeather'Name: JNOtherDataWeather 'Author/Date: Andy Lyons, April, 1998 'Updated_by/Date: 'Course: URP6272, Spring '98 'Prepared at: GeoPlan Center, University of Florida '--------------------------------------------------- 'Description: Loads Capture-Recapture Data From Project Monarch Watch 'Is called by: JNOtherData '--------------------------------------------------- msgbox.info("Sorry, no weather data available yet.","") return nil myMsg = "Please select the data file from Project Monarch Watch" monWatchFN = FileDialog.Show("*.txt","Text File", myMsg) if (monWatchFN = NIL) then return nil end 'Make a VTab based on the new text file. This assumes it has been formatted 'correctly. newDataVTab = VTab.Make(monWatchFN, false, false) if (newDataVTab.HasError) then myMsg = "Unable to import data from " + monWatchFN.AsString MsgBox.Warning(myMsg,"Import Error") return nil end
top
JNRenameTheme'Name: JNRenameTheme 'Author/Date: Andy Lyons, April 1998 'Updated_by/Date: 'Course: URP6272, Spring '98 'Prepared at: GeoPlan Center, University of Florida '--------------------------------------------------- 'Description: Renames the active theme(s) 'Is called by: Button on View GUI '--------------------------------------------------- theView = av.GetActiveDoc for each t in theView.GetActiveThemes oldName = t.GetName myMsg = "Please enter a new name for " + oldName newName = MsgBox.Input(myMsg, "Rename Theme", oldName) if (newName <> NIL) then t.SetName(newName) end end
top
JNShutDown'Name: JNShutDown 'Author/Date: Andy Lyons, April, 1998 'Updated_by/Date: 'Course: URP6272, Spring '98 'Prepared at: GeoPlan Center, University of Florida '--------------------------------------------------- 'Description: Deletes temp files made. 'Is called by: Shutdown event '--------------------------------------------------- 'Don't need to delete temp files here because I've incorporated 'automatic file deletion into all scripts that create temp files 'jnTempFilesList = FileName.GetTmpDir.ReadFiles("jn*.*") 'for each tempFN in jnTempFilesList ' if (File.CanDelete (tempFN)) then ' File.Delete (tempFN) ' end 'end
top
JNStartUp'Name: JNStartUp 'Author/Date: Andy Lyons, April, 1998 'Updated_by/Date: 'Course: URP6272, Spring '98 'Prepared at: GeoPlan Center, University of Florida '--------------------------------------------------- 'Description: Changes the title bar of the ArcView and Project windows. ' Displays a banner ' Sets global variables 'Is called by: Startup event '--------------------------------------------------- av.SetName ("ArcView - Journey North Explorer") av.GetProject.SetName ("Journey North Explorer") _pathToData = av.GetProject.GetFileName.ReturnDir.AsString 'Note, to use the _pathToData variable, you must use the 'FileName.Merge in order to get the right FileName for the 'correct operating system file naming convention. bannerFile = FileName.Merge (_pathToData, "jnbanner.tif") MsgBox.Banner(bannerFile, 2, "") av.GetProject.FindGUI ("DialogEditor").SetVisible(FALSE) av.GetProject.FindGUI ("Script").SetVisible(FALSE)
top
JNThemeMustBeActiveUpdate'Name: JNThemeMustBeActiveUpdate 'Author/Date: Andy Lyons, 3/4/98 'Updated_by/Date: 'Course: URP6272, Spring '98 'Prepared at: GeoPlan Center, University of Florida '--------------------------------------------------- 'Description: Enables or disables a button depending ' on whether a theme is active or not 'Is called by: Update event for Move Up, Move Down, Delete Themes, buttons 'Self: Button object '--------------------------------------------------- activeViews = av.GetActiveDoc.GetActiveThemes 'See if there is at least one active view if (activeViews.Count = 0) then Self.SetEnabled(false) else Self.SetEnabled(true) end
top
View.DeleteFileNames'Name: View.DeleteFileNames 'Author/Date: Andy Lyons, April, 1998 'Updated_by/Date: 'Course: URP6272, Spring '98 'Prepared at: GeoPlan Center, University of Florida '--------------------------------------------------- 'Description: Deletes the file names passed to it 'Is called by: View.DeleteThemes.SourceAlso 'Self A list of file names '--------------------------------------------------- for each gonnaDie in Self if (File.CanDelete (gonnaDie)) then File.Delete(gonnaDie) end end
top
View.DeleteThemes'Name: View.DeleteThemes 'Author/Date: Andy Lyons, April, 1998 'Updated_by/Date: 'Course: URP6272, Spring '98 'Prepared at: GeoPlan Center, University of Florida '--------------------------------------------------- 'Description: Deletes the current theme and maybe the source file too 'Calls: View.DeleteThemes.SourceAlso 'Is called by: Menu item and button on view GUI '--------------------------------------------------- theView = av.GetActiveDoc editThm = theView.GetEditableTheme thmList = {} for each t in theView.GetActiveThemes if (t.CanDeleteFromView) then if (t = editThm) then doSave = MsgBox.YesNoCancel("Save edits to "+editThm.GetName+"?", "Stop Editing",true) if (doSave = nil) then return nil end if (editThm.StopEditing(doSave).Not) then MsgBox.Info("Unable to Save Edits to " + editThm.GetName + ", please use the Save Edits As option","") return nil else theView.SetEditableTheme(NIL) end end thmList.Add(t) end end thmList2 = thmlist.clone thmList3 = List.Make for each t in thmList doDelete = MsgBox.AllYesNo("Are you sure you want to delete theme " + t.asString + "?", "Delete Themes", true) if (doDelete = nil) then break elseif (doDelete) then theView.DeleteTheme(t) thmList2.RemoveObj(t) thmList3.Add(t) else thmList2.RemoveObj(t) end end for each t in thmList2 theView.DeleteTheme(t) thmList3.Add(t) end av.GetProject.SetModified(true) av.PurgeObjects for each t in thmList3 av.Run("View.DeleteThemes.SourceAlso", t) end
top
View.DeleteThemes.SourceAlso'Name: View.DeleteThemes.SourceAlso 'Author/Date: Andy Lyons, April, 1998 'Updated_by/Date: 'Course: URP6272, Spring '98 'Prepared at: GeoPlan Center, University of Florida '--------------------------------------------------- 'Description: Deletes the source file of the theme passed to it 'Is called by: View.DeleteThemes 'Calls: View.DeleteFileNames 'Self A theme '--------------------------------------------------- deadTheme = Self if (deadTheme.GetObjectTag <> "Made by JNE") then return nil end deadSrc = deadTheme.GetSrcName if (deadSrc.Is(XYName)) then return nil end deadSrcFN = deadSrc.GetFileName if (deadSrcFN.GetExtension = "shp") then myMsg = "Delete the source file on the hard drive for" ++ deadTheme.GetName + "?" if (MsgBox.YesNo(myMsg, "Delete Source?", TRUE)) then srcDir = deadSrcFN.ReturnDir srcFile = deadSrcFN.GetBaseName srcFile = srcFile.Left(srcFile.Count - 3) + "*" listToKill = srcDir.ReadFiles(srcFile) 'Note: I can't delete the source file right away because there is 'still an object associated with it. Instead I must wait a few seconds 'until all variables are purged. av.DelayedRun ("View.DeleteFileNames", listToKill, 10) end end
top