Hack Forums
NotePad Calculator [Source] - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Coders Lounge (https://hackforums.net/forumdisplay.php?fid=5)
+---- Thread: NotePad Calculator [Source] (/showthread.php?tid=4118667)



NotePad Calculator [Source] - Vexane - Mar 16, 2014

I made this in hopes that this section will become more active.
Code
#include <String.au3>
while 1
    HotKeySet("{enter}", "addClip")
WEnd

Func addClip()
    WinActivate("Untitled - Notepad")
    If @error Then
        MsgBox(0, "Not Found", "Please open a valid blank Notepad document.")
    EndIf
    Send("^a")
    Send("^c")
    Global $Clip = ClipGet()
    Global $numbers = _StringExplode($Clip, "+")
    MsgBox(0, "Addition", $numbers[0] + $numbers[1])
    Exit
EndFunc

Instructions:
  1. Open a new Notepad Document

  2. Type in any number, then a plus sign, followed by another number

  3. Press Enter



I know it's kinda buggy (if you press Enter to close the message box it opens another one) but it's pretty awesome in my opinion!


* - Viloresi - Mar 21, 2014

This is a great idea... btw you can do only additions with this script... aniway i didnt try it but im sure this code its incorrect (there is an EndIf without sense)