Quantcast
Channel: Total Commander
Viewing all articles
Browse latest Browse all 4328

Plugins and addons: devel.+support (English) • Re: [WDX] Autorun Plugin: Run commands/set envvars on TC start

$
0
0
2funkymonk
I have good news. Among the many useful novelties (see history), Autorun implements the WMIQuery object, with which you can get data from a collection on request (example in the help), which is significantly faster for the second and subsequent elements than using GetWMIValue.
Both functions now have the ability to specify a namespace, get the items count, and select an item by index.
The functions I requested for fast and resource-saving receipt of various information for threading operations are also implemented.
Try an analog of the above example with localization of dynamically output data:

Code:

LoadLibrary Plugins\Autorun_Tweaks.dllLoadLibrary Plugins\Autorun_Sysinfo.dllLoadLibrary Plugins\Autorun_Runtime.dll###################################### HOTKEYS ####################################### Ctrl+Shift+R — restart scriptSetHotkeyAction /H:R /K:C /K:S RestartScript# Shift+F11 — show/hide header with updated stats by starting and stopping the threadSetHotkeyAction /H:F11 /K:S ToggleCaption#####################################################################################Global Units, sUnit, WS_CAPTION = 0x00C00000If Not AUTORUN_RESTARTCOUNT Then SetEnv('Title', WinGetText())If AUTORUN_TCLANG = 'eng' Then   sUnit = ' kB/s'Else   Units = StrFormat('LU:%s,%s,%s,%s,%s', LngRead(1450), _   LngRead(1451), LngRead(1452), LngRead(1453), LngRead(1449))   sUnit = ' ' & LngRead(1657)EndIfIf WinHasStyle(WS_CAPTION) Then RunThread AutoUpdateHeaderStatsFunc ToggleCaption   WinSetStyle(WS_CAPTION, 8)   WinRedraw   If WinHasStyle(WS_CAPTION) Then RunThread AutoUpdateHeaderStatsEndFuncFunc AutoUpdateHeaderStats   Local RSpeed, NSpeed   While 1      If Not WinHasStyle(WS_CAPTION) Then Return      GetNetSpeed RSpeed NSpeed      WinSetText(Title & ' | ' & Date('d MMMM') & ' ' & Time() & ' | Free system drive space: ' & _      SizeFormat(GetDriveSpace(SystemDrive, 2), 1, 'G', 2, '', Units) & ' | RAM: ' & GetMemstats() & _      '% | CPU: ' & GetCPUUsage() & '% | Net in: ' & RSpeed & ' | Net out: ' & NSpeed)      Sleep 1000   WendEndFuncFunc GetNetSpeed(ByRef RSpeed, ByRef NSpeed)   Static ITF_Id = GetNetInterface()   If ITF_Id = -1 Then Return   Static nPrevRecv = GetNetInterfaceInfo(ITF_Id, 'Recv'), nPrevSend = GetNetInterfaceInfo(ITF_Id, 'Sent')   Local nRecv = GetNetInterfaceInfo(ITF_Id, 'Recv'), nSend = GetNetInterfaceInfo(ITF_Id, 'Sent')   RSpeed = SizeFormat(nRecv - nPrevRecv, 0, '', 2, 0) & sUnit   NSpeed = SizeFormat(nSend - nPrevSend, 0, '', 2, 0) & sUnit   nPrevRecv = nRecv   nPrevSend = nSendEndFunc
Some useful information can be obtained by the GetCoreTempInfo function (CPUSpeed in MHz, for example), but it's missing in the example due to the need to use a third-party program.
With the script restart hotkey, you can test changes and additions without having to restart TC and apply cm_UnloadPlugins, which may cause a hang (not due to Autorun).
In this case, the AUTORUN_RESTARTCOUNT counter serves as an auxiliary variable for this. In the example, it is used for the Title environment variable.
As long as this thread (and *only* this one) runs, TC crashes when cm_UnloadPlugins is called.
cm_UnloadPlugins should no longer cause TC crashes when threads are running. Check it out.

Download Autorun 2.2.13 beta

Statistics: Posted by Fla$her — 2024-08-21, 11:05 UTC



Viewing all articles
Browse latest Browse all 4328

Trending Articles


Vimeo 10.7.1 by Vimeo.com, Inc.


Pokemon para colorear


“Hanggang s apag tanda natin”


Long Distance Relationship Tagalog Love Quotes


RE: Mutton Pies (frankie241)


Hato lada ym dei namar ka jingpyrshah jong U JJM Nichols Roy (Bah Joy) ngin...


Vimeo 11.5.1 by Vimeo.com, Inc.


FORECLOSURE OF REAL ESTATE MORTGAGE


UPDATE SC IDOL: TWO BECOME ONE


Girasoles para colorear


Re:Mutton Pies (lleechef)


KASAMBAHAY BILL IN THE HOUSE


Top 100 Tagalog Love Quotes Collections Online


Tropa Quotes


Ka longiing longsem kaba skhem bad kaba khlain ka pynlong kein ia ka...


Vimeo 10.7.0 by Vimeo.com, Inc.


Vimeo 11.6.0 by Vimeo.com, Inc.


Vimeo 11.8.1 by Vimeo.com, Inc.


FORTUITOUS EVENT


Sapos para colorear