Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB Enhancement Requests and Suggestions » View Thread |
Messages 11 to 12 of 12 total |
EDBMgr "snippets" functionality |
Wed, Oct 23 2013 6:42 AM | Permanent Link |
Uli Becker | Roy,
> Very nice. Now be a good boy and share your toy with your friends I can't post the application because it's part of another application, but here the code to create a single script from the database records, it's quite simple: procedure CreateBausteineScript; var slFile: TStringList; FileToCreate: string; begin dm.FilterModus(mdBaustein); slFile := TStringList.Create; try { Textbausteine } FileToCreate := AHKFilesDir + FileNameBausteine; { Datei erstellen } slFile.add('#Include AutoReload.ahk'); slFile.add('#SingleInstance force'); { * = Keine Abschlusstaste notwendig } { O (großes Otto) = Abschlusstaste wird nicht gesendet } slFile.add('#Hotstring O'); dm.ahkQuery.first; while not dm.ahkQuery.EOF do begin slFile.add('::' + dm.ahkQueryKuerzel.asString + '::' + ReplaceCR(dm.ahkQueryText.asString)); dm.ahkQuery.next; end; slFile.saveToFile(FileToCreate); with Hauptform.Launcher do begin Filename := FileToCreate; StartDir := AHKFilesDir; Execute; end; finally slFile.Free; end; end; function ReplaceCR(FText: string): string; begin result := StringReplace(FText, #13#10, '{ENTER}', [rfReplaceAll, rfIgnoreCase]); end; When using a Dialog to enter the template's text you should replace all tabs by tokens while typing like this: procedure TDlgAHKForm.edTextKeyPress(Sender: TObject; var Key: Char); var CPos, LPos: integer; s: string; begin { Tab-Taste durch (TAB) ersetzen } if Key = #9 then begin Key := #0; dm.ahkSource.DataSet.Edit; LPos := SendMessage(edText.Handle, EM_LINEFROMCHAR, edText.SelStart, 0); s := edText.Lines[LPos]; CPos := SendMessage(edText.Handle, EM_LINEINDEX, LPos, 0); CPos := edText.SelStart - CPos; Insert('{TAB}', s, CPos + 1); edText.Lines[LPos] := s; end; end; The attached screenshot shows the memo-field where you can enter your text. CR/LF are converted to {ENTER}, tabs are converted to {TAB} in the script, so you can just write the text like you would do in a real application. If you need more informations, just tell me. Regards Uli Attachments: Clip1.png |
Thu, Oct 24 2013 5:05 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Adam,
<< Quite often, it would be nice to have a way of dropping these types of statements into scripts quickly. >> Good idea, added. Thanks, Tim Young Elevate Software www.elevatesoft.com |
« Previous Page | Page 2 of 2 | |
Jump to Page: 1 2 |
This web page was last updated on Wednesday, April 24, 2024 at 11:07 AM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |