Zeroun_Scripts

Script Progress GUI

Jun 14th, 2021
741
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
  2. ; #Warn  ; Enable warnings to assist with detecting common errors.
  3. SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
  4. SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
  5.  
  6. CoordMode ToolTip Client
  7. #SingleInstance Force
  8.  
  9. ; === SETUP ===
  10. clientTitle := "PROGRAM NAME" ; The title of your client.
  11. chatboxX := 22
  12. chatboxY := 700
  13. chatboxWidth := 370
  14. chatboxHeight := 125
  15. bgTransparent := "false" ; true if you wish the gui background to be transparent, false if not.
  16.  
  17. ; === Don't touch any of this ===
  18. Gui, Margin, 0, 0
  19. Gui, Color, 0xCBBA95
  20. Gui, Add, Text, x20 y10 w350 vrowTimer hwndrowTimer, % "Time running: " runTime()
  21. Gui, Add, Text, x20 y25 w350 vrow1 hwndrow1
  22. Gui, Add, Text, x20 y40 w350 vrow2 hwndrow2
  23. Gui, Add, Text, x20 y55 w350 vrow3 hwndrow3
  24. Gui, Add, Text, x20 y70 w350 vrow4 hwndrow4
  25. Gui, Add, Text, x20 y85 w350 vrow5 hwndrow5
  26. Gui, Add, Text, x20 y100 w350 vrow6 hwndrow6
  27. ;Gui, Add, Text, x252 y20 w230 vrow5 hwndrow5
  28. ;Gui, Add, Text, x252 y35 w230 vrow6 hwndrow6
  29. ;Gui, Add, Text, x252 y50 w230 vrow7 hwndrow7
  30. ;Gui, Add, Text, x252 y65 w230 vrow8 hwndrow8
  31. ;Gui, Add, Text, x252 y80 w230 vrow9 hwndrow9
  32. WinSet, Transparent, 255
  33.  
  34. if (bgTransparent = "true") {
  35.     Gui, +E0x20 +toolWindow -caption -dpiScale +lastFound +alwaysOnTop hwndhChild
  36.     WinSet, TransColor, 0xCBBA95
  37. } else{
  38.     Gui, +toolWindow -caption -dpiScale +lastFound +alwaysOnTop hwndhChild
  39.     hParent := WinExist(clientTitle)
  40.     DllCall("SetParent", Ptr, hChild, Ptr, hParent)
  41. }
  42. Gui, Show, x%chatboxX% y%chatboxY% w%chatboxWidth% h%chatboxHeight% NA
  43.  
  44. SetTimer, guiUpdate, 75
  45.  
  46.  
  47. ; === Here you can put whatever you want in each row of the gui. ===
  48. ; === Text, variables, expressions, whatever! ===
  49.  
  50. guiUpdate:
  51.     if WinActive(clientTitle)
  52.         Gui, Show, x%chatboxX% y%chatboxY% w%chatboxWidth% h%chatboxHeight% NA
  53.         ;WinActivate %clientTitle%
  54.     GuiControl,, rowTimer, % "Time running: " runTime() ; This is an example of an expression working
  55.     GuiControl,, row1,                                  ; (although don't change it - it's the timer!)
  56.     GuiControl,, row2,  Status: %currentTask% ; Pretty self explanatory.
  57.     GuiControl,, row3,
  58.     GuiControl,, row4,  PlaceHolder: ;%variablename%
  59.     GuiControl,, row5,  
  60.     GuiControl,, row6,  PlaceHolder2: ;%variablename%                 ; Don't forget the % when using variables.
  61.     GuiControl,, row7,
  62.     GuiControl,, row8,
  63.     GuiControl,, row9,
  64.     Return
  65.  
  66. ; === FUNCTIONS ===
  67. runTime() {
  68.     Global
  69.     if !CounterBefore
  70.         CounterBefore := A_TickCount
  71.     Return toHHMMSS((A_TickCount - CounterBefore) / 1000)
  72. }
  73.  
  74. toHHMMSS(sec) {
  75.     oldFormat := A_FormatFloat
  76.     SetFormat, Float, 02.0
  77.     hrs := sec // 3600 / 1
  78.     min := Mod(sec // 60, 60) / 1
  79.     sec := Mod(sec, 60) / 1
  80.     SetFormat, Float, % oldFormat
  81.     ;These return statements change how the time is formatted in the return statement.
  82.     Return (hrs ? hrs "h " : "") (min ? min "m " : "") sec "s"
  83.    
  84. }
  85.  
  86. F12::ExitApp
Advertisement
Add Comment
Please, Sign In to add comment