6.00.x
Get a streetmap of where you live using OpenStreetMap.org (via Google Geocaching)
Posted March 8th, 2009 by andyfaffThese experimental functions will pull an OpenStreetmap.org map image of an address that you specify. You need to have easyHttp XOP installed.
To use type:
getPlotOfAddress("New Illawarra Rd Sydney Australia", 10000)
Where the first string is a search string you would use on googlemaps. The second number is the length of the image square you want.
Reading Header and Data From The Same File
Posted February 13th, 2009 by hrodstein// ReadHeaderAndData(pathName, fileName, extension) // Demonstrates how to open a data file to read header information using FReadLine // and then to load data from the file using LoadWave. // If pathName and fileName are not empty, they are expected to point to the data // file which will be loaded without any dialog. // If either pathName or fileName is empty (""), an Open File dialog is displayed. // If you are not familiar with symbolic paths, execute this: // DisplayHelpTopic "Symbolic Paths" Function ReadHeaderAndData(pathName, fileName, extension)
Replace Waves In Table
Posted January 25th, 2009 by hrodstein// ShowWavesInTable(tableName, title, waveNames) // Used to display a list of waves in a table which may or may not already exist. // The listed waves replace any waves already displayed in the table. // If the table does not already exist, it is created. // If the table does already exist, replaces the currently displayed waves in the table with the listed waves. static Function ShowWavesInTable(tableName, title, waveNames) String tableName String title String waveNames // Semicolon-separated list Variable numNewWaves = ItemsInList(waveNames) Variable i
Get Color of Graph Trace In Variables
Posted January 12th, 2009 by hrodstein// This was posted by Rick Gerkin to the Igor mailing list. I added a demo function. Function GetTraceColor(graph,trace,red,green,blue) String graph, trace Variable &red,&green,&blue String info = TraceInfo(graph,trace,0) String color=StringByKey("rgb(x)",info,"=") sscanf color,"(%d,%d,%d)",red,green,blue End Function DemoGetTraceColor() Make/O TraceColorDemoWave = sin(x/8) DoWindow TraceColorDemoGraph if (V_Flag == 0) Display /N=TraceColorDemoGraph TraceColorDemoWave ModifyGraph rgb(TraceColorDemoWave) = (50000, 40000, 30000) endif
Get the color of a trace on a graph
Posted January 12th, 2009 by aclightPaste the code below into an Igor procedure file and compile. Here is an example of how to use the code:
Make test Display test print GetTraceColor("Graph0", "test") 65535,0,0 ModifyGraph rgb=(0,0,39168) print GetTraceColor("Graph0", "test") 0,0,39168
//** // Get the RGB triplet representing the color of a trace on a graph. // // @param graphName // A string containing the name of the graph. // @param traceName // A string containing the name of the trace. // @return // A string containing a comma separated list with the red, green,
Save Complex 2D Wave As FixedField
Posted December 15th, 2008 by hrodstein// SaveComplex2DWaveAsFixedField(pathName, fileName, header, cw, fieldWidth, digitsAfterDP, fullPathOut) // Writes a 2D complex wave to a text file using FORTRAN-style fixed field formatting. // To try it, execute this: // MakeTestData(10,5); Test() Function SaveComplex2DWaveAsFixedField(pathName, fileName, header, cw, fieldWidth, digitsAfterDP, fullPathOut) String pathName // Symbolic path name or "" for dialog String fileName // Output file name or "" for dialog String header // Header text to be written to file or "" if none. Should end with CRLF. Wave/C cw
Create Cleaned Up Version of a Plain Text File
Posted December 4th, 2008 by hrodstein// WriteStrippedDataToNewFile(refNum, pathName, origFileName, newFileName) // Creates new file containing cleaned up contents of original file. // The original file is assumed to be a plain text file. // The following are removed from the data: // All control characters except for carriage-return (0x0D) // All characters with codes greater than 0x7F (characters not in standard ASCII set) // If newFileName exists, it is overwritten. Function WriteStrippedDataToNewFile(pathName, origFileName, newFileName) String pathName // Symbolic path where new original file exists
Extract Text From Plain Text File Using Notebook
Posted December 4th, 2008 by hrodstein// This function shows how to extract each line of text from a plain text file using a notebook. Function PrintTextFileContents() String nb = UniqueName("TempNB", 10, 0) OpenNotebook /N=$nb "" // Display open file dialog DoWindow $nb // Check if notebook exists if (V_flag == 0) return -1 // User canceled endif Notebook $nb, selection={startOfParagraph,endOfParagraph} do GetSelection Notebook, $nb, 2 // Sets S_selection to paragraph's text if (strlen(S_selection) == 0) break endif String text = S_selection
Relocate Object From One Page Layout To Another
Posted November 29th, 2008 by hrodstein// Relocates a page layout object from one layout to another. // If destObjectName is different from sourceObjectName, renames the object during the relocation. // In this case, it is up to you to make sure that destObjectName is valid and not in conflict. Function RelocateLayoutObject(sourceLayoutName, sourceObjectName, destLayoutName, destObjectName) String sourceLayoutName, sourceObjectName String destLayoutName, destObjectName String sourceInfo = LayoutInfo(sourceLayoutName, sourceObjectName) RemoveLayoutObjects /W=$sourceLayoutName $sourceObjectName
Autoscrolling a listbox to the bottom
Posted June 18th, 2008 by andyfaffThis function, when called with the name of the control window and the listbox name will scroll the listbox to the very bottom, such as if you had used the scrollbar to do it.
Function autoscrolllistbox(ctrlwindow,listboxname) string ctrlwindow,listboxname controlinfo/w=$ctrlwindow $listboxname Wave/z w = $S_DataFolder if(V_Flag>0) listbox/z $listboxname win=$ctrlwindow,row=ceil(dimsize(w,0)-V_height/V_rowheight) endif End
