Addict Discuss
Relocating adm, adu, adl
Thread Starter: henrik carlsen Started: 6/12/2008 12:09 PM UTC
Replies: 13
Relocating adm, adu, adl

I participated in another thread regarding the relocation of adu and adl files (together with WPtools)

From Raymond I got the following snippet:

    AddictSpell31.ConfigFilename := ESBAppDataFolder ESBAppUser '-spell.cfg';
    AddictSpell31.SuggestionsLearningDict := ESBAppDataFolder ESBAppUser '_sp.adl';
    AddictSpell31.SuggestionsLearning := True;
    AddictSpell31.ConfigDictionaryDir.Clear;
    AddictSpell31.ConfigDictionaryDir.Add (ESBAppDataFolder);
    AddictSpell31.ConfigDictionaryDir.Add ('%AppDir%');

which I transformed into this

    aCustDictPath := IncludeTrailingPathDelimiter(aCustDictPath);

    WPToolsAddictSpell1.ConfigFilename := aCustDictPath '%UserName%' '-spell.cfg';
    WPToolsAddictSpell1.Configuration.Loaded := true;

    WPToolsAddictSpell1.SuggestionsLearningDict := aCustDictPath '%UserName%' '_sp.adl';
    WPToolsAddictSpell1.SuggestionsLearning := True;

    WPToolsAddictSpell1.ConfigDictionaryDir.Clear;
    WPToolsAddictSpell1.ConfigDictionaryDir.Add(ExcludeTrailingPathDelimiter(aCustDictPath));
    WPToolsAddictSpell1.ConfigDictionaryDir.Add('%AppDir%');

    WPToolsAddictSpell1.Configuration.SaveConfiguration;

... which works as long I don't use the OnTheFly spell-function. It still look adm-files for and generate adu and adl-files in AppDir. The numerous path-settings have left me quite confused.

Moreover the task have evolved into relocating the adm too.

What I hope someone (Hi Raymond) can help me with is:

  1. How to change all the paths needed to have addict look for adm, adu and adl files in a shared directory
  2. Fix the OnTheFly-problem

Thanks in advance.

RE: Relocating adm, adu, adl
> From Raymond I got the following snippet: <<

I supplied the snippet you quoted not Raymond :)

> ... which works as long I don't use the OnTheFly spell-function. <<

Whilst you have added a couple of lines that I haven't found necessary in my Apps (the code I shared from you was what I use for local client Applications), this sounds like you have more than one Addict Component.

Are you, as I suggested, doing these settings in the OnCreatea of a DataModule that is created prior to the MainForm - when they are set is quite imported?


Glenn Crouch, Addict Support
mailto:support@addictivesoftware.com
Addictive Software http://www.addictivesoftware.com    





--
Glenn Crouch mailto:support@addictivesoftware.com
Addictive Software Support
http://www.addictivesoftware.com
Re: Relocating adm, adu, adl
Addict wrote:
>> From Raymond I got the following snippet: <<
I supplied the snippet you quoted not Raymond :)


Hey, I still lurk here.<vbg> but I never mind being given credit - even when I did not earn it...<lol>!

The only other thing I did was to store the base dictionaries along side of applications and then I wrote a small routine which dynamically searches the directories (first going up to a "main/base" directory) and then finding the /Dictionaries folder...

This way all my apps share the same dicts and makes it much easier for upgrades, etc. Also, in case the apps move (usually the base directory) my routine can still traverse and find the dicts...

Cheers,
-Raymond
Re: Relocating adm, adu, adl

Hi Glen. Sorry for the wrong reference. Honor goes to you.

 

Whilst you have added a couple of lines that I haven't found necessary in my Apps (the code I shared from you was what I use for local client Applications), this sounds like you have more than one Addict Component.

 

I merged what you supplied with what I’d created previously. Actually the only thing remaining is the SaveConfiguration call.

 

I copied the adm-file to the network-drive and if I do the manual spell check (WPToolsAddictSpell1.CheckWPTools (WPRichText1, ctSmart); the adu and adl files appear at the correct location and the Danish.adm is used.

 

If I activate the OnThFly (WPToolsAddictSpell1.UILanguage := ltDanish;) all words are redlined and the adl and adu are created alongside the executeable.

 

Are you, as I suggested, doing these settings in the OnCreatea of a DataModule that is created prior to the MainForm - when they are set is quite imported?

 

The initialization is placed in a constructor of a WordProcessor form, that being part of a larger program. The form is a buildup of WPTools components and one TWPToolsAddictSpell (There’s also a TWPToolsThesaurus and the adt-file there must also be relocateable. I guess that I only need to change the “Filename” property to do that). The form is quite old and origins from a WPTool example but is modified into a Gordian knot. If you loosen up one cord another end’s tightened...

Re: Relocating adm, adu, adl
I have moved the two components out into a datamodule and the OnTheFly feature finds the right Danish.adm. The adu and adl files are still created locally - but only OnTheFly, the manual check works.

Re: Relocating adm, adu, adl
Supplying all the information I risk spamming you. Here is the properties set:

    ConfigStorage = csRegistry
    ConfigID = '%UserName%'
    ConfigFilename = '%AppDir%\Spell.cfg'
    ConfigRegistryKey = 'Software\Addictive Software\%AppName%'
    ConfigDictionaryDir.Strings = (
      '%AppDir%')
    ConfigAvailableOptions = [soLiveSpelling, soLiveCorrect, soUpcase, soNumbers, soPrimaryOnly, soRepeated]
    ConfigUseMSWordCustom = True
    ConfigDefaultMain.Strings = (
      'Danish.adm')
    ConfigDefaultActiveCustom = '%ConfigID%.adu'
    ConfigDefaultOptions = [soLiveCorrect, soNumbers, soInternet, soAbbreviations, soRepeated]
    ConfigDefaultUseMSWordCustom = False
    SuggestionsAutoReplace = False
    SuggestionsLearning = True
    SuggestionsLearningDict = '%AppDir%\%UserName%_sp.adl'
    LiveSpelling = True
    LiveCorrect = True
    QuoteChars = '>'
    DialogInitialPos = ipLastUserPos
    DialogSelectionAvoid = saAvoid
    DialogShowImmediate = False
    DialogShowModal = False
    EndMessage = emExceptCancel
    EndCursorPosition = epOriginal
    EndMessageWordCount = False
    MaxUndo = -1
    MaxSuggestions = -1
    KeepDictionariesActive = True
    SynchronousCheck = True
    UseHourglassCursor = True
    CommandsVisible = [sdcIgnore, sdcIgnoreAll, sdcChange, sdcChangeAll, sdcAdd, sdcAutoCorrect, sdcUndo, sdcHelp, sdcCancel, sdcOptions, sdcCustomDictionary, sdcCustomDictionaries, sdcConfigOK, sdcAddedEdit, sdcAutoCorrectEdit, sdcExcludedEdit, sdcInternalEdit, sdcMainDictFolderBrowse, sdcResetDefaults]
    CommandsEnabled = [sdcIgnore, sdcIgnoreAll, sdcChange, sdcChangeAll, sdcAdd, sdcAutoCorrect, sdcUndo, sdcHelp, sdcCancel, sdcOptions, sdcCustomDictionary, sdcCustomDictionaries, sdcConfigOK, sdcAddedEdit, sdcAutoCorrectEdit, sdcExcludedEdit, sdcInternalEdit, sdcMainDictFolderBrowse, sdcResetDefaults]
    PhoneticSuggestions = True
    PhoneticMaxDistance = 4
    PhoneticDivisor = 2
    PhoneticDepth = 2
    MappingAutoReplace = True
    UseExcludeWords = True
    UseAutoCorrectFirst = False
    RecheckReplacedWords = True
    ResumeFromLastPosition = True
    AllowedCases = cmInitialCapsOrUpcase
    UILanguage = ltDanish
    UIType = suiDialog
    UILanguageFontControls.Charset = DEFAULT_CHARSET
    UILanguageFontControls.Color = clWindowText
    UILanguageFontControls.Height = -11
    UILanguageFontControls.Name = 'MS Sans Serif'
    UILanguageFontControls.Style = []
    UILanguageFontText.Charset = DEFAULT_CHARSET
    UILanguageFontText.Color = clWindowText
    UILanguageFontText.Height = -11
    UILanguageFontText.Name = 'MS Sans Serif'
    UILanguageFontText.Style = []
    UILanguageUseFonts = False
    LiveMenuOptions = [spDialog, spAutoCorrect, spAdd, spIgnoreAll, spIgnore, spReplace]
    LiveSpellingOptions = True

RE: Relocating adm, adu, adl
Henrik,

Would it help if I took the WPTools 5 (you are using WPTools 5 aren't you?) Demo and changed it so that it saved all the created files and Custom Dictionary in the user's AppData Directory?


Glenn Crouch, Addict Support
mailto:support@addictivesoftware.com
Addictive Software http://www.addictivesoftware.com    





--
Glenn Crouch mailto:support@addictivesoftware.com
Addictive Software Support
http://www.addictivesoftware.com
Re: RE: Relocating adm, adu, adl
Dunno about anyone else but it would be useful to me.

Roy Lambert
RE: RE: Relocating adm, adu, adl
Okay - so do we need this for WPTools 4 or WPTools 5 - I can get one of the
demos updated this week - let me know your preference :)


Glenn Crouch, Addict Support
mailto:support@addictivesoftware.com
Addictive Software http://www.addictivesoftware.com    





--
Glenn Crouch mailto:support@addictivesoftware.com
Addictive Software Support
http://www.addictivesoftware.com
Re: RE: RE: Relocating adm, adu, adl
Addict


I have both, but 5 would be my preference.

Roy Lambert
RE: RE: RE: Relocating adm, adu, adl
Okay - here is a modified Addict / WPTools 5 Demo that does the following:

- uses a Data Module

And in the OnCreate of the Data Module

- changes the name of the config file and saves it in a folder in the
AppData Folder

- changes the name of the Default Custom Dictionary and ensures that it goes
into the AppData Folder

- changes the name and stores the Learning Info in the AppData Folder.

http://www.addictivesoftware.com/bin/demos/a3wp5dmdirdemo.zip

If you compare with the original demo, you can see that very few changes
were actually made :)

BTW the exe was built using Delphi 7.

Hth


Glenn Crouch, Addict Support
mailto:support@addictivesoftware.com
Addictive Software http://www.addictivesoftware.com    





--
Glenn Crouch mailto:support@addictivesoftware.com
Addictive Software Support
http://www.addictivesoftware.com
Re: RE: RE: RE: Relocating adm, adu, adl
Thanks, downloaded and I'll try it out later

Roy Lambert
RE: Relocating adm, adu, adl and adt

Thanks Glenn. Sorry for the slow answer. A long Weekend hit me (with family and all; glad to be back at work where I can relax :-))

Not much change to do:

  ForceDirectories(aCustDictPath);
  WPToolsAddictSpell.ConfigFilename := aCustDictPath + '%UserName%-spell.cfg';
  WPToolsAddictSpell.ConfigDefaultActiveCustom := '%UserName%.adu';
  WPToolsAddictSpell.SuggestionsLearningDict := aCustDictPath + '%UserName%_sp.adl';
  WPToolsAddictSpell.SuggestionsLearning := true;
  WPToolsAddictSpell.ConfigDictionaryDir.Clear;
  WPToolsAddictSpell.ConfigDictionaryDir.Add(aCustDictPath); // For Custom Dictionaries
  WPToolsAddictSpell.ConfigDictionaryDir.Add(aCustDictPath); // For Main Dictionaries
  WPToolsThesaurus.Filename := aCustDictPath + 'Roget.adt';

It seems to work OK. After cleaning %appdir% for adm, adl, adu, adt I found new adl-file in %appdir%. After deleting it (again) it hasn't popped up again.


One thing that gave me a hard time figuring out was that the SpellAsYouGo wasn't enabled when I pressed the button ... that probably had something to do with my troubles
How do I interpret the comments for the two lines in ConfigDictionaryDir? Will it look for custom dicts in ConfigDictionaryDir[0] and main ones in ConfigDictionaryDir[1]?

Many thanks for your help.

P.S. I might find it somewhere in this forum but the Danish.adm has the same irritating glitch as MSOffice once had. The compound words are dealt with incorrectly. In Danish words that can be added together, are. For example the "cykelstativsforstander" (bicycle stand administrator) is corrected to "cykel stativ forstander" which is dead wrong. Is there any way to change that? - apart from adding to local dictionary.
The English language in general and the faulty MSOffice speller are largely to blame and I fear we’ll soon have to accept the English style (I'd really hate that but progress can't be stopped).

RE: Relocating adm, adu, adl and adt
> How do I interpret the comments for the two lines in ConfigDictionaryDir? Will it look for custom dicts in ConfigDictionaryDir[0] and main ones in ConfigDictionaryDir[1]? <<

The Default Custom Dictionary if not found will be created in [0], Main Dictionaries and Custom Dictionaries that are located in all the paths stored in the string list will be found :)

> P.S. I might find it somewhere in this forum but the Danish.adm has the same irritating glitch as MSOffice once had. The compound words are dealt with incorrectly. In Danish words that can be added together, are. For example the "cykelstativsforstander" (bicycle stand administrator) is corrected to "cykel stativ forstander" which is dead wrong. Is there any way to change that? - apart from adding to local dictionary.
The English language in general and the faulty MSOffice speller are largely to blame and I fear we’ll soon have to accept the English style (I'd really hate that but progress can't be stopped). <<

This is a "problem" often raised by Europeans - sadly Addict is a word based spell checker - thus all the compound words (and yes this does apply to English as well) must be in the dictionary. We have had some of our European Language Dictionaries expanded this way by other customers.

You can, if you desire, turn off split word suggestions (which is what quite a few prefer to do) by doing something akin to:

If you want to change how splitword suggestions are handled then you need to do something akin to:

Addict.SuggestionsGenerator.DefaultSuggestionTypes :=
Addict.SuggestionsGenerator.DefaultSuggestionTypes - [stSplitWord];


Glenn Crouch, mailto:glenn@esbconsult.com
ESB Consultancy, http://www.esbconsult.com
Home of ESBPCS, ESB Calculators, ESBStats and ESBPDF Analysis
Kalgoorlie-Boulder, Western Australia  




--
Glenn Crouch mailto:support@addictivesoftware.com
Addictive Software Support
http://www.addictivesoftware.com