Sign in Join
Wiki copytemporary

Create Url File/de: what changed

Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.

Title: Create Url File/de

OldNewLine
1+Die Prozedur erstellt eine URL-Datei.\
2+
3+``` pascal
4+Uses
5+ FileUtil, ...;
6+
7+ ...
8+
9+procedure subErstelleURLShortcut(const conStrShortcutDatei, conStrURL: string);
10+var
11+ txtDatei: TextFile; // Definition als Textdatei
12+
13+begin
14+ {$I+} // stellt sicher, dass I/O im Fehlerfall eine Exception auslöst
15+
16+ // öffnet eine Datei schreibend (eine bereits vorhandene Datei wird überschrieben)
17+ // die Funktion UTF8ToSys sorgt dafür, dass
18+ // im Dateinamen z. B. auch Umlaute verwendet werden können
19+ AssignFile(txtDatei, UTF8ToSys(conStrShortcutDatei));
20+ Rewrite(txtDatei);
21+
22+ try
23+ // Schreibt den Dateiinhalt
24+ WriteLn(txtDatei, '[InternetShortcut]');
25+ WriteLn(txtDatei, 'URL=', conStrURL);
26+ finally
27+ // Schliesst die Datei
28+ CloseFile(txtDatei);
29+ end;
30+
31+end;
32+```
33+
34+Beispiel für den Aufruf des Unterprogramms unter Windows:
35+
36+``` pascal
37+ subErstelleURLShortcut('E:\Beispiel.url', 'www.google.de');
38+```
39+
40+Beispiel für den Aufruf des Unterprogramms unter Linux (Ubuntu):
41+
42+``` pascal
43+ subErstelleURLShortcut('/home/user/Beispiel.url', 'www.google.de');
44+```
45+
46+---
47+*From the Free Pascal wiki, page "Create Url File/de", as it stood on 2020-02-12 after a change by Trev, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*

Back to history