[WDX] Autorun Plugin: Run commands/set envvars on TC start

Discuss and announce Total Commander plugins, addons and other useful tools here, both their usage and their development.

Moderators: Hacker, petermad, Stefan2, white

Post Reply
Fla$her
Power Member
Power Member
Posts: 2699
Joined: 2020-01-18, 04:03 UTC

Re: [WDX] Autorun Plugin: Run commands/set envvars on TC start

Post by *Fla$her »

2funkymonk
The bugs found were fixed in 2.2.14 beta. You can check.
For other fixes and new features, see history_en.txt.
funkymonk wrote: 2024-08-21, 18:28 UTC Does GetValue support arrays of some type as return value?

However, for GetValue('IPAddress') and GetValue('DefaultIPGateway') an array of ip addresses should be returned.
Arrays are now supported. An analogue of your problem example will look like this:

Code: Select all

#  Show list of IP addresses by Alt + i
SetHotkeyAction /K:A /H:I getAllIPAddresses

Func getAllIPAddresses
   
   Local WMI = WMIQuery(), i, IP, IPs, AllIPs

   WMI.Query('SELECT IPAddress FROM Win32_NetworkAdapterConfiguration')

   While WMI.Next()
      For i = 0 To WMI.GetValue('IPAddress', -1) - 1
         IP = WMI.GetValue('IPAddress', i)
         If IP <> '' Then IPs = IPs & ' / ' & IP
      Next
      If IPs <> '' Then
         AllIPs = AllIPs & auLf & StrMid(IPs, 4)
         IPs = ''
      EndIf
   Wend

   MsgBox(StrMid(AllIPs, 2))

EndFunc
Overquoting is evil! 👎
User avatar
funkymonk
Senior Member
Senior Member
Posts: 485
Joined: 2013-12-04, 09:56 UTC

Re: [WDX] Autorun Plugin: Run commands/set envvars on TC start

Post by *funkymonk »

Great, thank you.
I will give it a try during the next days...
User avatar
funkymonk
Senior Member
Senior Member
Posts: 485
Joined: 2013-12-04, 09:56 UTC

Re: [WDX] Autorun Plugin: Run commands/set envvars on TC start

Post by *funkymonk »

Interim report: Meanwhile, I have tried a few things with Time() and a lot more with WMI/Arrays. Looks good so far.
User avatar
funkymonk
Senior Member
Senior Member
Posts: 485
Joined: 2013-12-04, 09:56 UTC

Re: [WDX] Autorun Plugin: Run commands/set envvars on TC start

Post by *funkymonk »

A minor suggestion: How about supporting parameters to set the window size and font for MsgBox(...)?

Could be interesting to use monospaced fonts (for better vertical alignment of information) and avoid line breaks because of a (currently) fixed width.
Last edited by funkymonk on 2024-10-11, 07:08 UTC, edited 1 time in total.
User avatar
funkymonk
Senior Member
Senior Member
Posts: 485
Joined: 2013-12-04, 09:56 UTC

Re: [WDX] Autorun Plugin: Run commands/set envvars on TC start

Post by *funkymonk »

Bug?

Code: Select all

Func GetSystemInformationString
  Return WMI_IPINFORMATION
EndFunc

ControlSetHint /F /H:2 /R 0 "GetSystemInformationString"
The last line (ControlSetHint) is called on TC start.
Then, however, TC loses focus immediately. That seems to be independent from the current mouse position, and I think this shouldn't happen. --> Bug?
Once I return the focus to the TC window (click, alt+tab, ...) the tooltip works as expected (when hovering the mouse over the main window header).
Fla$her
Power Member
Power Member
Posts: 2699
Joined: 2020-01-18, 04:03 UTC

Re: [WDX] Autorun Plugin: Run commands/set envvars on TC start

Post by *Fla$her »

funkymonk wrote: 2024-10-11, 06:52 UTC Looks good so far.
Good.
funkymonk wrote: 2024-10-11, 06:56 UTCA minor suggestion: How about supporting parameters to set the window size and font for MsgBox(...)?
MsgBox doesn't have such settings in the API. It's necessary to draw a separate window. Isn't a hint with SetHintParam enough?
funkymonk wrote: 2024-10-11, 07:05 UTCBug?
Yes. I informed. Switches and controls don't affect this.
For now, you can specify WinSetState(23) at the end of all code (before the "finalize section") or after ControlSetHint and Sleep 200, for example.
Overquoting is evil! 👎
User avatar
funkymonk
Senior Member
Senior Member
Posts: 485
Joined: 2013-12-04, 09:56 UTC

Re: [WDX] Autorun Plugin: Run commands/set envvars on TC start

Post by *funkymonk »

Bug?

IsInt(100.3) returns 0 --> ok
IsInt('100.3') returns 0 --> ok
IsInt('SomeStringThatIsNaN') returns 1 --> Bug?
User avatar
funkymonk
Senior Member
Senior Member
Posts: 485
Joined: 2013-12-04, 09:56 UTC

Re: [WDX] Autorun Plugin: Run commands/set envvars on TC start

Post by *funkymonk »

Fla$her wrote: 2024-10-11, 12:15 UTC
funkymonk wrote: 2024-10-11, 06:52 UTC Looks good so far.
Good.
Tested more. Still good.
Fla$her wrote: 2024-10-11, 12:15 UTC
funkymonk wrote: 2024-10-11, 06:56 UTCA minor suggestion: How about supporting parameters to set the window size and font for MsgBox(...)?
MsgBox doesn't have such settings in the API. It's necessary to draw a separate window. Isn't a hint with SetHintParam enough?
Depends on the situation. It was just a suggestion.
Fla$her wrote: 2024-10-11, 12:15 UTC
funkymonk wrote: 2024-10-11, 07:05 UTCBug?
Yes. I informed. Switches and controls don't affect this.
For now, you can specify WinSetState(23) at the end of all code (before the "finalize section") or after ControlSetHint and Sleep 200, for example.
Already doing this since some time. Still annoying. Thanks for informing.
Fla$her
Power Member
Power Member
Posts: 2699
Joined: 2020-01-18, 04:03 UTC

Re: [WDX] Autorun Plugin: Run commands/set envvars on TC start

Post by *Fla$her »

funkymonk wrote: 2024-10-11, 17:55 UTC IsInt('SomeStringThatIsNaN') returns 1 --> Bug?
Yes, it will be fixed.
funkymonk wrote: 2024-10-11, 17:58 UTC It was just a suggestion.
And, as I expected, it was not approved, taking into account all the reasons. The probability of implementation is low.
Overquoting is evil! 👎
User avatar
funkymonk
Senior Member
Senior Member
Posts: 485
Joined: 2013-12-04, 09:56 UTC

Re: [WDX] Autorun Plugin: Run commands/set envvars on TC start

Post by *funkymonk »

Bug in 2.2.14b?

Code: Select all

text1 = ''
text2 = StrReplace(text1, 'x', '')
MsgBox('[' & text1 & '] [' & text2 & ']')
The message box shows "[][0]" --> Bug?

According to the help for StrReplace: "If the substring is not found, or if the string or substring is empty, the function returns the original string."
For an empty (source) string, StrReplace apparently returns a number (0) instead of the original string.
Fla$her
Power Member
Power Member
Posts: 2699
Joined: 2020-01-18, 04:03 UTC

Re: [WDX] Autorun Plugin: Run commands/set envvars on TC start

Post by *Fla$her »

Probably the description is wrong, I will clarify.
Overquoting is evil! 👎
User avatar
funkymonk
Senior Member
Senior Member
Posts: 485
Joined: 2013-12-04, 09:56 UTC

Re: [WDX] Autorun Plugin: Run commands/set envvars on TC start

Post by *funkymonk »

Fla$her wrote: 2024-10-13, 15:17 UTC Probably the description is wrong, I will clarify.
Well, I hope the description is correct...

Why should StrReplace change an empty source string into a number? I would definitely prefer/suggest to keep the empty string.
(BTW: If an empty string is passed to StrTrim, it stays empty. Which is correct imho.)
Fla$her
Power Member
Power Member
Posts: 2699
Joined: 2020-01-18, 04:03 UTC

Re: [WDX] Autorun Plugin: Run commands/set envvars on TC start

Post by *Fla$her »

funkymonk wrote: 2024-08-23, 20:07 UTC And: In autorun.lng, the [DEU] section is outdated/incomplete/buggy. Is there already a more recent German translation?
I've updated the section, check it (if you're a native speaker, of course).

The rest is fixed. Also now, instead of IsInt('String'), you can use IsNumber('String').

Autorun 2.2.14.1 beta

* German translation updated
* changed some language lines in autorun.lng
- StrReplace returned 0 instead of an empty string with an empty parameter
- Tweaks: fixed loss of focus of the TC window when ControlSetHint is called for the first time
+ function IsNumber
- the IsInt function returned 1 for a string that was not cast to an integer

- SysInfo: TC crash in GetKnownFolderPath fixed (on x64, less often on x86)
+ support for setting Unicode paths in CommandExec /CD
Last edited by Fla$her on 2024-10-14, 11:53 UTC, edited 1 time in total.
Overquoting is evil! 👎
User avatar
funkymonk
Senior Member
Senior Member
Posts: 485
Joined: 2013-12-04, 09:56 UTC

Re: [WDX] Autorun Plugin: Run commands/set envvars on TC start

Post by *funkymonk »

Quick check on 2.2.14.1 beta:

* German translation updated
--> I can check and provide improvements
Question: How exactly is %s used in lng files? Sometimes it seems to be a filename, a line number, a function/var name, etc...

- StrReplace returned 0 instead of an empty string with an empty parameter
--> looks good now.

- Tweaks: fixed loss of focus of the TC window when ControlSetHint is called for the first time
--> looks good now.

+ function IsNumber
--> Documentation missing in help. But there seems to be a bug:

Code: Select all

  MsgBox(IsNumber(100))   --> shows 0. Bug? 
  MsgBox(IsNumber(100))   --> shows 0. Bug? 
  MsgBox(IsNumber(100.3))   --> shows 1. ok. 
  MsgBox(IsNumber('100.3'))   --> shows 1. ok. 
  MsgBox(IsNumber('SomeStringThatIsNaN'))   --> shows 0. ok. 
- the IsInt function returned 1 for a string that was not cast to an integer
--> looks good now.
Fla$her
Power Member
Power Member
Posts: 2699
Joined: 2020-01-18, 04:03 UTC

Re: [WDX] Autorun Plugin: Run commands/set envvars on TC start

Post by *Fla$her »

funkymonk wrote: 2024-10-14, 11:06 UTCHow exactly is %s used in lng files?
7, 10, 11, 27 - function name, 14 - If/EndIf. The rest is clear from the context.

Code: Select all

  MsgBox(IsNumber(100))   --> shows 0. Bug? 
Yeah. Fixed. Help updated. The link is the same.

Thanks for the tests!
Overquoting is evil! 👎
Post Reply