Quantcast
Channel: AutoHotkey Community
Viewing all articles
Browse latest Browse all 579

Ask for Help (v1) • vStatus Update issue

$
0
0

CODE:

#NoEnv
SendMode Input
SetTitleMatchMode, 1
SetWorkingDir %A_ScriptDir%

;####################################
;
; Variable Initialization
;
;####################################

global startTime := A_TickCount
lastRanScript := ""
SetTimer, UpdateRunTime, 1000

;####################################
;
; GUI Creation
;
;####################################

Gui, +AlwaysOnTop +ToolWindow +Owner
Gui, Margin, 5, 2
Gui, Add, ListBox, vScriptList w150 h100 -VScroll -HScroll
Gui, Add, Text, vStatusText x160 y30 w150 Center h20, No Script Running:
Gui, Add, Text, vRunTime x160 y60 w150 Center h15, 00:00:00
centerX := (300 - (100 + 10 + 100)) / 2
Gui, Add, Button, x%centerX% w100 gPopulateList, Refresh List
Gui, Add, Button, x+10 w100 gRunScript, Run Script

PopulateList() {
GuiControl,, ScriptList, |
Loop, Files, %A_ScriptDir%\*.ahk, FR
{
SplitPath, A_LoopFileFullPath, name_no_ext
if (A_LoopFileFullPath != A_ScriptFullPath)
{
GuiControl,, ScriptList, %name_no_ext%
}
}
}

PopulateList()
Gui, Show, x0 y50 w310, Script Runner
return

;####################################
;
; GUI Subroutines
;
;####################################

PopulateList:
PopulateList()
return

RunScript:
{
Gui, Submit, NoHide
Loop, Files, %A_ScriptDir%\*.ahk, FR
{
SplitPath, A_LoopFileFullPath, name_no_ext
if (name_no_ext = ScriptList)
{
lastRanScript := A_LoopFileFullPath
GuiControl,, vStatusText, %lastRanScript%:
GuiControl, +Redraw, vStatusText
Run, %A_LoopFileFullPath%
break
}
}
}
return


^Esc:: ; Ctrl+Esc hotkey to exit
{
if (lastRanScript != "")
Process, Close, %lastRanScript%
ExitApp
}
return

UpdateRunTime:
global startTime
elapsedTime := (A_TickCount - startTime) // 1000
hours := elapsedTime // 3600
minutes := Mod(elapsedTime // 60, 60)
seconds := Mod(elapsedTime, 60)
runTime := Format("{:02d}:{:02d}:{:02d}", hours, minutes, seconds)
GuiControl,, RunTime, %runTime%
Return

GuiClose:
ExitApp


Image

I am running into a weird issue where my vStatusText isn't being updated by GuiControl when i initilize RunScript: subroutine. I've triple checked my code through other various scripts using the same thing but this is the only one not updating. The image provided is how it is supposed to look when it works properly, I was achieving this by creating a transparent GUI for each script to overlay ontop of my Script Selector, but now want to update everything and have it all done on my Script Opener GUI.

Statistics: Posted by pepsirice — 40 minutes ago



Viewing all articles
Browse latest Browse all 579

Trending Articles