You are here

PalCustomCodes & other usefull stuff

12 posts / 0 new
Last post
Mark Sikkema
Offline
Last seen: 13 years 3 months ago
Developer
Joined: 2009-07-20 14:55
PalCustomCodes & other usefull stuff
I started this, to see if it's help full to have a topic specially dedicated to 'PortableApps.comLauncherCustom.nsh' codes, unicode plug-ins and other useful scripts. Hopefully this could help us not re-inventing the wheel every time custom code is needed, or having to search all over the web for a unicode plug-in. If you're willing to contribute some code, I think it would be good practice to code it in a way it's useful for several PA's and to have the custom code make use of the launcher.ini settings. Eventually, if some custom codes are needed more often, they could make their way into the PAL releases after being proven here!
    PortableApps.comLauncherCustom.nsh codes:
    PalXmlCustomCode, a package dedicated to have PAL handle Xml files
    TextFuncUtf16CustomCode('nsisconf.nsh fix' is needed), all macros have been updated to deal with Utf-16 settings files, plus some additional macros for re-encoding files
    
    Useful scripts:
    CallAnsiPlugin.nsh, potentially better then the CallAnsiPlugin.dll
    nsisconf.nsh fix for Nsis Portable Unicode (PluginInstaller)
    
    List of additional useful unicode Nsis plug-ins: (beta means: I recompiled and tested them)
    NSISunz.dll(beta)Original source, NsisUnzU can't handle foreign characters within the extraction/ZIP-file path !
    EnumINI.dll(beta), Original source is included
    Time.dll(beta), I done this one really fast one day, so it's not fully tested
    EmbeddedLists.dll
    inetc.dll
    UAC.dll
    CallAnsiPlugin.dll
    Unicode.dll, for re-encoding files
    Md5dll
    
    @ JohnT.Haller: PortableApps.comUpdater2.0Beta5SourceProgressBarFix.zip
    Mark Sikkema
    Offline
    Last seen: 13 years 3 months ago
    Developer
    Joined: 2009-07-20 14:55
    First contribution.

    A custom code to handle Xml settings files.

    - "MSXML.DLL" independent
    - Utf-8 & Utf-16(LE) xml files support
    - Use of Xpaths, to navigate through the Xml file (not sure if it is 1.0 or 2.0)
    - Write/read attributes & text anywhere needed

    Note that this is making use of an ansi plug-in (but called in a way it's usable for unicode Nsis), there wasn't any good alternative. Re-writing the plug-in also isn't an option as xml-parsers are quite big and complicated.
    Anyway, I do not think this is a real issue as all what is missing is support non-ansi file paths. As it is now, a lot of apps won't run with these file paths, anyway !

    Example launcher.ini's for Screamer Portable & FreeCol Portable are included, see PortableApps.comLauncherCustom.nsh !

    Formerly Gringoloco
    Windows XP Pro sp3 x32

    thesupremecommander
    Offline
    Last seen: 12 years 1 month ago
    Joined: 2010-07-03 14:58
    Thanks!

    Thanks! This will be useful to add support for languages by country back into FreeCol, at least until the problem is resolved elsewhere.

    A good bit of Java apps will need this to work with language switching.

    My Dev Tests: ~ KeePass Pro Portable (awaiting .NET directory) ~ FreeCol Portable (needs testers)

    "... proving to everyone that we are operating on Valve Time..." - us Blum

    Mark Sikkema
    Offline
    Last seen: 13 years 3 months ago
    Developer
    Joined: 2009-07-20 14:55
    I'm happy you're happy (with it) :-)

    Let me know if experience any difficulties with it.

    Regards.

    Formerly Gringoloco
    Windows XP Pro sp3 x32

    thesupremecommander
    Offline
    Last seen: 12 years 1 month ago
    Joined: 2010-07-03 14:58
    OK, Some Questions

    I have two questions:

    1. Didn't you find a plugin ready for Unicode NSIS in the other thread? That way you wouldn't have to rewrite this one.
    2. So, all I have to do is add the FileWrite and LanguageFile sections to launcher.ini. Where should I put the files (besides the PA.com files)?

    My Dev Tests: ~ KeePass Pro Portable (awaiting .NET directory) ~ FreeCol Portable (needs testers)

    "... proving to everyone that we are operating on Valve Time..." - us Blum

    Mark Sikkema
    Offline
    Last seen: 13 years 3 months ago
    Developer
    Joined: 2009-07-20 14:55
    1. The plug-in I found for

    1. The plug-in I found for Unicode NSIS was MSXML.dll depended, depending on which MSXML.dll version is installed on the OS. I thought that could be a potentially buggy solution, especially concerning Wine OS. But maybe somebody can tell me otherwise.

    2.1 Yes, the [FileWrite] & [LanguageFile] sections !
    2.2 Locate the files as they are located in the Zip package

    X:\PortableApps\FreeColPortable\Other\Source\PortableApps.comLauncherDebug.nsh
    X:\PortableApps\FreeColPortable\Other\Source\PortableApps.comLauncherCustom.nsh
    X:\PortableApps\FreeColPortable\Other\Source\Include\Xml.nsh
    X:\PortableApps\FreeColPortable\Other\Source\Include\MyXml.nsh
    X:\PortableApps\FreeColPortable\Other\Source\Include\CallAnsiPlugin.nsh
    X:\PortableApps\FreeColPortable\Other\Source\Plugins\xml.dll
    X:\PortableApps\FreeColPortable\Other\Source\Plugins\Readme.html
    

    Note: After you got it all working, you can do away with the PortableApps.comLauncherDebug.nsh

    Formerly Gringoloco
    Windows XP Pro sp3 x32

    thesupremecommander
    Offline
    Last seen: 12 years 1 month ago
    Joined: 2010-07-03 14:58
    OK, Thanks

    Thanks, I'll be sure to add credits in the included launcher source as well as any other place you'd like them.

    I'll release today, as soon as I get my portable hard drive back up and running.

    As for the other one, better not to deal with a DLL. Of course, if anyone wants to say otherwise, feel free to.

    My Dev Tests: ~ KeePass Pro Portable (awaiting .NET directory) ~ FreeCol Portable (needs testers)

    "... proving to everyone that we are operating on Valve Time..." - us Blum

    thesupremecommander
    Offline
    Last seen: 12 years 1 month ago
    Joined: 2010-07-03 14:58
    Working Perfectly

    FreeCol Dev Test 5 is working perfectly with your code. Thanks!

    My Dev Tests: ~ KeePass Pro Portable (awaiting .NET directory) ~ FreeCol Portable (needs testers)

    "... proving to everyone that we are operating on Valve Time..." - us Blum

    thesupremecommander
    Offline
    Last seen: 12 years 1 month ago
    Joined: 2010-07-03 14:58
    Used It Again

    I used it again, this time in KeePass 2 Portable, and it works! Thanks again.

    My Dev Tests: ~ KeePass Pro Portable (awaiting .NET directory) ~ FreeCol Portable (needs testers)

    "... proving to everyone that we are operating on Valve Time..." - us Blum

    Mark Sikkema
    Offline
    Last seen: 13 years 3 months ago
    Developer
    Joined: 2009-07-20 14:55
    @ JohnT.Haller

    Progress bar fixed for PAU, see the main topic on the bottom.

    I (tried) to keep it as simple as possible, but came across another two(three) bugs.
    1. Bug of the RealProcess plug-in itself, popping to many of the stack, so nothing to do with the PAU script, but really got me busy for a while Sad
    2. When updating more then 49 apps at once, $intProgressIncrements becomes zero !

    IntOp $intProgressIncrements 49 / $intAppsToProcess
    ;IntOp 49 / 50 (apps) = 0
    

    So I decided the best way to deal with this is to include RealProgress macros which can deal with promilles instead of procents, just for the values of-course. As well, I find that dividing by 50 (500promille) is working out a tad better
    3. Possible bug in PAI, when lets say FirefoxPortable is running, PAI will ask the user to close it, but even if the user closes FFP and clicks ok, the app will not install. FYI, this happens in PAU & installing regularly.

    BTW, I'm still not happy with the behavior of the progress bar, when updating a small amount of apps. Updating 1 app is the worst, it increases 1% by each 10secs. and then jumps 45+%. But I left it that way (for now), like discussed in IRC.

    Formerly Gringoloco
    Windows XP Pro sp3 x32

    Mark Sikkema
    Offline
    Last seen: 13 years 3 months ago
    Developer
    Joined: 2009-07-20 14:55
    PalXmlCustomCode has been updated.

    Some bug fixes, and some changes in the naming so it's all in line with PAL 2.1

    XmlAttrib = XML attribute
    XmlText = XML text
    Attrib = Attribute

    Example:

    [FileWrite1]
    Type=XML attribute
    File=%PAL:DataDir%\freecol\freecol\options.xml
    XPath=/clientOptions/languageOption[@id="model.option.languageOption"]
    Attribute=value
    Value=%PAL:LanguageCustom%
    

    Formerly Gringoloco
    Windows XP Pro sp3 x32

    thesupremecommander
    Offline
    Last seen: 12 years 1 month ago
    Joined: 2010-07-03 14:58
    No Custom Code in 2.1

    So does that mean there will be no need for custom code in 2.1, or is it just some spec that needs to be adhered to?

    EDIT: So it will be in 2.1. Thanks, and sorry (I'm not used to using IRC).

    My Dev Tests: ~ KeePass Pro Portable (awaiting .NET directory) ~ FreeCol Portable (needs testers)

    "... proving to everyone that we are operating on Valve Time..." - us Blum

    Log in or register to post comments