Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - total_annihilation00

Pages: [1] 2 3 4 5 ... 8
1
Troubleshooting Custom File Type Launchers and Icon Overrides in MC: Icon Deletion When Adding New Extensions
I'm configuring a custom file launch setup in MC for handling various PDF-related formats. The current File Types setup includes: `*.pdf`, `*.epub`, `*.djvu`, `*.mobi`, `*.chm`, `*.FB2`, `*.CB7`, `*.CBR`, `*.CBT`, `*.CBZ`, `*.PRC`.

The launcher configuration in `FileTypes.xml` looks like this:

xml
Code: [Select]
<launcher name="Sumatra Sandbox">
  <program type="1" name="" path="C:\Users\dell\Documents\SumatraALLOld\SumatraPDF-3.2-64.exe" args="-invert-colors &quot;${filepath}&quot;"/>
  <icon use="0" path="" index="-1"/>
  <extensions>*.pdf *.epub *.djvu *.mobi *.chm *.FB2 *.CB7 *.CBR *.CBT *.CBZ *.PRC</extensions>
</launcher>

I added a new file extension `*.azw3` to the `<extensions>` list. However, doing so causes my custom icons defined in `IconOverride.xml` for `.pdf`, `.epub`, and `.mobi` to be deleted automatically.

Icon override configuration:

xml
Code: [Select]
<icon ext=".pdf" iconpath="D:\Download\PDFX_Vwr_Port\PDFXCview.exe" iconindex="0"/>
<icon ext=".epub" iconpath="D:\Download\PDFX_Vwr_Port\PDFXCview.exe" iconindex="0"/>
<icon ext=".mobi" iconpath="D:\Download\PDFX_Vwr_Port\PDFXCview.exe" iconindex="0"/>

**Issue:** 
Adding a new extension to the launcher `<extensions>` list appears to overwrite or remove existing custom icon overrides for certain file types, specifically `.pdf`, `.epub`, and `.mobi`. How can I add support for `.azw3` without disrupting my existing icon customizations? 

    **Seeking:** 
    • Best practices for expanding file associations in MC without invalidating custom icon settings.
    • Configuration adjustments or workaround recommendations to preserve icon overrides when modifying launcher extensions.

P.S: I did all this via the user interface. There is clearly a synchronization mishap (saving a File Extension Launcher is breaking the associated Custom Icons), I urge you to fix this please; Configuration Corruption bug/ Settings Overwrite Issue (Changes to file extension associations via UI lead to unintended loss of custom icon overrides, indicating a bug in configuration handling), Mathias ! This bug is even present in V14 !

2
Thank you, Mathias ! Sorry for the late reply, I was having probs accessing MC servers and d'ling updates, that's why. :D

3
How can I override the default Windows Explorer file operation progress dialog with a custom MC modal progress dialog during copy/move operations? Attempted to modify the MC settings to make the progress indicator persistent post-operation, but it defaults to the built-in Explorer progress dialog, which auto-closes upon completion, preventing customization or persistence.
P.S: Maybe it's 'cause I have TeraCopy installed, & when I initiate a file operation it gives me a popup to choose to handle it through either Explorer or TeraCopy, that's why ?

4
Beta Releases / Re: v16.0 Beta
« on: May 30, 2026, 12:38:38 »
Sounds very strange. The source file are not deleted until windows has reported all data to target file are written. Sounds more like HW error.
I can't reproduce it. next time check if there are any errors reported in the fileoperation log (ctrl+L)

First of all it didn't get corrupted, the file was intact in the source path, it was just the target path that broke and listed it as 0 bytes and undeletable for a while since the move file operation aborted.
I think I know why the file operation failed to move to USB drive: I was sending it from C:\Users\dell\Downloads\thumbstick\CUT\SEND TO USB (COPY PDF FOLDER)\Temp FlashDrive Store\SendTo\Latest Software Delete (Temp)\CDRomance\TO CUT\css maps\Freed\HTML\Contra III - The Alien Wars (USA).sfc to F:\FILES-APPS+DL'S\GAME FILES\Genesis SNES NeoGeo ROMs\preexisting bkp 4 latest version (SNES)\Contra III - The Alien Wars (USA).sfc
So the file paths were probably too long, resulting in the lockup ! I tested on a 2 MB IceChat app Setup and it moved it instantly ! 😅

5
Thanks Mathias, it's working properly now —the internal-text-viewer is firing up once again ! Also, I will test further and see if I encounter any problems with MC progress dialog box hanging again when moving files to USB drives. The file I moved was a 1 MB SNES ROM (.SFC) (just some game file.) Had no issues when moving via TeraCopy however. 😎👍

6
I made the following User-Defined-Command 'Custom Commands' and assigned it as an alias named "bkp" so I can backup the config via the command Bar, repeatedly to the same file:

Backup MC Config:
Code: [Select]
MC.BackupConfig FILE="C:\Users\dell\Downloads\MultiCommander_ConfigBackup(latest).zip" ONLY_CONFIG
Change path to the backup save path you want the ZIP saved in, once you make the User-Defined-Command and assign it "bkp" or whatever you choose as the Alias, you can backup MC from the Command Bar just typing "bkp" and hitting enter (it'll backup silently.) Each time you execute the command it'll overwrite the same file without prompt. Hope it helps !

7
Beta Releases / Re: v16.0 Beta
« on: May 29, 2026, 18:02:59 »
( Issue #1 ) With the newest Beta update (3166), my File Internal-Text-Viewer hotkey isn't firing (it's set to Ctrl+Shift+F1.) As well as the View-File (set to F1) isn't working either. Was working before ! I'm on Windows 10.
P.S: Internal-Picture-Viewer is working fine though. I tried changing Internal-Text-Viewer to another keyboard combo, still doesn't fire. Also I have a "Smart Open (Ctrl+F9)" UDC script (that routes filetypes to custom apps) and that was taking a long time to fire (after the latest beta update), the script is finally working now (Internal-Text-Viewer and File-Viewer still remain broken) but might be related to the misfiring Internal-Text-Viewer. Also the User-Defined-command I have to open a Text File in Internal-Text-Viewer is also not working: MC.View FILE="D:\Download\My Docs\cpp programming notes.txt" VIEWAS=".txt" Please release a fix soon !
This is my Multi-File-Viewer config file I'm attaching (I use the "Audiowide" font if that helps):

( Issue #2 ) When moving some file to my USB Drive (F:\) the progress got stuck & never completed ! Resulted in data loss.

8
Gemini 3.5 Flash AI generated::
The intermittent "works on the second try" bug you are experiencing is a classic symptom of how Windows handles process creation and Shell communication, specifically when using `cmd.exe` as an unnecessary middleman.

Here is the refactored, robust version of your MultiScript. Below it is a breakdown of exactly why your original script was misbehaving.

### The Robust MultiScript (Replace `"C:\\Path\\To\\syspin.exe"` with the actual full path to your `syspin.exe`. Do the same and modify the code to extend support across all remaining operational modes):
Code: [Select]
```MultiScript
@var $filePath = GetSourceFocusPath();
@var $syspin = "C:\\Path\\To\\syspin.exe"; // Ensure double backslashes

// 1. Sanity Check: Prevent execution if no file is focused
if ( $filePath == "" ) {
    return;
}

// 2. Format arguments cleanly without the cmd.exe syntax
@var $args = "\"" + $filePath + "\" 5386";

// 3. Direct Execution: Bypass cmd.exe completely
MC.Run CMD="{$syspin}" ARG="{$args}";
```

Here are the rest of the codes:
+--------------------------------------------------------------+
| Action                     | Code   | Description                 |
+----------------------------|--------|------------------------------+
| Pin to taskbar             | 5386   | Pin the file to taskbar     |
| Unpin from taskbar         | 5387   | Remove from taskbar        |
| Pin to Start               | 51201  | Pin to Start menu          |
| Unpin from Start           | 51394  | Remove from Start menu     |
+--------------------------------------------------------------+

### What was causing the bug? (Under the Hood)

Your original script was doing this:
`MC.Run CMD="cmd.exe" ARG="/C \"\"C:\syspin.exe\" \"C:\file.txt\" 5386\"";`

There are two low-level mechanisms at play here that cause this to fail intermittently, requiring a second attempt.

#### 1. The `cmd.exe` Quoting Trap

When you invoke `cmd.exe` with the `/C` (terminate after execution) flag, you pass the command string into a notoriously complex parser. If the first and last characters of the argument string are quote marks, `cmd.exe` attempts to apply a heuristic to decide whether to strip them.

Depending on whether `$syspin` or `$filePath` contained spaces, `cmd.exe` might strip the outer quotes but fail to properly tokenize the inner ones. This often results in a malformed path being passed to the system, causing `cmd.exe` to quietly abort the operation without an error message. On the second click, the environment state or memory caching might shift just enough for the command to parse, or Explorer "catches up."

#### 2. Win32 Shell COM Interruption (The Real Culprit)

SysPin works by tapping into the Windows Shell API. It does not literally edit your taskbar registry keys; instead, it programmatically invokes an `IShellDispatch` Context Menu Verb (specifically the verb internally mapped to the ID `5386`).

This relies on COM (Component Object Model) Inter-Process Communication (IPC) to send a message to `explorer.exe`.

When you wrap SysPin inside `cmd.exe /C`, you are creating a transient parent process.

1. MultiCommander spawns `cmd.exe`.
2. `cmd.exe` spawns `syspin.exe`.
3. `syspin.exe` sends the COM request to `explorer.exe` to pin the item.
4. `cmd.exe` sees `syspin.exe` executing and often immediately begins its own tear-down process because of the `/C` flag.

If the console subsystem tears down the process tree *before* `explorer.exe` has fully finished handling the COM message across process boundaries, the taskbar pin operation is abruptly dropped. The first attempt "wakes up" the shell verb handler in Explorer, and the second attempt succeeds because the handler is now cached and responds fast enough to beat the `cmd.exe` shutdown window.

### The Fix

By changing `MC.Run` to target `syspin.exe` directly, you bypass the command interpreter entirely. MultiCommander uses standard Win32 `CreateProcess` to launch SysPin in its own stable, independent process space. SysPin can now cleanly send its COM message to the Windows Shell, wait for the acknowledgment, and exit gracefully without an artificial `cmd.exe` wrapper pulling the rug out from under it.

9
This is a follow-up. The previous scripts had compatibility issues with older Win 95+ OS's-based Screensavers etc. (they wouldn't detect the Wallpaper like in the BLOCKS/ Windows 98.SCR screensaver)

Legacy Windows 98 Screensaver Compatibility Fix via PowerShell
The issue stems from two primary compatibility gaps between modern Windows 10 and legacy Win32/16 architecture:

  • Image Format Limitation: Legacy screensavers (e.g., Windows 98.SCR) lack JPEG/PNG decoding capabilities and rely solely on uncompressed BMP files for textures.
  • Registry Synchronization: Modern Windows 10 manages wallpaper transcoding internally, often failing to update legacy registry keys (HKCU:\Control Panel\Desktop\Wallpaper) with raw image paths, causing detection failures.

Solution Overview:
  • On-the-fly BMP Conversion: The script leverages .NET's System.Drawing to transcode any user-selected image (JPG, PNG, WebP) into a 24-bit BMP, ensuring compatibility.
  • Reliable Storage Path: Saves the BMP to a predictable, short path (e.g., $env:USERPROFILE\classic_wallpaper.bmp) to facilitate detection by legacy screensavers.
  • Registry & API Updates: Manually updates the Wallpaper registry key with the BMP path and invokes SystemParametersInfo API with SPI_SETDESKWALLPAPER to immediately apply, ensuring the screensaver detects the correct wallpaper image.

You need five of these scripts for each of the modes (replace the code lines of each according to the following):
+--------------------------------------------------------+
|                Style Reference Map                     |
+------------------------------+-------------------------+
| Style                        | Registry Settings      |
+------------------------------+-------------------------+
| Stretch                      | WallpaperStyle='2'      |
|                              | TileWallpaper='0'       |
+------------------------------+-------------------------+
| Fit                          | WallpaperStyle='6'      |
|                              | TileWallpaper='0'       |
+------------------------------+-------------------------+
| Fill                         | WallpaperStyle='10'     |
|                              | TileWallpaper='0'       |
+------------------------------+-------------------------+
| Center                       | WallpaperStyle='0'      |
|                              | TileWallpaper='0'       |
+------------------------------+-------------------------+
| Tile                         | WallpaperStyle='0'      |
|                              | TileWallpaper='1'       |
+------------------------------+-------------------------+
| Span                         | WallpaperStyle='22'     |
|                              | TileWallpaper='0'       |
+------------------------------+-------------------------+

1. Here's the full script for 'Stretched', change the two values and repeat for the rest of the scripts modes (Gemini 3.5 Flash AI Generated):
Code: [Select]
```SetWallpaperMCStretch.ps1
param([string]$ImagePath)

# Validate file exists
if (-not (Test-Path $ImagePath)) {
    Write-Error "File not found: $ImagePath"
    exit 1
}

# Load .NET Assembly for Image Processing
Add-Type -AssemblyName System.Drawing

# Define a clean, static path for the legacy BMP file
# Legacy screensavers handle paths without spaces much better
$BmpPath = "$env:USERPROFILE\classic_wallpaper.bmp"

# Convert the source image to a 24-bit BMP to satisfy the Win98 screensaver engine
try {
    $SrcImage = [System.Drawing.Image]::FromFile($ImagePath)
   
    # If a previous wallpaper BMP exists, delete it first to release file locks
    if (Test-Path $BmpPath) {
        Remove-Item $BmpPath -Force -ErrorAction SilentlyContinue
    }
   
    # Save as BMP format
    $SrcImage.Save($BmpPath, [System.Drawing.Imaging.ImageFormat]::Bmp)
    $SrcImage.Dispose()
}
catch {
    Write-Error "Failed to process and convert image: $_"
    exit 1
}

# Set style: Stretch (Style '2', Tile '0')
Set-ItemProperty -Path 'HKCU:\Control Panel\Desktop' -Name WallpaperStyle -Value '2'
Set-ItemProperty -Path 'HKCU:\Control Panel\Desktop' -Name TileWallpaper -Value '0'

# FORCE legacy wallpaper path update in the registry for the screensaver
Set-ItemProperty -Path 'HKCU:\Control Panel\Desktop' -Name Wallpaper -Value $BmpPath

# Apply wallpaper via Win32 API
Add-Type -TypeDefinition @"
using System;
using System.Runtime.InteropServices;
public class Wallpaper {
    [DllImport("user32.dll", CharSet = CharSet.Auto)]
    public static extern int SystemParametersInfo(int uAction, int uParam, string lpvParam, int fuWinIni);
}
"@ -ErrorAction SilentlyContinue

# SPI_SETDESKWALLPAPER = 0x0014 (20)
# SPIF_UPDATEINIFILE | SPIF_SENDCHANGE = 3
[Wallpaper]::SystemParametersInfo(20, 0, $BmpPath, 3)
```


2. Plus interface it in MC 'User-Defined Command' script like this (replace the FilePath in the script with your local path (ensure directory separators are escaped with double backslashes \\).):
Code: [Select]
```MultiScript
@var $imgPath = GetSourceFocusPath();
@var $arguments = "-ExecutionPolicy Bypass -File \"C:\\Path\\To\\SetWallpaperMCStretch.ps1\" -ImagePath \"" + $imgPath + "\"";
MC.Run CMD="powershell.exe" ARG="{$arguments}";
```

Notes:
Tested on MC 16.0 running on Windows 10.
To add to the context menu: navigate to Config > "Custom Context Menu" and add the script.

Technical Highlights:
  • Uses PowerShell + .NET for image transcoding.
  • Sets appropriate registry values (WallpaperStyle and TileWallpaper) for correct display behavior.
  • Invokes Win32 API call for immediate wallpaper refresh.
  • Ensures backward compatibility for Win95/98-style screensavers expecting BMP textures and registry cues.

10
Support and Feedback / Re: Quick filter
« on: May 14, 2026, 09:31:42 »
Thanks, I'm trying claude at the moment. I will try to create an empty filter to quickly clear the filter.

Alright good luck 👍, but I had a bad experience with Claude's free-tier 'Sonnet', unless you're using 'Claude Opus 4.7 Thinking' (paid model), it's pretty useless. Whereas ChatGPT is amazingly good even with their free-tier models (just make sure you enable 'Thinking Mode')!

11
Beta Releases / Re: v16.0 Beta
« on: May 11, 2026, 17:26:19 »
Its probably a bug, But If I can't reproduce it. I can't fix it.  And unfortunately, I haven't been able to replicate this behavior. Because my development time is limited, I have to prioritize bugs with clear reproduction steps.
I'll keep this issue open in case others can provide more details or specific steps to help me trigger the issue.

I fixed it, the bug is due to me accidentally pressing Enter in "AutoLoad on Path" while entering the recursive paths in "Column Layouts" dialog. It's causing possible corruption of the dialog/ form.
No I spoke too soon ("My Advanced Tweaks" layout is still broken, but I got "Default" layout to work.) 8) O.K. I can confirm the problem lies in making a new "Column Layout". If I stick to the "Default" column layout it works, maybe a new Column Layout with "AutoLoad on Path" is causing issues...
Default Layout, when importing from other custom layouts, shows a message box with Chinese characters, so there is some corruption since custom layout allows "AutoLoad on Path" and Default layout does not allow this. I hope I made this clear...

12
Beta Releases / Re: v16.0 Beta
« on: May 11, 2026, 16:35:29 »
Hmm Strange.. When I restart I get the same setup as I had when I closed the app.

No I assure you there's a bug where it resets back to Name Ascending on all tabs initially on restart. I suspect another user also has this problem. What did get fixed is when a new tab is opened it retains the correct sorting, but on app restarts it still is broken and fails to store the sorting settings. So tab-wise it's fixed, but session-wise it's still glitchy.
P.S: I tested it on a fresh copy of 14.4 MultiCommander, after latest beta update, it's still working now, I think my ColumnSets.xml might have gotten corrupt, resetting it and rebuilding my Column Layout. I will let you know if it's resolved. :)

I think pressing Enter while entering "AutoLoad on Path" (Column Layout Editor) creates some corruption (possibly in ColumnSets.xml not sure). Right now I got Default layout to successfully retain sorting order. I will recreate all those column layouts from scratch. I'm confident this will fix it.

13
Beta Releases / Re: v16.0 Beta
« on: May 11, 2026, 15:58:05 »
I don't really understand that you trying to say what you are doing.   I can't reproduce that columns goes away by them self.

The Tabs when restored on next startup get changed back to Name Ascending (Default). My config is Date Descending. Maybe set *all* tabs to the stored Sorting Preferences in Explorer Panel on startup ? That should fix it.

14
Beta Releases / Re: v16.0 Beta
« on: May 11, 2026, 14:50:38 »
I can't reproduce that.   The column thing might be fixed with the other column issues that was fixed.. but the miscalculation of items I can't reproduce.

The update doesn't fix the issue entirely, after restarting MC, the restored session pre-existing tabs are reverting back to default —not the specified column sorting (in my case Date\Time Descending) ! It's not remembering the stored preference on re-launch. You've only fixed the sorting issue tab-wise not session-wise.

15
Support and Feedback / Re: Quick filter
« on: May 09, 2026, 22:36:45 »
You can create Filters (Configuration > Filters) then use this in a User-Defined Command (replace with your relevant FilterID) to filter out the files you want (these can be used as Custom Commands or MultiScripts and you can give them a Hotkey):
Filter e-Book Only (Sumatra) "doc"
Code: [Select]
MC.Explorer.SetViewFilter FILTERID="110d14a5c6844ff988d51cf79fb2ef3b"

You can use this to select all files solely without showing anything else (GhostFilter):
Source Code Select GhostFilter Files
Code: [Select]
Sleep(300);
MC.Explorer.Goto LEFT="D:\Download\cpp-projekt\FuzenOp_SiloTest\Yahoo-8Ball-Pool-Clone\"
Sleep(300);
MC.Explorer.Select FILTER="Pool-Game-CloneV18.cpp Yahoo-8Ball-Pool-Clone.rc resource.h" ONLYFILES
Sleep(300);
MC.RunCmd ID="ExplorerPanel.51023";
Sleep(300);

These are just scratching the surface, you can put them to use any way you like. You can use Filters to specify File Coloring Rules as well. ChatGPT AI is pretty decent at scripting and stuff.

16
Support and Feedback / Re: Quick filter
« on: May 09, 2026, 20:40:41 »
Ctrl+F for the Filter Box focus then Backspace to erase & Escape to return to the main view.

17
Beta Releases / Re: v16.0 Beta
« on: May 08, 2026, 11:36:41 »
The settings for new tab works.. t must be that custom column layout overrides it and cause it to reset it.
because that happens after. And I think it does not work because of another bug that was fixed. so it worked because something else was broken.

I see what you mean. Can it be fixed though? It's annoying me to no end having to reset the Sorting column each time. I can't comment on what was broken before that was fixed, but still it was working flawlessly on older builds! No probs with Sorting until the latest 3157 & possibly one build prior. Waiting for a fix… :)
P.S: For now I made a UDC script (Custom Commands) with a hotkey (Ctrl+Shift+U), but I expect a fix. ;D
Code: [Select]
MC.Explorer.Sort COLNAME="Date" ORDER=DES

18
Beta Releases / Re: v16.0 Beta
« on: May 08, 2026, 00:38:59 »
That settings are the default column and order for new tabs that are created.

If I set Date/Time and Ascending.. Press Apply.. and then create a new Explorer Panel tab.. The sorting is set to date with ascending order..

I've configured MultiCommander (V16 3157 Beta) to use "Date/Time Descending" as the default sorting order. Historically, this setting persisted correctly across sessions. However, after the latest update, the sorting reverts to "Name Ascending" upon opening new tabs, despite being set to "Date/Time Descending" in preferences.

Additional issues include:
- When applying a stored layout ("My Advanced Tweaks") via 'Use Column Layout', the sorting resets to "Name Ascending" in the main view.
- Creating a new layout with "AutoLoad On Paths" (specifically setting paths like C:\, D:\, G:\, etc., and enabling "Valid for Future Paths") via the dialog causes the sorting setting to break—reverting to "Name Ascending" on new tabs.
- This issue appears linked to the handling of "AutoLoad On Path" entries when creating or modifying layouts.
- Despite selecting the desired Sorted Column ("Date/Time Descending") and enabling "Remember Sorting" in the Explorer Panel, the sorting reverts to "Name Ascending" upon restarting MultiCommander (V16 3157 Beta). The setting should persist across sessions, but it appears the Sorted Column configuration is not retained on re-launch.
- This issue seems to be more than just "AutoLoad On Paths"—the latest beta does not correctly apply or restore the Sorted Column setting during startup, indicating a regression in the persistence logic for sorting preferences.

I verified that the issue is not present in older versions (e.g., V14.4 3047), where the sorting and layout behaviors work as expected. It seems the bug is related to how "AutoLoad On Path" interacts with layout persistence and sorting settings in the latest build.

Please investigate and fix this regression, especially ensuring that:
- Sorting preferences are persisted across sessions and tabs.
- "AutoLoad On Path" settings in layouts do not interfere with sorting state.

Thanks.

19
Beta Releases / Re: v16.0 Beta
« on: May 07, 2026, 16:31:10 »
After update 3157 the File Columns keep reverting to "Name Ascending", even though in my Explorer Panel Settings Under Sorting I have it set to "Date/Time Descending." I have a custom File Column Layout saved (via "Customize Columns..."), & they don't resize or anything, but the Sorting keeps getting reverted to "Name Ascending" ! I noticed some minor issues like this in early V16 Beta as well, but dismissed it and after setting them again to "Date/Time Descending" it usually worked persistently. But now the Sorting isn't persistently applied when opening a New Tab etc. I think the Column layout isn't being stored… But could be another issue causing the Sorting to revert to default. P.S: I also have "Sort By Natural Order" and "Remember Sorting" checked.

20
Feature Requests and Suggestions / Re: Request - Tab Navigation
« on: May 06, 2026, 16:24:52 »
Right now it can't be added easily.
In a future version a better way to customize key is planed. maybe it can be supported then

Oh alright, that's great !

21
Feature Requests and Suggestions / Request - Tab Navigation
« on: May 06, 2026, 13:26:02 »
Please it is very inconvenient for me to press Ctrl+[Shift]+Tab to navigate Tabs, if you could please allow setting Ctrl+PageUp/ PageDown instead as a hotkey, it would be ideal ! I know you've said it's already used by another command, but I'd rather use this for my Tab navigation ! If you could consider it in a future release pls ! :)

22
Thank you so much for reviving my script, Mathias ! Sorry to trouble you, but can you tell me why this particular script is failing (I'm guessing it's the ArrayFind)?
I get the following errors:
2026-05-06 11:22:54.288 Script engine error => Failed to process token - "$rules"
2026-05-06 11:22:54.288 Script engine error => Failed to initialize variable "$rules" with "
2026-05-06 11:22:54.288 Script engine error => Failed to define variable - "@var $rules[] ="
2026-05-06 11:22:54.288 Script engine error - Line : 11, Error : -1 => Code : "@var $rules[] ="

Here's the full code:
Code: [Select]
@var $path = GetSourceFocusPath();
@var $ext = StrToLower( PathGetFileExtPart( $path, 2 ) );

@var $textExts[] = {'txt','ini','log','ahk','mtxt','vbs','conf','cpp','h','rc','asm','nfo','info','ps1','xml','jsee','cfg'};
@var $imageExts[] = {'jpg','jpeg','jpe','jfif','png','gif','webp','bmp','tiff','psd','svg'};
@var $docExts[] = {'pdf','epub','djvu','mobi','fb2','cb7','cbr','cbt','cbz','prc','azw'};
@var $kegaExts[] = {'sms','gen','smd','bin','md'};
@var $snesExts[] = {'sfc','smc','fig'};
@var $audioExts[] = {'wav','mp3','mid','midi','wma','flac','ogg','aac','alac','aiff'};
@var $cursorExts[] = {'cur','ani'};

@var $rules[] =
{
    {'udc', $textExts, 'b85b4bf468ab418e87b4e09e95dca4a0'},
    {'udc', $imageExts, 'c3424b15b3dd4a75a83ce0d9ba857bbb'},
    {'udc', $docExts, '3bd046dd55484d62aa82285076ea1c15'},
    {'udc', {'zip'}, 'e271faf8469f4e96ac335fde319ab818'},
    {'udc', {'chm'}, '45cd3dfb7fc348ec99de80122481c55d'},
    {'udc', $kegaExts, '468167006ee54bb995e28940823ec958'},
    {'udc', $snesExts, '6d1061dff5014030bcd2062fee6701cf'},
    {'udc', {'nes'}, '3d966becbbb640f983aab1f18a109f51'},
    {'udc', $audioExts, '4e1f3a7ca0224c6ba0ff02f3f07cd7c4'},
    {'udc', $cursorExts, '3c16c3020c384373a4dd96060cb856e3'},

    {'run', {'pptx'}, '"C:\\Program Files\\Microsoft Office\\root\\Office16\\POWERPNT.EXE"', '/S "{$path}"'},
    {'run', {'ppt'},  '"C:\\Program Files\\Microsoft Office\\root\\Office16\\POWERPNT.EXE"', '"{$path}"'},
    {'run', {'sln'},  '"D:\\Download\\VS 19 CE\\Common7\\IDE\\devenv.exe"', '"{$path}"'},

    {'udc', {'exe'}, 'e07317b5406b4c19b069ea4bd926f706'}
};

@var $matched = 0;

foreach( $rule in $rules)
{
    if( arrayIFind( $rule[1], $ext ) > -1 )
    {
        $matched = 1;

        if( $rule[0] == 'udc' )
        {
            MC.RunUserCmd ID=$rule[2];
        }
        else if( $rule[0] == 'run' )
        {
            MC.Run CMD=$rule[2] ARG=$rule[3];
        }

        break;
    }
}

if( $matched == 0 )
{
    MessageBox( "SmartOpen", "No handler defined for extension: ." + $ext, 0 );
}

P.S: Nevermind, the arrays definition is probably the issue, I'm using my old code… P.P.S: Nevermind I figured it out, switched from For Loop to ForEach Loop. changed the For part "for( $i = 0; $i < 14; $i++ )" to "foreach( $rule in $rules)" and commented out "$rule = $rules[$i];" and also commented out both "@var $i;" and "@var $rule;" !
Quote
foreach may be slightly faster in theory because it bypasses manual index increment and bounds checking, but the gain is microseconds at most.
ForEach couldn't handle certain cases, had to switch to Arrays + IF's.

23
it mentions ForEach has been added to MC but the ChatGPT AI scripts which incorporated ForEach Loops (for my "Smart Open (Ctrl+F9)" script all failed —worked when I used plain For Loop: Changelog states: "arrays and collections. (e.g. foreach $item in $array { ... }) MultiScript "

Here's my full script that was reduced to just 55 lines of MultiScript code from 443 initially then 140 /w Boolean OR's but now it's optimized greatly & highly scalable. But this is broken because ForEach Loop is not working properly:
Code: [Select]
@var $path = GetSourceFocusPath();
@var $ext = StrToLower( PathGetFileExtPart( $path, 2 ) );

@var $rules[] = {'udc|txt,ini,log,ahk,mtxt,vbs,conf,cpp,h,rc,asm,nfo,info,ps1,xml,jsee,cfg|b85b4bf468ab418e87b4e09e95dca4a0','udc|jpg,jpeg,jpe,jfif,png,gif,webp,bmp,tiff,psd,svg|c3424b15b3dd4a75a83ce0d9ba857bbb','udc|pdf,epub,djvu,mobi,fb2,cb7,cbr,cbt,cbz,prc,azw|3bd046dd55484d62aa82285076ea1c15','udc|zip|e271faf8469f4e96ac335fde319ab818','udc|chm|45cd3dfb7fc348ec99de80122481c55d','udc|sms,gen,smd,bin,md|468167006ee54bb995e28940823ec958','udc|sfc,smc,fig|6d1061dff5014030bcd2062fee6701cf','udc|nes|3d966becbbb640f983aab1f18a109f51','udc|wav,mp3,mid,midi,wma,flac,ogg,aac,alac,aiff|4e1f3a7ca0224c6ba0ff02f3f07cd7c4','udc|cur,ani|3c16c3020c384373a4dd96060cb856e3','run|pptx|\"C:\\Program Files\\Microsoft Office\\root\\Office16\\POWERPNT.EXE\"|/S \"{$path}\"','run|ppt|\"C:\\Program Files\\Microsoft Office\\root\\Office16\\POWERPNT.EXE\"|\"{$path}\"','run|sln|\"D:\\Download\\VS 19 CE\\Common7\\IDE\\devenv.exe\"|\"{$path}\"','udc|exe|e07317b5406b4c19b069ea4bd926f706'};

@var $matched = 0;

foreach $rule in $rules
{
    @var $parts = StrTokenize2Array( $rule, "|" );
    @var $kind = $parts[0];
    @var $extList = StrTokenize2Array( $parts[1], "," );

    if( arrayIFind( $extList, $ext ) > -1 )
    {
        $matched = 1;

        if( $kind == "udc" )
        {
            MC.RunUserCmd ID=$parts[2];
        }
        else if( $kind == "run" )
        {
            MC.Run CMD=$parts[2] ARG=$parts[3];
        }

        break;
    }
}

if( $matched == 0 )
{
    MessageBox( "SmartOpen", "No handler defined for extension: ." + $ext, 0 );
}

I get the following errors:
2026-05-06 10:33:33.325 Script engine error => Internal Script Function - Parse Error : "in"
2026-05-06 10:33:33.325 Script engine error - Line : 22, Error : -1 => Code : "foreach $rule in $rules"

When I resorted to this For Loop version /w Arrays, it worked perfectly w/o any errors:
Code: [Select]
@var $path = GetSourceFocusPath();
@var $ext = StrToLower( PathGetFileExtPart( $path, 2 ) );

@var $rules[14];

// ====================== TEXT FILES ======================
$rules[0]  = 'udc|txt,ini,log,ahk,mtxt,vbs,conf,cpp,h,rc,asm,nfo,info,ps1,xml,jsee,cfg|b85b4bf468ab418e87b4e09e95dca4a0';
// ====================== IMAGE FILES ======================
$rules[1]  = 'udc|jpg,jpeg,jpe,jfif,png,gif,webp,bmp,tiff,psd,svg|c3424b15b3dd4a75a83ce0d9ba857bbb';
// ====================== DOCUMENT FILES ======================
$rules[2]  = 'udc|pdf,epub,djvu,mobi,fb2,cb7,cbr,cbt,cbz,prc,azw|3bd046dd55484d62aa82285076ea1c15';
$rules[3]  = 'udc|chm|45cd3dfb7fc348ec99de80122481c55d';
// ====================== ARCHIVE ======================
$rules[4]  = 'udc|zip|e271faf8469f4e96ac335fde319ab818';
// ====================== EMULATORS ======================
$rules[5]  = 'udc|sms,gen,smd,bin,md|468167006ee54bb995e28940823ec958';
$rules[6]  = 'udc|sfc,smc,fig|6d1061dff5014030bcd2062fee6701cf';
$rules[7]  = 'udc|nes|3d966becbbb640f983aab1f18a109f51';
// ====================== AUDIO ======================
$rules[8]  = 'udc|wav,mp3,mid,midi,wma,flac,ogg,aac,alac,aiff|4e1f3a7ca0224c6ba0ff02f3f07cd7c4';
// ====================== CURSORS ======================
$rules[9]  = 'udc|cur,ani|3c16c3020c384373a4dd96060cb856e3';
// ====================== MICROSOFT OFFICE ======================
$rules[10] = 'run|pptx|C:\\Program Files\\Microsoft Office\\root\\Office16\\POWERPNT.EXE|/S "{$path}"';
$rules[11] = 'run|ppt|C:\\Program Files\\Microsoft Office\\root\\Office16\\POWERPNT.EXE|"{$path}"';
$rules[12] = 'run|sln|D:\\Download\\VS 19 CE\\Common7\\IDE\\devenv.exe|"{$path}"';
// ====================== DOSBox ======================
$rules[13] = 'udc|exe|e07317b5406b4c19b069ea4bd926f706';

@var $matched = 0;
@var $i;
@var $rule;
@var $parts;
@var $kind;
@var $extList;

for( $i = 0; $i < 14; $i++ )
{
    $rule = $rules[$i];
    $parts = StrTokenize2Array( $rule, "|" );
    $kind = $parts[0];
    $extList = StrTokenize2Array( $parts[1], "," );

    if( arrayIFind( $extList, $ext ) > -1 )
    {
        $matched = 1;

        if( $kind == "udc" )
        {
            MC.RunUserCmd ID={$parts[2]};
        }
        else if( $kind == "run" )
        {
            MC.Run CMD="{$parts[2]}" ARG='{$parts[3]}';
        }

        break;
    }
}

if( $matched == 0 )
{
    MessageBox( "SmartOpen", "No handler defined for extension: ." + $ext, 0 );
}

Also the documentation needs to be updated so the AI can glean the syntax from the website. This is what I assume was added:
MultiScript supports the ternary operator (e.g. $a = $b ? $c : $d) MultiScript supports a "foreach" loop for iterating through
Quote
arrays and collections. (e.g. foreach $item in $array { ... }) MultiScript
supports new functions: Pow, abs, clamp, IsNumeric, StrStartsWith, StrEndsWith,
StrContains, StrFormat, StrPadLeft, StrPadRight, StrCount, StrRepeat,
ArrayReverse, ArraySlice MultiScript supports boolean operators AND / OR / NOT.

24
Beta Releases / Re: v16.0 Beta
« on: May 03, 2026, 00:43:48 »
 :) Thanks to the Boolean Operators —my script got optimized by "Grok-AI 4.20 Reasoning" to less than a quarter of its original size ! 'Smart Open (Ctrl+F9)' MultiScript went from 443 to just 103 lines of code (not discounting half of them being comments !), it's much more efficient & easier to maintain now ! I'am sure that /w Arrays & ForEach Loops it can be optimized even further.

25
A known issue is the "Set As Wallpaper" and "Pin To Taskbar" menu items don't appear when you're in 'Flat View' !

Pages: [1] 2 3 4 5 ... 8