GeoGet

Complete geocaching solutions

User Tools

Site Tools


user:skripty:com

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
user:skripty:com [2010/08/17 13:48] medwyn_czuser:skripty:com [Unknown date] (current) – external edit (Unknown date) 127.0.0.1
Line 2: Line 2:
 Ze skriptů Geogetu lze volat i libovolný COM nebo OLE objekt z počítače. Ze skriptů Geogetu lze volat i libovolný COM nebo OLE objekt z počítače.
  
-Pro tento účel lze ve skriptech používat proměnné typu //variant//, které jsou schopny v sob držet libovolný datový typ včetně interfaců ke COM/OLE objektů.+Pro tento účel lze ve skriptech používat proměnné typu //variant//, které jsou schopny v sobě držet libovolný datový typ včetně interfaců ke COM/OLE objektů.
  
 ===== Příklad ===== ===== Příklad =====
Line 10: Line 10:
 procedure ReadXML; procedure ReadXML;
 var var
-  Document: Variant+  Document: variant
-  NodeList: Variant;+  NodeList: variant;
   Root: variant;   Root: variant;
   s: string;   s: string;
Line 19: Line 19:
     Document := CreateOleObject('Microsoft.XMLDOM');     Document := CreateOleObject('Microsoft.XMLDOM');
     try     try
-      Document.async := False+      Document.Async := false
-      Document.validateOnParse := false; +      Document.ValidateOnParse := false; 
-      Document.resolveExternals := false; +      Document.ResolveExternals := false; 
-      Document.preserveWhiteSpace := True+      Document.PreserveWhiteSpace := true
-      Document.load('my.gpx'); +      Document.Load('my.gpx'); 
-      if Document.parseError.errorCode <> 0 then+      if Document.ParseError.ErrorCode <> 0 then
       begin       begin
-        ShowMessage('Parse Error line ' + inttostr(Document.parseError.line)  +        ShowMessage('Parse Error line ' + inttostr(Document.ParseError.Line
-          + ', character ' + inttostr(Document.parseError.linePos) + CRLF +          + ', character ' + inttostr(Document.ParseError.LinePos) + CRLF 
-          + Document.parseError.srcText); +          + Document.ParseError.SrcText);
         exit;         exit;
       end;       end;
       Root := Document.DocumentElement;       Root := Document.DocumentElement;
       NodeList := Root.SelectNodes('/gpx/wpt/name'); //XPath       NodeList := Root.SelectNodes('/gpx/wpt/name'); //XPath
-      Showmessage('Found: ' + inttostr(NodeList.Length) + 'x');+      ShowMessage('Found: ' + IntToStr(NodeList.Length) + 'x');
       s := '';       s := '';
       for n := 0 to NodeList.Length - 1 do       for n := 0 to NodeList.Length - 1 do
       begin       begin
-        if n >= 20 then break; //just first 20 records...  +        if n >= 20 then break; //just first 20 records... 
- s := S + CRLF + NodeList.item[n].text;+        s := S + CRLF + NodeList.Item[n].Text;
       end;       end;
       ShowMessage(s);  //display result       ShowMessage(s);  //display result
Line 45: Line 45:
     end;     end;
   except   except
-    Showmessage('Crashed?');+    ShowMessage('Crashed?');
   end;   end;
 end; end;
 </code> </code>
user/skripty/com.1282045729.txt.gz · Last modified: 2010/08/17 00:00 (external edit)