Will someone write me a simple GUI?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
AlienRobotGhost
Posts: 50
Joined: 04 Nov 2016, 07:15

Will someone write me a simple GUI?

21 Feb 2017, 04:35

I would like a maximized gui window (any color), and have a single random bold number between 0 and 9 appear in the middle of the screen, and every 10 seconds that number changes to another random bold number between 0 and 9, continuing indefinitely or until the program is paused or stopped..........I am using this as a learning tool to try and improve upon my absolutely worthless code skills, so please try to make the code super clean and include as many labels as possible!
wolf_II
Posts: 2688
Joined: 08 Feb 2015, 20:55

Re: Will someone write me a simple GUI?

21 Feb 2017, 06:59

Try this:

Code: Select all

Gui, Font, s72 bold
Gui, Add, Text, % "x" A_ScreenWidth/2 " y" A_ScreenHeight/2, 0
Gui, Show, Maximize
SetTimer, Timer, 10000
Return

Timer:
Random, n,, 9
GuiControl,, Static1, %n%
Return

GuiClose:
ExitApp
I hope that helps.
AlienRobotGhost
Posts: 50
Joined: 04 Nov 2016, 07:15

Re: Will someone write me a simple GUI?

21 Feb 2017, 18:18

Hell yeah it does..........You're awesome!

If I could use your skills again, is there any way to make it continuously scroll random numbers across the middle of the screen from right to left?

I have an overall goal in mind that seems extremely complicated to me, such that it would be difficult to explain all at once, so i'm trying to go about it step by step. Just to summarize quickly, it's a program to test the acknowledged figure for statistical impossibility, where supposedly something with odds of 1:10^-50 or less would never happen given all of the chances available from the first measure of planck time until the inevitable heat death of the universe.
wolf_II
Posts: 2688
Joined: 08 Feb 2015, 20:55

Re: Will someone write me a simple GUI?

21 Feb 2017, 18:53

Try this:

Code: Select all

Index := 0
String := "The universe will end in a Big Freeze. "
Len := StrLen(String)
PosY := (A_ScreenHeight - 110) / 2
PosX := (A_ScreenWidth - 1654) / 2

Gui, Font, s72 bold
Gui, Add, Text, x%PosX% y%PosY%, %String%
Gui, Show, Maximize
SetTimer, Timer
Return

Timer:
Index := Index > Len ? 1 : Index + 1
GuiControl,, Static1, % SubStr(String, Index) String
Return

GuiEscape:
GuiClose:
ExitApp
I hope that helps.
AlienRobotGhost
Posts: 50
Joined: 04 Nov 2016, 07:15

Re: Will someone write me a simple GUI?

22 Feb 2017, 18:42

Dude, you are freaking awesome! I wonder if there is a way to just make a line of random numbers scroll across the screen though.........
wolf_II
Posts: 2688
Joined: 08 Feb 2015, 20:55

Re: Will someone write me a simple GUI?

23 Feb 2017, 02:32

Try this:

Code: Select all

Y := (A_ScreenHeight - 110) / 2
W := A_ScreenWidth - 190

Gui, Font, s72 bold
Gui, Add, Text, y%Y% w%W% Right
Gui, Show, Maximize
SetTimer, Timer
Return

Timer:
Random, n,, 9
GuiControl,, Static1, % String .= n
Return

GuiEscape:
GuiClose:
ExitApp
I hope that helps.
AlienRobotGhost
Posts: 50
Joined: 04 Nov 2016, 07:15

Re: Will someone write me a simple GUI?

23 Feb 2017, 04:28

You better believe it helps! You have accomplished in a few hours what i've been trying to do for over a year! I reduced the font size to 24 and adjusted it so that it would only pick random numbers between 1 and 4. These numbers represent the 4 base nucleotides that make up the genetic code sequence found in the DNA molecule.

I'm not sure why you chose to help me, but I can't thank you enough.......Because of the fact that you're a fucking genius, and you can do things that I can only dream of being able to do, I'm going to keep the ball rolling if I can. Obviously you are welcome to tell me to go fuck myself at any point.

Could there be a 25 digit sequence of random numbers between 1 and 4 in the middle of the screen, right above the scrolling line. These numbers would get chosen when the program starts, but they would not change or move at all while the program is running. The scrolling line of numbers would pass under the fixed numbers.

Again, I don't blame you if you tell me to piss off, you have already helped me more than you can imagine and I am certainly thankful for that.
wolf_II
Posts: 2688
Joined: 08 Feb 2015, 20:55

Re: Will someone write me a simple GUI?

23 Feb 2017, 05:05

Try this:

Code: Select all

#NoEnv

; put 4 nucleotide in an array (Adenine, Cytosine, Guanine, Thymine)
; refer to them as Arr_Nucleotide[1]..Arr_Nucleotide[4]
Arr_Nucleotide := ["A", "C", "G", "T"]

; create a sequence of 25 random nucleotides
Loop, 25 {
    Random, n, 1, 4
    Seq25 .= Arr_Nucleotide[n]
}

Y := A_ScreenHeight / 2
W := A_ScreenWidth - 90

Gui, -Caption
Gui, Font, s24 bold
Gui, Add, Text, y%Y% w%W% Center, %Seq25%
Gui, Add, Text, w%W% Right vMarquee
Gui, Show, Maximize
SetTimer, Timer
Return

GuiEscape:
GuiClose:
ExitApp

Timer:
Random, n, 1, 4
GuiControl,, Marquee, % Marquee .= Arr_Nucleotide[n]
Return
I hope that helps.

Note: You can improve the looks of the left side of the moving string, to not have "half-cut-off characters",
by using a mono-spaced font and adjusting the variable W accordingly.
wolf_II
Posts: 2688
Joined: 08 Feb 2015, 20:55

Re: Will someone write me a simple GUI?

23 Feb 2017, 05:42

I added a mono-spaced font and adjusted the variable W accordingly.
I corrected the vertical alignment to see the stationary line just above the half-way mark, the moving line is just below.
This works on my monitor (1920 x 1080), with a different monitor size or a different font, misalignments and chopped off characters could still happen.
I removed the title bar of the window, and also added some colours.
The text moves now from left to right. The mouse cursor is hidden while the GUI is shown.
Last but not least, I avoid the construction of a never ending moving string.

Code: Select all

#NoEnv

    ; put 4 nucleotide in an array (Adenine, Cytosine, Guanine, Thymine)
    ; refer to them as Arr_Nucleotide[1]..Arr_Nucleotide[4]
    Arr_Nucleotide := ["A", "C", "G", "T"]

    ; create a sequence of 25 random nucleotides
    Loop, 25 {
        Random, n, 1, 4
        Seq25 .= Arr_Nucleotide[n]
    }

    Y := (A_ScreenHeight / 2) - 50
    W := A_ScreenWidth - 84

    Gui, -Caption
    Gui, Color, Black
    Gui, Font, s24 bold, Consolas
    Gui, Add, Text, y%Y% w%W% cYellow Center, %Seq25%
    Gui, Add, Text, wp cWhite vMarquee
    Gui, Show, Maximize

    ShowCursor(False)
    SetTimer, Timer

Return

GuiEscape:
GuiClose:
    ShowCursor(True)
ExitApp



;-------------------------------------------------------------------------------
Timer: ; move a random string of nucleotides across the screen
;-------------------------------------------------------------------------------
    Random, n, 1, 4
    Marquee := Arr_Nucleotide[n] SubStr(Marquee, 1, 100)
    GuiControl,, Marquee, %Marquee%

Return



;-------------------------------------------------------------------------------
ShowCursor(bShow := True) { ; show/hide the mouse cursor
;-------------------------------------------------------------------------------
    DllCall("ShowCursor", "Int", bShow)
}
AlienRobotGhost
Posts: 50
Joined: 04 Nov 2016, 07:15

Re: Will someone write me a simple GUI?

23 Feb 2017, 11:46

I attached an animated gif image of what my ultimate goal is, but there was an error when I tried to run that last code so I took a screen shot of the error message and attached it also. I see that you basically already understand what i'm trying to accomplish here. It's been postulated that abiogenesis could have produced a spontaneous code sequence that could jump start the system of protein synthesis and in turn achieve biopoiesis which would account for the first seed of life on this world. The odds of that happening are so incredible that it is mind boggling! The accepted figure for statistical impossibility being accurate would put this event into the realm of something that could not ever occur..........So I am testing that figure! The programs that I have made are so primitive it's embarrassing, but i'm too busy to invest enough time learning all this new code to anything better. I used to be a code monkey when I was much younger, but that was using Qbasic on my Commodore 64 a hundred years ago............
Attachments
anigif.gif
This is an animation of my goal
anigif.gif (173.34 KiB) Viewed 2657 times
error.png
This is the error message
error.png (36.37 KiB) Viewed 2657 times
wolf_II
Posts: 2688
Joined: 08 Feb 2015, 20:55

Re: Will someone write me a simple GUI?

23 Feb 2017, 12:34

That error is maybe generated by AHK version 1.0.48 (a. k. a. AHK Basic).
Try with a more recent version of AHK, namely version 1.1 (a. k. a. AHK_L).
Check out the Download - 1.1.24.05 button along the top of this page.
AlienRobotGhost
Posts: 50
Joined: 04 Nov 2016, 07:15

Re: Will someone write me a simple GUI?

24 Feb 2017, 20:40

That made it work perfect! Damn dude, is there anything you're NOT good at? I like the use of capital letters instead of numbers, and I definitely like it scrolling from left to right better than the other way. The part that I don't even know is possible is where it determines the number of matches at each position as it scrolls and displays the number of matches each time it moves and also keeps track of the highest number reached. Ultimately i'm wondering if at any point the numbers scrolling below would match the fixed numbers above......
AlienRobotGhost
Posts: 50
Joined: 04 Nov 2016, 07:15

Re: Will someone write me a simple GUI?

24 Feb 2017, 20:41

That made it work perfect! Damn dude, is there anything you're NOT good at? I like the use of capital letters instead of numbers, and I definitely like it scrolling from left to right better than the other way. The part that I don't even know is possible is where it determines the number of matches at each position as it scrolls and displays the number of matches each time it moves and also keeps track of the highest number reached. Ultimately i'm wondering if at any point the numbers scrolling below would match the fixed numbers above......
wolf_II
Posts: 2688
Joined: 08 Feb 2015, 20:55

Re: Will someone write me a simple GUI?

25 Feb 2017, 00:36

Here is an updated script:
  • colours are easy to configure
  • added rudimentary analysis of matches
  • script can be paused/unpaused by hitting space bar
  • script can run in the background by hitting escape key
  • removed ShowCursor() due to poor implementation

Code: Select all

#NoEnv

    ;--------------------------------------------
    ; configure the colors by name or by hex code
    ;--------------------------------------------
    cGui      := "Black"
    cStatic   := "Yellow"
    cMarquee  := "Gray"
    cAnalysis := "Aqua"


    ; put 4 nucleotide in an array (Adenine, Cytosine, Guanine, Thymine)
    ; refer to them as Arr_Nucleotide[1]..Arr_Nucleotide[4]
    Arr_Nucleotide := ["A", "C", "G", "T"]

    ; create a sequence of 25 random nucleotides
    Loop, 25 {
        Random, n, 1, 4
        Seq25 .= Arr_Nucleotide[n]
    }


    ; The following is my current guess:
    ;-----------------------------------
    ; mono spaced fonts have constant character width
    ; for font "Consolas" we have:  width(char) = (font size) * 3/4
    ; 1800 is the width of 100 characters with font size 24

    X := (A_ScreenWidth - 1800) / 2     ; center 100 chars on screen
    Y := (A_ScreenHeight / 2) - 50      ; Seq25 is 50 pixels up from the middle
    Z := 1800 * 3 / 8 + X               ; align vertically with Seq25

    ; create the GUI
    Menu, Tray, Icon, Shell32.dll, 44
    Gui, 1: New, -Caption +hWndhGui, DNA
    Gui, Color, %cGUI%
    Gui, Font, s24 bold, Consolas
    Gui, Add, Text, x%X% y%Y% w1800 c%cStatic% Center, %Seq25%
    Gui, Add, Text, wp c%cMarquee% vMarquee
    Gui, Font ; bold off
    Gui, Font, s12
    Gui, Add, Text, x%Z% y+80 c%cStatic%, Recent match:
    Gui, Add, Text, x+m w500 c%cAnalysis% vRecentMatch Section
    Gui, Add, Text, x%Z% c%cStatic%, Longest match:
    Gui, Add, Text, xs yp w500 c%cAnalysis% vMaxLength
    Gui, Add, Text, x%Z% c%cStatic%, # Iterations:
    Gui, Add, Text, xs yp w500 c%cAnalysis% vIterations, % Iterations := 0

    ; show
    Gui, Show, Maximize
    SetTimer, Timer

Return



;-------------------------------------------------------------------------------
#If, WinActive("ahk_id " hGui) ; HotKeys only for this script
;-------------------------------------------------------------------------------
    ; {Space} pressed: toggle the timer on/off
    Space:: SetTimer, Timer, % (bPause := !bPause) ? "Off" : "On"

#If ; off



;-------------------------------------------------------------------------------
GuiEscape: ; {Esc} pressed: keep script running in the backgroud
;-------------------------------------------------------------------------------
    Gui, Show, Minimize

Return



;-------------------------------------------------------------------------------
GuiClose: ; {Alt+F4} pressed, [X] clicked: close script
;-------------------------------------------------------------------------------
    ExitApp

Return



;-------------------------------------------------------------------------------
Timer: ; move a random string of nucleotides across the screen
;-------------------------------------------------------------------------------
    Random, n, 1, 4
    Marquee := Arr_Nucleotide[n] SubStr(Marquee, 1, 99)
    GuiControl,, Marquee, %Marquee%
    While, SubStr(Marquee, 1, A_Index) == SubStr(Seq25, 1, A_Index)
        RecentMatch := SubStr(Seq25, 1, MatchLength := A_Index)
    GuiControl,, RecentMatch, %RecentMatch% ; update GUI every time
    If (MatchLength > MaxLength) ; update GUI when there is a change
        GuiControl,, MaxLength, % MaxLength := MatchLength
    GuiControl,, Iterations, % prettify_Number(Iterations += 1)

Return



;-------------------------------------------------------------------------------
prettify_Number(n, s := ",") { ; insert thousand separators into a number
;-------------------------------------------------------------------------------
    ; credit for the RegEx goes to AHK forum user infogulch
    ; https://autohotkey.com/board/topic/50019-add-thousands-separator/
    ;---------------------------------------------------------------------------
    IfLess, n, 0, Return, "-" prettify_Number(SubStr(n, 2), s)
    Return, RegExReplace(n, "\G\d+?(?=(\d{3})+(?:\D|$))", "$0" s)
}
AlienRobotGhost
Posts: 50
Joined: 04 Nov 2016, 07:15

Re: Will someone write me a simple GUI?

25 Feb 2017, 12:26

; this is the saddest code you will ever see, but this is what I am capable of
testtotal = 1
highest = 0
allnumbers = 25
nomatch = 0
match = 0
firstrand = 1
secondrand = 4
listset = 0
listsetnum = 100
listsetfirst = 1
cpass = 1

start:


gosub, randomstart1
gosub, acceptlist
winwaitclose, mygui

;gosub, controlpanel

continue:

gosub, display5

gosub, display2

testtotal += 1

gosub, display6

if nomatch > 0
{
nomatch = 0
match = 0
goto, continue
}
gosub, record
msgbox, SUCCESS! ALL 25 NUMBERS MATCHED

exitapp

;--------------------------------------------------------------THIS SECTION CREATES THE FIXED SEQUENCE LIST, 25 RANDOM NUMBERS BETWEEN X1 AND X2

randomstart1:

random, rand1, %firstrand%, %secondrand%
random, rand2, %firstrand%, %secondrand%
random, rand3, %firstrand%, %secondrand%
random, rand4, %firstrand%, %secondrand%
random, rand5, %firstrand%, %secondrand%
random, rand6, %firstrand%, %secondrand%
random, rand7, %firstrand%, %secondrand%
random, rand8, %firstrand%, %secondrand%
random, rand9, %firstrand%, %secondrand%
random, rand10, %firstrand%, %secondrand%
random, rand11, %firstrand%, %secondrand%
random, rand12, %firstrand%, %secondrand%
random, rand13, %firstrand%, %secondrand%
random, rand14, %firstrand%, %secondrand%
random, rand15, %firstrand%, %secondrand%
random, rand16, %firstrand%, %secondrand%
random, rand17, %firstrand%, %secondrand%
random, rand18, %firstrand%, %secondrand%
random, rand19, %firstrand%, %secondrand%
random, rand20, %firstrand%, %secondrand%
random, rand21, %firstrand%, %secondrand%
random, rand22, %firstrand%, %secondrand%
random, rand23, %firstrand%, %secondrand%
random, rand24, %firstrand%, %secondrand%
random, rand25, %firstrand%, %secondrand%

gui 1:destroy
gui 1:font, bold arial black
gui 1:show, x100 y010 w150 h790, SEQUENCE
gui 1:color, CEECF5
gui 1:add, text, , %rand1%
gui 1:add, text, , %rand2%
gui 1:add, text, , %rand3%
gui 1:add, text, , %rand4%
gui 1:add, text, , %rand5%
gui 1:add, text, , %rand6%
gui 1:add, text, , %rand7%
gui 1:add, text, , %rand8%
gui 1:add, text, , %rand9%
gui 1:add, text, , %rand10%
gui 1:add, text, , %rand11%
gui 1:add, text, , %rand12%
gui 1:add, text, , %rand13%
gui 1:add, text, , %rand14%
gui 1:add, text, , %rand15%
gui 1:add, text, , %rand16%
gui 1:add, text, , %rand17%
gui 1:add, text, , %rand18%
gui 1:add, text, , %rand19%
gui 1:add, text, , %rand20%
gui 1:add, text, , %rand21%
gui 1:add, text, , %rand22%
gui 1:add, text, , %rand23%
gui 1:add, text, , %rand24%
gui 1:add, text, , %rand25%

return

;-------------------------------------------------------------------------------THIS SECTION STARTS THE SEQUENCE MATCH TEST LIST

display2:

gui 2:destroy
gui 2:font, bold arial black
gui 2:show, x300 y010 w150 h790, RESULT
gui 2:color, CEECF5

gosub, allgsblist

return

;--------------------------------------------------------------------THESE SECTIONS GENERATE AND COMPARE THE TWO SEQUENCES FOR THEIR RESPECTIVE LIST NUMBERS

randomresult1:

random, randa, %firstrand%, %secondrand%

if randa = %rand1%
{
gui 2:add, text, , %randa%
match += 1
return
}
gui 2:add, text, , %randa% MISMATCH
nomatch += 1
listset += 1
numtot0 += 1
gosub, display4

return

;---------------------------------------------------------------------------------------------------------------------------CONT.

randomresult2:

random, randb, %firstrand%, %secondrand%

if randb = %rand2%
{
gui 2:add, text, , %randb%
match += 1
return
}
gui 2:add, text, , %randb% MISMATCH
nomatch += 1
listset += 1
numtot1 += 1
gosub, display4

return

;---------------------------------------------------------------------------------------------------------------------------CONT.

randomresult3:

random, randc, %firstrand%, %secondrand%

if randc = %rand3%
{
gui 2:add, text, , %randc%
match += 1
return
}
gui 2:add, text, , %randc% MISMATCH
nomatch += 1
listset += 1
numtot2 += 1
gosub, display4

return

;---------------------------------------------------------------------------------------------------------------------------CONT.

randomresult4:

random, randd, %firstrand%, %secondrand%

if randd = %rand4%
{
gui 2:add, text, , %randd%
match += 1
return
}
gui 2:add, text, , %randd% MISMATCH
nomatch += 1
listset += 1
numtot3 += 1
gosub, display4

return

;---------------------------------------------------------------------------------------------------------------------------CONT.

randomresult5:

random, rande, %firstrand%, %secondrand%

if rande = %rand5%
{
gui 2:add, text, , %rande%
match += 1
return
}
gui 2:add, text, , %rande% MISMATCH
nomatch += 1
listset += 1
numtot4 += 1
gosub, display4

return

;---------------------------------------------------------------------------------------------------------------------------CONT.

randomresult6:

random, randf, %firstrand%, %secondrand%

if randf = %rand6%
{
gui 2:add, text, , %randf%
match += 1
return
}
gui 2:add, text, , %randf% MISMATCH
nomatch += 1
listset += 1
numtot5 += 1
gosub, display4

return

;---------------------------------------------------------------------------------------------------------------------------CONT.

randomresult7:

random, randg, %firstrand%, %secondrand%

if randg = %rand7%
{
gui 2:add, text, , %randg%
match += 1
return
}
gui 2:add, text, , %randg% MISMATCH
nomatch += 1
listset += 1
numtot6 += 1
gosub, display4

return

;---------------------------------------------------------------------------------------------------------------------------CONT.

randomresult8:

random, randh, %firstrand%, %secondrand%

if randh = %rand8%
{
gui 2:add, text, , %randh%
match += 1
return
}
gui 2:add, text, , %randh% MISMATCH
nomatch += 1
listset += 1
numtot7 += 1
gosub, display4

return

;---------------------------------------------------------------------------------------------------------------------------CONT.

randomresult9:

random, randi, %firstrand%, %secondrand%

if randi = %rand9%
{
gui 2:add, text, , %randi%
match += 1
return
}
gui 2:add, text, , %randi% MISMATCH
nomatch += 1
listset += 1
numtot8 += 1
gosub, display4

return

;---------------------------------------------------------------------------------------------------------------------------CONT.

randomresult10:

random, randj, %firstrand%, %secondrand%

if randj = %rand10%
{
gui 2:add, text, , %randj%
match += 1
return
}
gui 2:add, text, , %randj% MISMATCH
nomatch += 1
listset += 1
numtot9 += 1
gosub, display4

return

;---------------------------------------------------------------------------------------------------------------------------CONT.

randomresult11:

random, randk, %firstrand%, %secondrand%

if randk = %rand11%
{
gui 2:add, text, , %randk%
match += 1
return
}
gui 2:add, text, , %randk% MISMATCH
nomatch += 1
listset += 1
numtot10 += 1
gosub, display4

return

;---------------------------------------------------------------------------------------------------------------------------CONT.

randomresult12:

random, randl, %firstrand%, %secondrand%

if randl = %rand12%
{
gui 2:add, text, , %randl%
match += 1
return
}
gui 2:add, text, , %randl% MISMATCH
nomatch += 1
listset += 1
numtot11 += 1
gosub, display4

return

;---------------------------------------------------------------------------------------------------------------------------CONT.

randomresult13:

random, randm, %firstrand%, %secondrand%

if randm = %rand13%
{
gui 2:add, text, , %randm%
match += 1
return
}
gui 2:add, text, , %randm% MISMATCH
nomatch += 1
listset += 1
numtot12 += 1
gosub, display4

return

;---------------------------------------------------------------------------------------------------------------------------CONT.

randomresult14:

random, randn, %firstrand%, %secondrand%

if randn = %rand14%
{
gui 2:add, text, , %randn%
match += 1
return
}
gui 2:add, text, , %randn% MISMATCH
nomatch += 1
listset += 1
numtot13 += 1
gosub, display4

return

;---------------------------------------------------------------------------------------------------------------------------CONT.

randomresult15:

random, rando, %firstrand%, %secondrand%

if rando = %rand15%
{
gui 2:add, text, , %rando%
match += 1
return
}
gui 2:add, text, , %rando% MISMATCH
nomatch += 1
listset += 1
numtot14 += 1
gosub, display4

return

;---------------------------------------------------------------------------------------------------------------------------CONT.


randomresult16:

random, randp, %firstrand%, %secondrand%

if randp = %rand16%
{
gui 2:add, text, , %randp%
match += 1
return
}
gui 2:add, text, , %randp% MISMATCH
nomatch += 1
listset += 1
numtot15 += 1
gosub, display4

return

;---------------------------------------------------------------------------------------------------------------------------CONT.

randomresult17:

random, randq, %firstrand%, %secondrand%

if randq = %rand17%
{
gui 2:add, text, , %randq%
match += 1
return
}
gui 2:add, text, , %randq% MISMATCH
nomatch += 1
listset += 1
numtot16 += 1
gosub, display4

return

;---------------------------------------------------------------------------------------------------------------------------CONT.

randomresult18:

random, randr, %firstrand%, %secondrand%

if randr = %rand18%
{
gui 2:add, text, , %randr%
match += 1
return
}
gui 2:add, text, , %randr% MISMATCH
nomatch += 1
listset += 1
numtot17 += 1
gosub, display4

return

;---------------------------------------------------------------------------------------------------------------------------CONT.

randomresult19:

random, rands, %firstrand%, %secondrand%

if rands = %rand19%
{
gui 2:add, text, , %rands%
match += 1
return
}
gui 2:add, text, , %rands% MISMATCH
nomatch += 1
listset += 1
numtot18 += 1
gosub, display4

return

;---------------------------------------------------------------------------------------------------------------------------CONT.

randomresult20:

random, randt, %firstrand%, %secondrand%

if randt = %rand20%
{
gui 2:add, text, , %randt%
match += 1
return
}
gui 2:add, text, , %randt% MISMATCH
nomatch += 1
listset += 1
numtot19 += 1
gosub, display4

return

;---------------------------------------------------------------------------------------------------------------------------CONT.

randomresult21:

random, randu, %firstrand%, %secondrand%

if randu = %rand21%
{
gui 2:add, text, , %randu%
match += 1
return
}
gui 2:add, text, , %randu% MISMATCH
nomatch += 1
listset += 1
numtot20 += 1
gosub, display4

return

;---------------------------------------------------------------------------------------------------------------------------CONT.

randomresult22:

random, randv, %firstrand%, %secondrand%

if randv = %rand22%
{
gui 2:add, text, , %randv%
match += 1
return
}
gui 2:add, text, , %randv% MISMATCH
nomatch += 1
listset += 1
numtot21 += 1
gosub, display4

return

;---------------------------------------------------------------------------------------------------------------------------CONT.

randomresult23:

random, randw, %firstrand%, %secondrand%

if randw = %rand23%
{
gui 2:add, text, , %randw%
match += 1
return
}
gui 2:add, text, , %randw% MISMATCH
nomatch += 1
listset += 1
numtot22 += 1
gosub, display4

return

;---------------------------------------------------------------------------------------------------------------------------CONT.

randomresult24:

random, randx, %firstrand%, %secondrand%

if randx = %rand24%
{
gui 2:add, text, , %randx%
match += 1
return
}
gui 2:add, text, , %randx% MISMATCH
nomatch += 1
listset += 1
numtot23 += 1
gosub, display4

return

;--------------------------------------------------------------------------------------THIS IS THE LAST NUMBER IN THE SEQUENCE TO COMPARE

randomresult25:

random, randy, %firstrand%, %secondrand%

if randy = %rand25%
{
gui 2:add, text, , %randy%
match += 1
listset += 1
numtot25 += 1
return
}
gui 2:add, text, , %randy% MISMATCH
nomatch += 1
listset += 1
numtot24 += 1
gosub, display4

return

;-----------------------------------------------------------------------------THIS SECTION IS WHERE THE MATCH IS DETECTED

allgsblist:

gosub, randomresult1

if nomatch > 0
{
return
}

gosub, randomresult2

if nomatch > 0
{
return
}

gosub, randomresult3

if nomatch > 0
{
return
}

gosub, randomresult4

if nomatch > 0
{
return
}

gosub, randomresult5

if nomatch > 0
{
return
}

gosub, randomresult6

if nomatch > 0
{
return
}

gosub, randomresult7

if nomatch > 0
{
return
}

gosub, randomresult8

if nomatch > 0
{
return
}

gosub, randomresult9

if nomatch > 0
{
return
}

gosub, randomresult10

if nomatch > 0
{
return
}

gosub, randomresult11

if nomatch > 0
{
return
}

gosub, randomresult12

if nomatch > 0
{
return
}

gosub, randomresult13

if nomatch > 0
{
return
}

gosub, randomresult14

if nomatch > 0
{
return
}

gosub, randomresult15

if nomatch > 0
{
return
}

gosub, randomresult16

if nomatch > 0
{
return
}

gosub, randomresult17

if nomatch > 0
{
return
}

gosub, randomresult18

if nomatch > 0
{
return
}

gosub, randomresult19

if nomatch > 0
{
return
}

gosub, randomresult20

if nomatch > 0
{
return
}

gosub, randomresult21

if nomatch > 0
{
return
}

gosub, randomresult22

if nomatch > 0
{
return
}

gosub, randomresult23

if nomatch > 0
{
return
}

gosub, randomresult24

if nomatch > 0
{
return
}

gosub, randomresult25

if nomatch > 0
{
return
}

return

;---------------------------------------------------------------------------------THIS SECTION CREATES A GUI WINDOW THAT DISPLAYS THE HIGHEST NUMBER OF MATCHES IN A SINGLE TEST SEQUENCE

display4:

if match > %highest%
{
highest = %match%
goto skiphigh
}
return

skiphigh:

gui 4:destroy
gui 4:font, bold w240, arial black
gui 4:show, x500 y500 w200 h100, HIGHEST
gui 4:color, CEECF5
gui 4:add, text, , %highest%
gosub, display5
gosub, record
return

;---------------------------------------------------------------------THIS SECTION CREATES A GUI WINDOW THAT DISPLAYS THE TOTAL NUMBER OF TESTS SEQUENCES THAT HAVE BEEN PERFORMED

display5:

gui 5:destroy
gui 5:font, bold w240, arial black
gui 5:show, x500 y300 w400 h100, MAX COUNT
gui 5:color, CEECF5
gui 5:add, text, , %testtotal%

return

;---------------------------------------------------------THIS SECTION TAKES A SCREENSHOT WHEN A HIGHER SEQUENCE MATCH HAPPENS, THEN IT OPENS PAINT, PASTES THE SCREENSHOT, AND SAVES IT

record:

if highest <= 4
{
return
}

;goto, skipthis

gosub, listsetstart

sleep 200

send {printscreen}

sleep 200
mousemove, 1, 1
sleep 200
send {ctrl down}
send {esc}
send {ctrl up}
sleep 1000
send {up 8}
sleep 500
send {enter}

sleep 3000
;pause
send {ctrl down}
send {v}
send {ctrl up}

sleep 2000

send {alt down}
send {f4}
send {alt up}

sleep 1000

send {enter}

sleep 2000

send, %highest%
send {(}
send, %testtotal%
send {)}
send, %A_DD%-%A_MM%-%A_YYYY% %A_Hour%-%A_Min%

sleep 1000

send {enter}

sleep 2000

;skipthis:
;msgbox,0,,RECORD SKIPPED, 2
;SLEEP 2000

return







;------------------------------------------------------THIS SECTION CREATES A GUI WINDOW THAT DISPLAYS THE TOTAL AMOUNTS OF EACH NUMBER OF SEQUENCE MATCHES



display6:



if listsetfirst = 1
{
listsetfirst = 0
goto listsetstart
}




if listset = %listsetnum%
{
listset = 0
goto listsetstart
}
return



listsetstart:




gui 6:destroy
gui 6:font, bold arial black
gui 6:show, x1000 y010 w400 h790, TOTALS
gui 6:color, CEECF5
gui 6:add, text, , 0 MATCHES = %numtot0%
gui 6:add, text, , 1 MATCHES = %numtot1%
gui 6:add, text, , 2 MATCHES = %numtot2%
gui 6:add, text, , 3 MATCHES = %numtot3%
gui 6:add, text, , 4 MATCHES = %numtot4%
gui 6:add, text, , 5 MATCHES = %numtot5%
gui 6:add, text, , 6 MATCHES = %numtot6%
gui 6:add, text, , 7 MATCHES = %numtot7%
gui 6:add, text, , 8 MATCHES = %numtot8%
gui 6:add, text, , 9 MATCHES = %numtot9%
gui 6:add, text, , 10 MATCHES = %numtot10%
gui 6:add, text, , 11 MATCHES = %numtot11%
gui 6:add, text, , 12 MATCHES = %numtot12%
gui 6:add, text, , 13 MATCHES = %numtot13%
gui 6:add, text, , 14 MATCHES = %numtot14%
gui 6:add, text, , 15 MATCHES = %numtot15%
gui 6:add, text, , 16 MATCHES = %numtot16%
gui 6:add, text, , 17 MATCHES = %numtot17%
gui 6:add, text, , 18 MATCHES = %numtot18%
gui 6:add, text, , 19 MATCHES = %numtot19%
gui 6:add, text, , 20 MATCHES = %numtot20%
gui 6:add, text, , 21 MATCHES = %numtot21%
gui 6:add, text, , 22 MATCHES = %numtot22%
gui 6:add, text, , 23 MATCHES = %numtot23%
gui 6:add, text, , 24 MATCHES = %numtot24%
gui 6:add, text, , 25 MATCHES = %numtot25%

return


;-----------------------------------------------THIS SECTION OPENS FIRST WHEN THE PROGRAM STARTS, IT GIVES THE OPTION TO RELOAD IN ORDER TO CHANGE THE FIXED SEQUENCE


acceptlist:




gui 7:font, bold arial black
gui 7:show, x400 y200 w500 h200, COMMAND
gui 7:color, CEECF5


gui 7:Add, Button, x050 y060 w150 h50 gscriptcontinue, CONTINUE
gui 7:Add, Button, x250 y060 w150 h50 gscriptreload, RELOAD

gui 7:show,,mygui


return




scriptcontinue:

gui 7:destroy


return





scriptreload:


reload


;----------------------------------------------------------------------------------------------------------------control panel

controlpanel:


if cpass = 0
{
return
}

cpass = 0

gui 8:font, bold arial black
gui 8:show, x500 y010 w200 h200, COMMAND
gui 8:color, CEECF5


gui 8:Add, Button, x020 y020 w150 h50 vstopandprintbutton gscriptcontinue2 default, STOP AND PRINT
gui 8:Add, Button, x020 y100 w150 h50 vclosebutton gscriptreload2, CLOSE

guicontrol 8: disable, closebutton

gui 8:show,,mygui2

return




scriptcontinue2:

guicontrol 8: enable, closebutton
gosub, record


return





scriptreload2:


exitapp

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Google [Bot], mikeyww, mmflume and 166 guests