Sign in Join
Wiki copytemporary

Create Url File/de

Die Prozedur erstellt eine URL-Datei.\

pascal
Uses
  FileUtil, ...;
  
  ...
  
procedure subErstelleURLShortcut(const conStrShortcutDatei, conStrURL: string);
var
  txtDatei: TextFile; // Definition als Textdatei

begin
  {$I+} // stellt sicher, dass I/O im Fehlerfall eine Exception auslöst
  
  // öffnet eine Datei schreibend (eine bereits vorhandene Datei wird überschrieben)
  // die Funktion UTF8ToSys sorgt dafür, dass 
  // im Dateinamen z. B. auch Umlaute verwendet werden können
  AssignFile(txtDatei, UTF8ToSys(conStrShortcutDatei));
  Rewrite(txtDatei);
  
  try
    // Schreibt den Dateiinhalt
    WriteLn(txtDatei, '[InternetShortcut]');
    WriteLn(txtDatei, 'URL=', conStrURL);
  finally
    // Schliesst die Datei
    CloseFile(txtDatei);
  end;
  
end;

Beispiel für den Aufruf des Unterprogramms unter Windows:

pascal
  subErstelleURLShortcut('E:\Beispiel.url', 'www.google.de');

Beispiel für den Aufruf des Unterprogramms unter Linux (Ubuntu):

pascal
  subErstelleURLShortcut('/home/user/Beispiel.url', 'www.google.de');

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.

Revision 1, last changed by WikiArchive .

Talk about this page

Nobody has opened a bench for this page yet. Sign in to open one.