Announcement

Collapse
No announcement yet.

Battery percentage refresh DLL

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Rolando2018
    replied
    Originally posted by BioHazard View Post
    Oops - page not refreshing like intended.
    LOL, forgot to move DLL call command onto timer & query event.
    FIXED & reupped! Nagdamit!

    PS.
    See, this is why we need a forum EDIT button!
    LOL, hint, hint, IR.

    Está genial, Gracias.

    Leave a comment:


  • Imagine Programming
    replied
    Originally posted by BioHazard View Post
    What?
    When?
    How?
    Why
    What if?
    How come?
    Can it...?
    Does this mean...?
    But WHY?
    Are you sure?
    I don't get, please explain?
    I'm confused, can u go over that again?

    Okay, I think I get it now. But:... why, what, when, how ...

    LOL, cuppla dayzz, IP!!!
    A plugin that gives you ultimate power
    now
    By using the plugin
    Because why not?
    Don't worry, MemoryEx will save you
    Don't question it
    Yes
    Yes
    Because the gods want it so
    Absolutely sure
    I'm not sure if I can explain why I made it, I just did
    Sure, read this list again haha

    All kidding aside though, it might seem complex, but the plugin is basically only serving as an interface between Lua and Windows and Memory. I'll try to keep posting on the forum and see if I can solve user questions using MemoryEx, hopefully like that people will understand what it does.

    This is not a shameless plug to my plugin btw, I just like solving problems with MemoryEx haha

    Leave a comment:


  • BioHazard
    replied
    Originally posted by Imagine Programming View Post

    You can always ask me any question related to MemoryEx!

    ​​​
    What?
    When?
    How?
    Why
    What if?
    How come?
    Can it...?
    Does this mean...?
    But WHY?
    Are you sure?
    I don't get, please explain?
    I'm confused, can u go over that again?

    Okay, I think I get it now. But:... why, what, when, how ...

    LOL, cuppla dayzz, IP!!!

    Leave a comment:


  • Imagine Programming
    replied
    Originally posted by BioHazard View Post
    That MemoryEx plugin is pure EVIL, sensei. One of these days I'll learn its mysteries!

    LOL, BatteryProjectOverkill
    You can always ask me any question related to MemoryEx!

    ​​​

    Leave a comment:


  • kingzooly
    replied
    Originally posted by BioHazard View Post
    That MemoryEx plugin is pure EVIL, sensei. One of these days I'll learn its mysteries!

    LOL, BatteryProjectOverkill
    It's a epic plugin for sure

    Leave a comment:


  • BioHazard
    replied
    Originally posted by Imagine Programming View Post
    This one uses only MemoryEx ... I had a little break, I'm sorry!
    That MemoryEx plugin is pure EVIL, sensei. One of these days I'll learn its mysteries!

    LOL, BatteryProjectOverkill

    Leave a comment:


  • MrBryza
    replied
    BioHazard
    I agree Your last example is fantastic.
    I added a background and changed the Inputs to Labels, because the Inputs didn't look right over the top of the background.
    Once again thank you for your time.

    Leave a comment:


  • Imagine Programming
    replied
    Here's another one, no warnings but a "time remaining" when the AC is not connected and a progress bar. This one uses only MemoryEx and ProgressEx as plugin, but not the DLL. I had a little break, I'm sorry!
    Attached Files

    Leave a comment:


  • BioHazard
    replied
    No problemo, man.

    There's also a slightly different way to go about displaying the Warning dialog. The attached example below has incorporated the following differences:
    • Warning dialog ONLY displays when device is using internal battery as the power source
    • Warning dialog appears when battery charge drops to 50%, 25%, 10%, 5% respectively (easy to change/add/omit)
    • Warning dialog appears only ONCE for each of the above-listed levels
    • Warning dialog displays remaining charge(%) dynamically not statically
    Personally, I think this latest version is the better way to go about it. Code has been tested BUT not thoroughly, yet. Should be working as described above. LOL, famous last words. .

    Let us know if it's buggy in any way. Or if you encounter any problem issues.
    Attached Files

    Leave a comment:


  • MrBryza
    replied
    BioHazard
    I did play around with a label but no luck.
    Your last exactly is what I want. Again thank you for your time.
    Really appreciated

    Leave a comment:


  • BioHazard
    replied
    LMAO! How's this for yet another Homer Simpson moment?

    After all that, I just realized that all you need to do is use the Numeric Constant method outlined above - with a DialogEx instead of a DialogMessage. And problem is solved. D'OH!



    So, just add a DialogEx to your apz. And paste the following code at the bottom of the main page's On Timer event:
    Code:
    if nConstant == nil then
        if nBattStatus == "10" then
            nConstant = DialogEx.Show("Dialog1", true, 200, 100);
        end
    end
    Example attached.
    Attached Files

    Leave a comment:


  • MrBryza
    replied
    BioHazard
    I used both methods and I see what you mean. I will have a play and try using a label for the message.
    Thank you for your time.

    Leave a comment:


  • BioHazard
    replied
    @MrBryza

    Okay, had a look at this. There's a couple of solutions that come to mind:
    • Use numeric constant of DialogMessage for permission to execute.
    • Add a 2nd Page Timer and place the DialogMessage within its purview.

    The problem however with using a DialogMessage for your 'warning' is that it's a child-window to which control is passed. Control does not go back to the parent-window (your main page) until the DialogMessage is closed. This means that with both of the above methods, the code which limits the DialogMessage to just one instance, will only execute once you manually close the DialogMessage. If you leave it open, this code won't execute and the DialogMessage will continue to appear every 30 secs.

    Here's the code for both of the above outlined methods. Try them both with a DialogMessage and you'll see what I mean:

    Numeric Constant method (This goes on the bottom of the Page On Timer event ONLY):
    Code:
    if nConstant == nil then
        if nBattStatus == "10" then
            nConstant = Dialog.Message("Warning", "Battery charge is at 10%", MB_OK, MB_ICONEXCLAMATION, MB_DEFBUTTON1);
        end
    end

    2nd Page Timer method:
    Replace the Page On Show code with this:
    Code:
    Page.StartTimer(5000, 10);
    Page.StartTimer(5000, 20);
    Replace Page On Timer code with this:
    Code:
    sDLLPath = "AutoPlay\\Docs\\battery.dll"
    nBattStatus = DLL.CallFunction(sDLLPath, "BattPercentEx", "", DLL_RETURN_TYPE_LONG, DLL_CALL_CDECL);
    nPowerSource = DLL.CallFunction(sDLLPath, "BattPowerEx", "", DLL_RETURN_TYPE_LONG, DLL_CALL_CDECL);
    
    if (e_ID == 10) then
        if (nPowerSource == "1") then
            sReturn = "External AC Power"
            Image.Load("icon", "AutoPlay\\Images\\icon_ac.png");
        else
            sReturn = "Internal Battery"
            Image.Load("icon", "AutoPlay\\Images\\icon_dc.png");
        end
    
        Progress.SetRange("progress_charged", 0, 100);
        Progress.SetCurrentPos("progress_charged", nBattStatus);
        Input.SetText("power_source", sReturn);
        Input.SetText("battery_charge", nBattStatus.."%");
    
    elseif (e_ID == 20) then
        if nBattStatus > "101" then
            Dialog.Message("Warning", "Battery charge is at 10%", MB_OK, MB_ICONEXCLAMATION, MB_DEFBUTTON1);
            Page.StopTimer(20);
        end
    end
    At the moment, I can't think of a way to circumvent this 'control issue' with the parent-child window paradigm when using a DialogMessage. So, my suggestion would be to EITHER:
    • Use a Label object for the warning, instead of a DialogMessage. (Or an Input object or a Paragraph object to do the same).
    • Use the 2nd Page Timer method as outlined above BUT replace the DialogMessage with a Dialog.TimedMessage. This will solve the parent-child window control issue and work no problemo.
    I'm sure there are other ways, too. But that's all I can think of at the moment.

    Leave a comment:


  • kingzooly
    replied
    This is the point where I say yes this can be done put pretty easy using Lua and AMS logic so this where I would say get you coffee or tea and read the manual as it's time you start doing that part yourself.

    Get in to the code deep
    Last edited by kingzooly; 07-05-2018, 01:35 AM. Reason: messed up words

    Leave a comment:


  • kingzooly
    replied
    I am doing diy things today but I dl your example and build it later and make sure it works on hdd and web exe options I can't remember if I ever found out why it bugged out in the future but like I said I 100% forgot I even commented let alone test it lol

    Leave a comment:

Working...
X
😀
🥰
🤢
😎
😡
👍
👎