nl:documentation:script_example
Verschillen
Dit geeft de verschillen weer tussen de geselecteerde revisie en de huidige revisie van de pagina.
| Beide kanten vorige revisieVorige revisieVolgende revisie | Vorige revisie | ||
| nl:documentation:script_example [2015/07/07 09:57] – [Script example] marc_fokker | nl:documentation:script_example [2015/11/06 20:43] (huidige) – Externe bewerking 127.0.0.1 | ||
|---|---|---|---|
| Regel 1: | Regel 1: | ||
| - | FIXME **This page is not fully translated, yet. Please help completing the translation.**\\ //(remove this paragraph once the translation is finished)// | ||
| - | |||
| ====== Script voorbeelden ====== | ====== Script voorbeelden ====== | ||
| - | This page give tips and example of scripting functions.\\ | + | Deze pagina verschaft je tips en voorbeelden voor script-fucnties.\\ |
| - | You can also look at the three [[toolbox|standard tool box]] code from within the program. | + | You can also look at the three [[toolbox|gereedschapvenster]] code from within the program. |
| - | ===== Generality | + | ===== Algemeen |
| - | We first look in detail | + | Laten we eerst in detail |
| - | This cover many programming | + | Dit omvat veel van de basis van het programmeren. |
| - | The full script code look as following: | + | De volledige |
| < | < | ||
| // Slew telescope | // Slew telescope | ||
| Regel 37: | Regel 35: | ||
| </ | </ | ||
| - | Take a look at each part in detail: | + | Laten we ieder deel in detail |
| < | < | ||
| // Slew telescope | // Slew telescope | ||
| </ | </ | ||
| - | Is a comment, you can use < | + | Dit is commentaar, je kun < |
| ---- | ---- | ||
| Regel 50: | Regel 48: | ||
| c: Tstringlist; | c: Tstringlist; | ||
| </ | </ | ||
| - | Define the variable | + | Definieer de variabele die we later in het script |
| - | Important variable type are: integer, double, string.\\ | + | Belangrijke types van variabelen zijn: integer, double, string.\\ |
| - | The Tstringlist type is use here to send a command to Skychart. | + | Het Tstringlist type wordt hier gebruikt om een commando te versturen naar Skychart. |
| ---- | ---- | ||
| Regel 59: | Regel 57: | ||
| begin | begin | ||
| </ | </ | ||
| - | The start of our program. | + | Het begin van ons programma. |
| ---- | ---- | ||
| Regel 66: | Regel 64: | ||
| memo_1.clear; | memo_1.clear; | ||
| </ | </ | ||
| - | Clear the text box we use to show the messages. This ensure the text box is not filled by previous messages. | + | Maak het tekstvenster leeg waarin |
| ---- | ---- | ||
| Regel 73: | Regel 71: | ||
| if MenuTelescopeConnect.checked then begin | if MenuTelescopeConnect.checked then begin | ||
| </ | </ | ||
| - | We test the Checked property | + | We testen |
| - | If the result | + | Als het resultaat " |
| ---- | ---- | ||
| Regel 81: | Regel 79: | ||
| if not StrToAR(Edit_1.text, | if not StrToAR(Edit_1.text, | ||
| </ | </ | ||
| - | We try to convert the RA in HMS format from the text in Edit_1 | + | We proberen de RA in HMS formaat om te zetten van de tekst in Edit_1 |
| ---- | ---- | ||
| Regel 88: | Regel 86: | ||
| | | ||
| </ | </ | ||
| - | Convert the RA back to string | + | Converteer de RA terug naar een string-weergave maar met het decimale formaat zoals vereist voor het commando. |
| ---- | ---- | ||
| Regel 96: | Regel 94: | ||
| c.clear; | c.clear; | ||
| </ | </ | ||
| - | Request a TStringList object | + | Vraag een TStringList object |
| ---- | ---- | ||
| Regel 105: | Regel 103: | ||
| c.add(b); | c.add(b); | ||
| </ | </ | ||
| - | Add the command and the required | + | Voeg het commando en de vereiste |
| ---- | ---- | ||
| Regel 112: | Regel 110: | ||
| | | ||
| </ | </ | ||
| - | Execute the command and store the result | + | Voer het commando uit en sla het resultaat op in de variabele |
| ---- | ---- | ||
| Regel 119: | Regel 117: | ||
| memo_1.lines.add(r); | memo_1.lines.add(r); | ||
| </ | </ | ||
| - | Show the result of the command to the text box. | + | Toon het resultaat van het commando in het tekstvenster. |
| ---- | ---- | ||
| Regel 126: | Regel 124: | ||
| else memo_1.lines.add(rsTelescopeNot); | else memo_1.lines.add(rsTelescopeNot); | ||
| </ | </ | ||
| - | The case the test MenuTelescopeConnect.checked | + | Als MenuTelescopeConnect.checked |
| - | It show in the text box a translation in the local language of 'Telescope not connected'. | + | Het toont in het tekstvenster een vertaling op basis van de ingestelde taal van het bericht |
| ---- | ---- | ||
| Regel 134: | Regel 132: | ||
| end. | end. | ||
| </ | </ | ||
| - | The end of the program. | + | Het einde van het programma. |
| - | ===== Call an external | + | ===== Aanroepen van een externe bibliotheek (library) ==== |
| - | You can define a function | + | Je kunt een functie definiëren |
| - | This example implement a simple | + | Dit voorbeeld implementeert een eenvoudige |
| - | There is two button | + | Er zijn twee knoppen, |
| - | Script | + | Script |
| < | < | ||
| | | ||
| Regel 156: | Regel 154: | ||
| </ | </ | ||
| - | Script | + | Script |
| < | < | ||
| function GetTickCount: | function GetTickCount: | ||
| Regel 171: | Regel 169: | ||
| </ | </ | ||
| - | You can call any library | + | Op deze manier kun je iedere |
| - | Another limitation | + | Een andere beperking |
| - | ===== Using ASCOM directly | + | ===== Direct gebruik maken van ASCOM ==== |
| + | Dit beschrijft hoe je een ASCOM apparaat direct kunt gebruiken zonder gebruik te maken van de Skychart interne ASCOM telescoop. | ||
| - | This describe how to use an ASCOM device directly from your script | + | Dit kan gebruikt worden voor toegang tot andere klassen van apparaten, zoals in het voorbeeld hier een koepel (dome). Je kunt het ook gebruiken voor toegevoegde eigenschappen van je telescoop.\\ |
| + | In het laatste geval moet je voorzichtig zijn omdat je script | ||
| - | This can be use to access another class of device, the example here connect to a dome, or to access additional properties for your telescope.\\ | + | ==== Gebruik van de ASCOM kiezer === |
| - | In the later case you must be careful that your script work as a concurrent to Skychart main program for the device access. | + | |
| - | ==== Use the ASCOM chooser === | + | De volgende |
| - | + | ||
| - | The following | + | |
| < | < | ||
| Regel 201: | Regel 198: | ||
| </ | </ | ||
| - | Replace | + | Vervang |
| - | ==== Connect to the ASCOM driver === | + | ==== Verbind met de ASCOM driver === |
| - | The following | + | De volgende |
| < | < | ||
| var | var | ||
| Regel 220: | Regel 217: | ||
| </ | </ | ||
| - | ==== Use the ASCOM driver === | + | ==== Gebruik van de ASCOM driver === |
| - | Now we want to add a button to open the dome shutter. This is just an example, at this point any ASCOM property can be use.\\ | + | Nu willen |
| - | The first test protect again a program crash if we try to use an initialized | + | De eerste |
| - | The second | + | De tweede |
| < | < | ||
| Regel 265: | Regel 262: | ||
| </ | </ | ||
| - | ===== Run a command | + | ===== Voer een commando uit ===== |
| - | + | ||
| - | There is two different way to run an external command or program, depending if you want to wait for a result or not. | + | |
| - | ==== Wait for a result | + | Er zijn twee verschillende manieren om een extern commando of programma uit te voeren, afhankelijk of je op een resultaat wilt wachten of niet. |
| + | ==== Wacht op een resultaat | ||
| - | The following command run the DIR command | + | Het volgende commando voert het DIR commando uit in de huidige |
| < | < | ||
| Regel 283: | Regel 279: | ||
| </ | </ | ||
| - | ==== No wait ==== | + | ==== Niet wachten op het resultaat |
| - | If the command can run for an undetermined time or do not produce an output | + | Wanneer het commando uitgevoerd kan worden voor een onbepaalde tijd of geen output |
| - | This example run the Variable star observer program and exit immediately. | + | Dit voorbeeld voert het Variabele ster observator programma uit en stopt daarna direct. |
| < | < | ||
nl/documentation/script_example.1436255835.txt.gz · Laatst gewijzigd: 2015/11/06 20:36 (Externe bewerking)
