[VarDef,gWriteStr,""] [VarDef,gOffset,0] [VarDef,gBytes,0] [VarDef,gNewLine,[StrMerge,[StrFromAsc,13],[StrFromAsc,10]]] [VarDef,gFilePath,""] [RoutineDef,WriteMem, [MemResize,ZB_TextOutputMem,[MemGetSize,ZB_TextOutputMem]+256] [VarSet,gBytes,[MemWriteString,ZB_TextOutputMem,pStr,gOffset,0]] [VarSet,gOffset,gOffset+gBytes] [MemResize,ZB_TextOutputMem,gOffset] ,pStr]//end routine [IButton,GetStrokeInfo,"Get the info from a previously saved Stroke", //get a Stroke file [VarSet,fileName,[FileNameAsk,"TEXT(*.txt)|*.TXT||", ,"Please Select Stroke File..."]] [If,[StrLength,fileName],,[Exit]] [MemDelete, ZB_TextOutputMem]//just makes sure this isn't around [MemCreate,ZB_TextOutputMem,256]//create memblock [VarSet,gOffset,0] [VarSet,gBytes,0] //get the non-indexed values [VarSet,tPts,[StrokeGetInfo,[StrokeLoad,fileName],0]] [VarSet,minH,[StrokeGetInfo,[StrokeLoad,fileName],4]] [VarSet,minV,[StrokeGetInfo,[StrokeLoad,fileName],5]] [VarSet,maxH,[StrokeGetInfo,[StrokeLoad,fileName],6]] [VarSet,maxV,[StrokeGetInfo,[StrokeLoad,fileName],7]] [VarSet,maxRadius,[StrokeGetInfo,[StrokeLoad,fileName],8]] [VarSet,maxRdPt,[StrokeGetInfo,[StrokeLoad,fileName],9]] [VarSet,maxHDist,[StrokeGetInfo,[StrokeLoad,fileName],10]] [VarSet,maxVDist,[StrokeGetInfo,[StrokeLoad,fileName],11]] [VarSet,totalDist,[StrokeGetInfo,[StrokeLoad,fileName],12]] [VarSet,twlCount,[StrokeGetInfo,[StrokeLoad,fileName],13]] //write strings to memblock [VarSet,gWriteStr,[StrMerge,"Total Points=",tPts,#gNewLine,"min H pos=",minH," min V pos=",minV,#gNewLine]] [RoutineCall,WriteMem,#gWriteStr] [VarSet,gWriteStr,[StrMerge,"max H pos=",maxH," max V pos=",maxV,#gNewLine,"max Radius=",maxRadius,#gNewLine]] [RoutineCall,WriteMem,#gWriteStr] [VarSet,gWriteStr,[StrMerge,"Point at max Radius=",maxRdPt,#gNewLine,"max H Distance=",maxHDist," max V Distance=",maxVDist,#gNewLine]] [RoutineCall,WriteMem,#gWriteStr] [VarSet,gWriteStr,[StrMerge,"Total Distance=",totalDist,#gNewLine,"Twirl Count=",twlCount,#gNewLine,#gNewLine]] [RoutineCall,WriteMem,#gWriteStr] [Loop,tPts,//loop through all points //get the indexed values [VarSet,hPos,[StrokeGetInfo,[StrokeLoad,fileName],1,[Val,x]]] [VarSet,vPos,[StrokeGetInfo,[StrokeLoad,fileName],2,[Val,x]]] [VarSet,press,[StrokeGetInfo,[StrokeLoad,fileName],3,[Val,x]]] [VarSet,zDepth,[StrokeGetInfo,[StrokeLoad,fileName],14,[Val,x]]] [VarSet,mKey,[StrokeGetInfo,[StrokeLoad,fileName],15,[Val,x]]] //write to memblock [VarSet,gWriteStr,[StrMerge,"#",[Val,x]," H=",hPos," V=",vPos," p=",press]] [RoutineCall,WriteMem,#gWriteStr] [VarSet,gWriteStr,[StrMerge," Z=",zDepth," K=",mKey,#gNewLine]] [RoutineCall,WriteMem,#gWriteStr] ,x] //write out the file [VarSet,gFilePath,"output.txt"]//path to file - this example will be in the same location as this zscript [VarSet,lBytes,[MemSaveToFile,ZB_TextOutputMem,gFilePath,1]]//will overwrite existing file [MemDelete, ZB_TextOutputMem] [Note,"File saved"] ] /* StrokeGetInfo 0 = Total Number of Points 1 = Indexed H Position 2 = Indexed V Position 3 = Indexed Pressure 4 = Minimum H Position Overall 5 = Minimum V Position Overall 6 = Maximum H Position Overall 7 = Maximum V Position Overall 8 = Maximum Radius 9 = Index of Point at Maximum Radius 10 = Maximum Horizontal Distance Traveled 11 = Maximum Vertical Distance Traveled 12 = Total Distance 13 = Twirl Count 14 = Indexed Z (deduced) 15 = Indexed Key Press */