Jump to content

Recommended Posts

Posted

I've been experimenting with creating a simple GUI calculator (with actual buttons and display), in the fewest possible lines of code.  So far, I'm at 38 lines (without white space).  Unfortunately the script does not have any error handling, nor does it recognize numeric keypresses from the keyboard, but it otherwise seems to work okay.  The code doesn't necessarily follow good programming practice, but I was just aiming for 'small'.  Just sharing in case somebody else might find it interesting, and maybe would like to add error handling or keyboard input, (of course, following my minimalist approach.  :-)  )  Any thoughts on keeping the functionality as-is, but making the script even smaller?

Opt("GUIOnEventMode", 1)
DIM $BA[] = ["7","8","9","+","C","4","5","6","-","SqRt","1","2","3","*",".","0","(",")","/","="]
Global $x = 8, $y = 50
GUICreate("Calc", 360, 330, 229, 118)
$D = GUICtrlCreateInput("", 8, 8, 344, 31, BitOR(0x00000080,2))
For $j = 0 to Ubound($BA) - 1 ;make the buttons
    btn($BA[$j])
Next
GUISetState(@SW_SHOW)
GUISetOnEvent(-3, "Bye")
While 1
    Sleep(25) ;Throttle
WEnd
Func btn($t) ;make button, associate event for each button press
    GUICtrlCreateButton($t, $x, $y, 65, 63)
    GUICtrlSetOnEvent(-1, "BP")
    GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif")
    $x += 70
    If $x > 350 Then ;move down and left for next row of buttons
        $x = 8
        $y += 70
    EndIf
EndFunc
Func BP() ;handle the button press
    $v = GuiCtrlRead(@GUI_CtrlId)
    If $v = "C" Then
        GuiCtrlSetData($D, "")
    ElseIf $v = "SqRt" Then ;Solve expression, then take sqrt.
        GuiCtrlSetData($D, Sqrt(Execute(GuiCtrlRead($D))))
    ElseIf $v = "=" Then ;solve the expression
        GuiCtrlSetData($D, Execute(GuiCtrlRead($D)))
    Else
        GuiCtrlSetData($D, GuiCtrlRead($D) & $v)
    EndIf
EndFunc
Func Bye()
    Exit
EndFunc

 

Posted

... nice "Code golf". (if you like such puzzles, here you can find some funny code golf puzzles)

P.S. just for fun...
code reduced to 23 lines (apologyes for the 'brutalization' of your code :))

Local $0 = Opt("GUIOnEventMode", 1), $BA[] = ["7", "8", "9", "+", "C", "4", "5", "6", "-", "SqRt", "1", "2", "3", "*", ".", "0", "(", ")", "/", "="]
Local $hGui = GUICreate("Calc", 360, 330, 229, 118), $D = GUICtrlCreateInput("", 8, 8, 344, 31, BitOR(0x00000080, 2)), $1 = GUISetOnEvent(-3, "Bye")
For $j = 0 to UBound($BA) - 1 ;make the buttons
    $2 = GUICtrlCreateButton($BA[$j], Mod($j, 5) * 70 + 7, Int($j / 5) * 70 + 50, 65, 63) + GUICtrlSetOnEvent(-1, "BP") + GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif")
Next
GUISetState(@SW_SHOW)
While Sleep(25) ;Throttle
WEnd
Func BP() ;handle the button press
    $v = GUICtrlRead(@GUI_CtrlId)
    If $v = "C" Then
        GUICtrlSetData($D, "")
    ElseIf $v = "SqRt" Then ;Solve expression, then take sqrt.
        GUICtrlSetData($D, Sqrt(Execute(GUICtrlRead($D))))
    ElseIf $v = "=" Then ;solve the expression
        GUICtrlSetData($D, Execute(GUICtrlRead($D)))
    Else
        GUICtrlSetData($D, GUICtrlRead($D) & $v)
    EndIf
EndFunc   ;==>BP
Func Bye()
    Exit
EndFunc   ;==>Bye

 

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Posted

12 lines:

Local $0 = Opt("GUIOnEventMode", 1), $BA[] = ["7", "8", "9", "+", "C", "4", "5", "6", "-", "SqRt", "1", "2", "3", "*", ".", "0", "(", ")", "/", "="], $hGui = GUICreate("Calc", 360, 330, 229, 118), $D = GUICtrlCreateInput("", 8, 8, 344, 31, BitOR(0x00000080, 2)), $1 = GUISetOnEvent(-3, "Bye") * GUISetState(@SW_SHOW)
For $j = 0 to UBound($BA) - 1 ;make the buttons
    $2 = GUICtrlCreateButton($BA[$j], Mod($j, 5) * 70 + 7, Int($j / 5) * 70 + 50, 65, 63) + GUICtrlSetOnEvent(-1, "BP") + GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif")
Next
While Sleep(100) ;Throttle
WEnd
Func BP() ;handle the button press
   $v = GUICtrlRead(@GUI_CtrlId) = "C" ? GUICtrlSetData($D, "") : GUICtrlRead(@GUI_CtrlId) = "SqRt" ? GUICtrlSetData($D, Sqrt(Execute(GUICtrlRead($D)))) : GUICtrlRead(@GUI_CtrlId)= "=" ? GUICtrlSetData($D, Execute(GUICtrlRead($D))) : GUICtrlSetData($D, GUICtrlRead($D) & GUICtrlRead(@GUI_CtrlId))
EndFunc   ;==>BP
Func Bye()
    Exit
EndFunc   ;==>Bye

 

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Posted

9 lines:

Local $0 = Opt("GUIOnEventMode", 1), $BA[] = ["7", "8", "9", "+", "C", "4", "5", "6", "-", "SqRt", "1", "2", "3", "*", ".", "0", "(", ")", "/", "="], $hGui = GUICreate("Calc", 360, 330, 229, 118), $D = GUICtrlCreateInput("", 8, 8, 344, 31, BitOR(0x00000080, 2)), $1 = GUISetOnEvent(-3, "BP") * GUISetState(@SW_SHOW)
For $j = 0 To UBound($BA) - 1 ;make the buttons
    $2 = GUICtrlCreateButton($BA[$j], Mod($j, 5) * 70 + 7, Int($j / 5) * 70 + 50, 65, 63) + GUICtrlSetOnEvent(-1, "BP") + GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif")
Next
While Sleep(100) ;Throttle
WEnd
Func BP() ;handle the button press
    If (GUICtrlRead(@GUI_CtrlId) = "C" ? GUICtrlSetData($D, "") : GUICtrlRead(@GUI_CtrlId) = "SqRt" ? GUICtrlSetData($D, Sqrt(Execute(GUICtrlRead($D)))) : GUICtrlRead(@GUI_CtrlId) = "=" ? GUICtrlSetData($D, Execute(GUICtrlRead($D))) : GUICtrlSetData($D, GUICtrlRead($D) & GUICtrlRead(@GUI_CtrlId))) And @GUI_CtrlId = -3 Then Exit
EndFunc   ;==>BP

 

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Posted (edited)

down to 5 lines and the feeling at least 1 more should be possible with the ? operator on the GUIGetMsg(1):sweating:

Local $j=0, $2=0, $amsg[]=[0,0,0,0,0], $BA[] = ["7", "8", "9", "+", "C", "4", "5", "6", "-", "SqRt", "1", "2", "3", "*", ".", "0", "(", ")", "/", "="], $hGui = GUICreate("Calc", 360, 330, 229, 118), $D = GUICtrlCreateInput("", 8, 8, 344, 31, BitOR(0x00000080, 2)), $1 = GUISetState(@SW_SHOW),$2 = GUICtrlCreateButton($BA[0],7,50,65, 63) + GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif"), $2 = GUICtrlCreateButton($BA[1],77,50,65, 63) + GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif"),$2 = GUICtrlCreateButton($BA[2],147,50,65, 63) + GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif"),$2 = GUICtrlCreateButton($BA[3],217,50,65, 63) + GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif"),$2 = GUICtrlCreateButton($BA[4],287,50,65, 63) + GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif"),$2 = GUICtrlCreateButton($BA[5],7,120,65, 63) + GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif"),$2 = GUICtrlCreateButton($BA[6],77,120,65, 63) + GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif"),$2 = GUICtrlCreateButton($BA[7],147,120,65, 63) + GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif"),$2 = GUICtrlCreateButton($BA[8],217,120,65, 63) + GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif"),$2 = GUICtrlCreateButton($BA[9],287,120,65, 63) + GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif"),$2 = GUICtrlCreateButton($BA[10],7,190,65, 63) + GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif"),$2 = GUICtrlCreateButton($BA[11],77,190,65, 63) + GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif"),$2 = GUICtrlCreateButton($BA[12],147,190,65, 63) + GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif"),$2 = GUICtrlCreateButton($BA[13],217,190,65, 63) + GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif"),$2 = GUICtrlCreateButton($BA[14],287,190,65, 63) + GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif"),$2 = GUICtrlCreateButton($BA[15],7,260,65, 63) + GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif"),$2 = GUICtrlCreateButton($BA[16],77,260,65, 63) + GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif"),$2 = GUICtrlCreateButton($BA[17],147,260,65, 63) + GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif"),$2 = GUICtrlCreateButton($BA[18],217,260,65, 63) + GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif"),$2 = GUICtrlCreateButton($BA[19],287,260,65, 63) + GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif")
Do
    $aMsg = GUIGetMsg(1) ;Get as array ; Should be possible with a ? somewhere
    if ($aMsg[2]=0 ? $2=0  : (GUICtrlRead($aMsg[0]) = "C" ? GUICtrlSetData($D, "") : GUICtrlRead($aMsg[0]) = "SqRt" ? GUICtrlSetData($D, Sqrt(Execute(GUICtrlRead($D)))) : GUICtrlRead($aMsg[0]) = "=" ? GUICtrlSetData($D, Execute(GUICtrlRead($D))) : GUICtrlSetData($D, GUICtrlRead($D) & GUICtrlRead($aMsg[0]))) and ($aMsg[0]=-3)) Then exit
Until $aMsg[0] = -3 ; $GUI_EVENT_CLOSE

 

Edited by junkew
Posted (edited)

Beated my own expectation down to 3 lines :D and shortened in bytes (using the $fcBtn makes it shorter could have made it $f offcourse but goal was not to obfuscate)

local $fcBtn=GUICtrlCreateButton, $j=0, $2=0, $amsg[]=[0,0,0,0,0], $BA[] = ["7", "8", "9", "+", "C", "4", "5", "6", "-", "SqRt", "1", "2", "3", "*", ".", "0", "(", ")", "/", "="], $hGui = GUICreate("Calc", 360, 330, 229, 118), $f=GUISetFont(18, 400, 0, "MS Sans Serif"), $D = GUICtrlCreateInput("", 8, 8, 344, 31, BitOR(0x00000080, 2)), $1 = GUISetState(@SW_SHOW),$2 = $fcBtn($BA[0],7,50,65, 63) , $2 = $fcBtn($BA[1],77,50,65, 63) ,$2 = $fcBtn($BA[2],147,50,65, 63) ,$2 = $fcBtn($BA[3],217,50,65, 63) ,$2 = $fcBtn($BA[4],287,50,65, 63) ,$2 = $fcBtn($BA[5],7,120,65, 63) ,$2 = $fcBtn($BA[6],77,120,65, 63) ,$2 = $fcBtn($BA[7],147,120,65, 63) ,$2 = $fcBtn($BA[8],217,120,65, 63) ,$2 = $fcBtn($BA[9],287,120,65, 63) ,$2 = $fcBtn($BA[10],7,190,65, 63) ,$2 = $fcBtn($BA[11],77,190,65, 63) ,$2 = $fcBtn($BA[12],147,190,65, 63) ,$2 = $fcBtn($BA[13],217,190,65, 63) ,$2 = $fcBtn($BA[14],287,190,65, 63) ,$2 = $fcBtn($BA[15],7,260,65, 63) ,$2 = $fcBtn($BA[16],77,260,65, 63) ,$2 = $fcBtn($BA[17],147,260,65, 63) ,$2 = $fcBtn($BA[18],217,260,65, 63) ,$2 = $fcBtn($BA[19],287,260,65, 63)
Do
Until  ((assign("aMsg",GUIGetMsg(1))=1) and ($aMsg[2]=0 ? $2=0  : (GUICtrlRead($aMsg[0]) = "C" ? GUICtrlSetData($D, "") : GUICtrlRead($aMsg[0]) = "SqRt" ? GUICtrlSetData($D, Sqrt(Execute(GUICtrlRead($D)))) : GUICtrlRead($aMsg[0]) = "=" ? GUICtrlSetData($D, Execute(GUICtrlRead($D))) : GUICtrlSetData($D, GUICtrlRead($D) & GUICtrlRead($aMsg[0])))  and ($aMsg[0]=-3))=true) or ($aMsg[0] = -3)  ; $GUI_EVENT_CLOSE

I think I am out of tricks but maybe an MVP knows how to get it into a one liner

Edited by junkew
Title can change now to under 4 instead of 40 lines ;-)
Posted (edited)

a 4 line version was also missing, here is one (... is few bytes less than the nice 3 lines version by @junkew)

Global $iMsg, $j, $BA[] = [7, 8, 9, '+', 'C', 4, 5, 6, "-", "SqRt", 1, 2, 3, '*', '.', 0, '(', ')', '/', '='], $hGui = GUICreate('Calc', 360, 330, 229, 118, 0x00C00000), $D = GUICtrlCreateInput('', 8, 8, 344, 31, BitOR(0x00000080, 2)), $1 = GUISetState(@SW_SHOW), $a = DllCallbackRegister('BP', 'none', 'hwnd;uint;uint_ptr;dword'), $b = DllCall('user32.dll', 'uint_ptr', 'SetTimer', 'hwnd', 0, 'uint_ptr', 0, 'uint', 10, 'ptr', DllCallbackGetPtr($a)), $exit = MsgBox(0, "Info", "hit 'esc' or click here to exit"), $TheEnd1 = DllCallbackFree($a), $TheEnd2 = DllCall('user32.dll', 'bool', 'KillTimer', 'hwnd', 0, 'uint_ptr', $b)
Func BP($hWnd, $iMsg2, $iTimerID, $iTime) ;handle the button press
    $j = (Assign('iMsg', GUIGetMsg(0))) * 0 ? 0 :($j < UBound($BA)) ?(GUICtrlCreateButton($BA[$j], Mod($j, 5) * 70 + 7, Int($j / 5) * 70 + 50, 65, 63) + GUICtrlSetFont(-1, 18, 400, 0, 'MS Sans Serif')) * 0 + $j + 1 : UBound($BA) + 0 * ($iMsg > 3 And $iMsg < 24 ?(GUICtrlRead($iMsg) = 'C' ? GUICtrlSetData($D, '') : GUICtrlRead($iMsg) = 'SqRt' ? GUICtrlSetData($D, Sqrt(Execute(GUICtrlRead($D)))) : GUICtrlRead($iMsg) = '=' ? GUICtrlSetData($D, Execute(GUICtrlRead($D))) :(StringInStr('0123456789()+-*/.', GUICtrlRead($iMsg))) > 0 ? GUICtrlSetData($D, GUICtrlRead($D) & GUICtrlRead($iMsg)) : 0) : 20)
EndFunc   ;==>BP

 

Edited by Chimp

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Posted (edited)

All under 5 lines is just causes a headache :frantics:

I miss challenges like these here.
Unfortunately, I do not even have time to deal with them :(

 

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted (edited)
Local $BA[] = ["Sin", "Tan", "Cos", "Exp", "Log", "7", "8", "9", "+", "C", "4", "5", "6", "-", "SqRt", "1", "2", "3", "*", ".", "0", "(", ")", "/", " = "]
$hGui = GUICreate("Calc", 360, 400, 229, 138, 0x10000000 + 0x20000000 + 0xC00000 + 0x80000) ;VISIBLE, MINIMIZEBOX, CAPTION, POPUP, SYSMENU
$D = GUICtrlCreateInput("", 8, 8, 344, 31, BitOR(0x00000080, 2)) ;$ES_AUTOHSCROLL, $ES_RIGHT
For $j = 0 To UBound($BA) - 1 ;make the buttons
    $BA[$j] = GUICtrlCreateButton($BA[$j], Mod($j, 5) * 70 + 7, Int($j / 5) * 70 + 50, 65, 63)
    $sB = GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif")
Next
While Execute(Assign("j", GUIGetMsg()) And $j <> -3)
    If $j > 0 And Assign("sB", GUICtrlRead($j)) And Call($sB, GUICtrlRead($D)) Then GUICtrlSetData($D, Call($sB, GUICtrlRead($D))) ;Sqrt; Tan; Cos..
    Execute($j - $D > 0xDEAD - @error And GUICtrlSetData($D, ($sB = "C" Or $sB = " = ") ? Execute(StringLeft($sB, 1) & GUICtrlRead($D)) : GUICtrlRead($D) & $sB))
WEnd

11 lines with a bit different method

Still 11 Lines but its a bit more concise back to dynamic 'C' and '=' buttons

and I showed how to add more named functions like Tan() Cos() Sin()

Edited by Bilgus
Adding Sin Tan Cos Exp Log
Posted (edited)
Improved from junkew 's code into two lines
 




Hi Funs
Improved from junkew 's code into 2 line 
if not FileExists(@TempDir&"\Cal.au3") then FileWrite(@TempDir&"\Cal.au3",'local $fcBtn=GUICtrlCreateButton, $j=0, $2=0, $amsg[]=[0,0,0,0,0], $BA[] = ["7", "8", "9", "+", "C", "4", "5", "6", "-", "SqRt", "1", "2", "3", "*", ".", "0", "(", ")", "/", "="], $hGui = GUICreate("Calc", 360, 330, 229, 118), $f=GUISetFont(18, 400, 0, "MS Sans Serif"), $D = GUICtrlCreateInput("", 8, 8, 344, 31, BitOR(0x00000080, 2)), $1 = GUISetState(@SW_SHOW),$2 = $fcBtn($BA[0],7,50,65, 63) , $2 = $fcBtn($BA[1],77,50,65, 63) ,$2 = $fcBtn($BA[2],147,50,65, 63) ,$2 = $fcBtn($BA[3],217,50,65, 63) ,$2 = $fcBtn($BA[4],287,50,65, 63) ,$2 = $fcBtn($BA[5],7,120,65, 63) ,$2 = $fcBtn($BA[6],77,120,65, 63) ,$2 = $fcBtn($BA[7],147,120,65, 63) ,$2 = $fcBtn($BA[8],217,120,65, 63) ,$2 = $fcBtn($BA[9],287,120,65, 63) ,$2 = $fcBtn($BA[10],7,190,65, 63) ,$2 = $fcBtn($BA[11],77,190,65, 63) ,$2 = $fcBtn($BA[12],147,190,65, 63) ,$2 = $fcBtn($BA[13],217,190,65, 63) ,$2 = $fcBtn($BA[14],287,190,65, 63) ,$2 = $fcBtn($BA[15],7,260,65, 63) ,$2 = $fcBtn($BA[16],77,260,65, 63) ,$2 = $fcBtn($BA[17],147,260,65, 63) ,$2 = $fcBtn($BA[18],217,260,65, 63) ,$2 = $fcBtn($BA[19],287,260,65, 63)' &@CRLF & 'do' &@CRLF & 'Until (((assign("aMsg",GUIGetMsg(1))=1) and ($aMsg[2]=0 ? $2=0  : (GUICtrlRead($aMsg[0]) = "C" ? GUICtrlSetData($D, "") : GUICtrlRead($aMsg[0]) = "SqRt" ? GUICtrlSetData($D, Sqrt(Execute(GUICtrlRead($D)))) : GUICtrlRead($aMsg[0]) = "=" ? GUICtrlSetData($D, Execute(GUICtrlRead($D))) : GUICtrlSetData($D, GUICtrlRead($D) & GUICtrlRead($aMsg[0])))  and ($aMsg[0]=-3))=true) or ($aMsg[0] = -3))')
ShellExecute(@TempDir&"\Cal.au3",@TempDir)

 

Edited by lpduy
Posted

This thread is bullshit cuz all we know that the most important thing is code clarity and easy bugs detecting.

-1 for this discussion.

Posted
  On 2/24/2018 at 10:44 AM, Ascer said:

Chủ đề này là bullshit cuz tất cả chúng ta biết rằng điều quan trọng nhất là mã rõ ràng và dễ dàng phát hiện lỗi.

-1 cho cuộc thảo luận này.

Expand  

But sometime we need small and smaller code to reduce file size!

If develop Autoit for mobile app that it's wolderfull

Posted (edited)

AutoIt for mobiles is waste time. Something like a start working now on company to create oil cars.

Edited by Ascer
Posted (edited)
  On 2/24/2018 at 10:26 AM, lpduy said:

Improved from junkew 's code into two lines

Expand  

if that "trick" is allowed  then just one line it's enough

Local $1 = FileWrite(FileOpen(@TempDir & "\Cal.au3", 2), "Global $iMsg, $j, $BA[] = [7, 8, 9, '+', 'C', 4, 5, 6, '-', 'SqRt', 1, 2, 3, '*', '.', 0, '(', ')', '/', '='], $hGui = GUICreate('Calc', 360, 330, 229, 118, 0x00C00000), $D = GUICtrlCreateInput('', 8, 8, 344, 31, BitOR(0x00000080, 2)), $1 = GUISetState(@SW_SHOW), $a = DllCallbackRegister('BP', 'none', 'hwnd;uint;uint_ptr;dword'), $b = DllCall('user32.dll', 'uint_ptr', 'SetTimer', 'hwnd', 0, 'uint_ptr', 0, 'uint', 10, 'ptr', DllCallbackGetPtr($a)), $exit = MsgBox(0, 'Info', 'click here to exit'), $TheEnd1 = DllCallbackFree($a), $TheEnd2 = DllCall('user32.dll', 'bool', 'KillTimer', 'hwnd', 0, 'uint_ptr', $b)" & @CRLF & "Func BP($hWnd, $iMsg2, $iTimerID, $iTime)" & @CRLF & "$j = (Assign('iMsg', GUIGetMsg(0))) * 0 ? 0 :($j < UBound($BA)) ?(GUICtrlCreateButton($BA[$j], Mod($j, 5) * 70 + 7, Int($j / 5) * 70 + 50, 65, 63) + GUICtrlSetFont(-1, 18, 400, 0, 'MS Sans Serif')) * 0 + $j + 1 : UBound($BA) + 0 * ($iMsg > 3 And $iMsg < 24 ?(GUICtrlRead($iMsg) = 'C' ? GUICtrlSetData($D, '') : GUICtrlRead($iMsg) = 'SqRt' ? GUICtrlSetData($D, Sqrt(Execute(GUICtrlRead($D)))) : GUICtrlRead($iMsg) = '=' ? GUICtrlSetData($D, Execute(GUICtrlRead($D))) :(StringInStr('0123456789()+-*/.', GUICtrlRead($iMsg))) > 0 ? GUICtrlSetData($D, GUICtrlRead($D) & GUICtrlRead($iMsg)) : 0) : 20)" & @CRLF & "EndFunc"), $2 = Run(@AutoItExe & " " & @TempDir & "\Cal.au3")

 

Edited by Chimp

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Posted
  On 2/24/2018 at 2:33 PM, Chimp said:

if that "trick" is allowed  then just one line it's enough

Expand  

Autoit's wonderfull!!! if replace func name by short varian and can use Au3stripper /rm so i think it can do this!

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...