Go Back   Cockos Incorporated Forums > REAPER Forums > REAPER Bug Reports

Reply
 
Thread Tools Display Modes
Old 03-13-2022, 08:14 AM   #1
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,630
Default API: AddRemoveReaScript has problems with separators in Lua(solved)

Sometimes, AddRemoveReaScript can not remove files from the actionlist.

Add a file named
"ClickApplyProjectSettingsButton-{503C2DD4-E138-459A-81EC-A40B91B388F4}.lua"
into the scripts folder.

The following code adds the script successfully:
Code:
A=reaper.AddRemoveReaScript(true, 0, reaper.GetResourcePath().."/Scripts/ClickApplyProjectSettingsButton-{503C2DD4-E138-459A-81EC-A40B91B388F4}.lua", true)
However, the following code does not remove it anymore from the actionlist:

Code:
A=reaper.AddRemoveReaScript(false, 0, reaper.GetResourcePath().."/Scripts/ClickApplyProjectSettingsButton-{503C2DD4-E138-459A-81EC-A40B91B388F4}.lua", true)
This sometimes works erratically. For instance,

"ClickApplyProjectSettingsButton.lua" worked in some of my tests, in others it didn't...

Could this be connected to the action-command-id-changes in the recent releases?

I have tested it on Reaper 6.48rc1x64 on Windows 7.

Will check, if it's also in the latest 6.51...
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - Donate, if you wish

On vacation for the time being...

Last edited by Meo-Ada Mespotine; 04-19-2022 at 09:03 AM.
Meo-Ada Mespotine is offline   Reply With Quote
Old 03-16-2022, 09:28 AM   #2
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,630
Default

Problem also exists in vanilla Reaper 6.51x64.

I think it's important to fix it soon, as ReaPack also relies on the ability to remove scripts from the actionlist...

Otherwise removed scripts from repositories might stay in the actionlist because of that...
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - Donate, if you wish

On vacation for the time being...
Meo-Ada Mespotine is offline   Reply With Quote
Old 03-20-2022, 11:22 AM   #3
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,630
Default

la bumpa
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - Donate, if you wish

On vacation for the time being...
Meo-Ada Mespotine is offline   Reply With Quote
Old 04-03-2022, 11:24 AM   #4
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,630
Default

The whole bug seem to be, that AddRemoveReaScript doesn't take properly into account \ versus / in the path when adding/removing a script.

This code always adds and removes the script:
Code:
A=reaper.GetResourcePath().."\\Scripts\\tudelu_22_01_2021_13_05_31.lua"
B=reaper.AddRemoveReaScript(false, 0, A, true)

This however, always adds but never removes the script:
Code:
A=reaper.GetResourcePath().."/Scripts/tudelu_22_01_2021_13_05_31.lua"
B=reaper.AddRemoveReaScript(false, 0, A, true)
The only difference between them is the used separators for the script.


I can also add duplicates of the same script, just by messing with separators.
Code:
add=false -- set to try add/remove all of them:

-- working: always add/removable
    -- uses no path to the script in kb.ini, therefore assumes, script is in scripts-folder
    -- SCR 4 0 RSff9b74aafc3bfa98202c626616d491ffc529e196 "Custom: tudelu_22_01_2021_13_05_31.lua" tudelu_22_01_2021_13_05_31.lua
    reaper.GetResourcePath().."\\Scripts\\tudelu_22_01_2021_13_05_31.lua"
    reaper.AddRemoveReaScript(add, 0, A, true)

-- buggy: alternative way, which adds(if the above way of adding hasn't been done before), but doesn't remove again
    -- will use full path to the script in kb.ini
    -- SCR 4 0 RS27ff500b6631c7b6131d341e58bec834d3f3c90d "Custom: tudelu_22_01_2021_13_05_31.lua" C:\Ultraschall-US_API_4.1.001\Scripts\tudelu_22_01_2021_13_05_31.lua
    reaper.GetResourcePath().."/Scripts/tudelu_22_01_2021_13_05_31.lua"
    reaper.AddRemoveReaScript(add, 0, A, true)

-- buggy: always added but never removable
    -- will use full path to the script in kb.ini with variations of the separator
    -- SCR 4 0 RSd9b04495ff208d80f0ffb945670ab5a19b8fff6f "Custom: tudelu_22_01_2021_13_05_31.lua" C:\Ultraschall-US_API_4.1.001\Scripts\\tudelu_22_01_2021_13_05_31.lua
    reaper.GetResourcePath().."/Scripts//tudelu_22_01_2021_13_05_31.lua"
    reaper.AddRemoveReaScript(add, 0, A, true)

    -- SCR 4 0 RScdaed2b56ab23eda5aff9a979f945ada5d7c3bb0 "Custom: tudelu_22_01_2021_13_05_31.lua" C:\Ultraschall-US_API_4.1.001\Scripts\\\tudelu_22_01_2021_13_05_31.lua
    reaper.GetResourcePath().."/Scripts///tudelu_22_01_2021_13_05_31.lua"
    reaper.AddRemoveReaScript(add, 0, A, true)

    -- SCR 4 0 RSa4ffe8a79ef8969af42e5db1aee0c9548ab55dbf "Custom: tudelu_22_01_2021_13_05_31.lua" C:\Ultraschall-US_API_4.1.001\Scripts\\\\tudelu_22_01_2021_13_05_31.lua
    reaper.GetResourcePath().."/Scripts////tudelu_22_01_2021_13_05_31.lua"
    reaper.AddRemoveReaScript(add, 0, A, true)
When this duplication happens, it leads to kb-ini-entries like this:

SCR 4 0 RS27ff500b6631c7b6131d341e58bec834d3f3c90d "Custom: tudelu_22_01_2021_13_05_31.lua" C:\Ultraschall-US_API_4.1.001\Scripts\tudelu_22_01_2021_13_05_31. lua
SCR 4 0 RSff9b74aafc3bfa98202c626616d491ffc529e196 "Custom: tudelu_22_01_2021_13_05_31.lua" tudelu_22_01_2021_13_05_31.lua
SCR 4 0 RSa4ffe8a79ef8969af42e5db1aee0c9548ab55dbf "Custom: tudelu_22_01_2021_13_05_31.lua" C:\Ultraschall-US_API_4.1.001\Scripts\\\\tudelu_22_01_2021_13_05_ 31.lua

With differences in the used path/separators to the script.

Means, depending on the used separator, AddRemoveReaScript seems to confuse, whether the script shall be added located in the ReaScript-path vs added using the entire absolute path.

I think, this is a Lua-only problem, as Lua allows using / and \ as file-separators which might confuse AddRemoveReaScript, so other languages should(tm) not be affected, if I got it right.

Tested on Reaper6.53x64 on Windows 7.

FWIW: My test-file is located in the path: "C:\Ultraschall-US_API_4.1.001\Scripts\tudelu_22_01_2021_13_05_31. lua"
Just in case, this has an effect on reproducing the bug.
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - Donate, if you wish

On vacation for the time being...
Meo-Ada Mespotine is offline   Reply With Quote
Old 04-03-2022, 11:43 PM   #5
Justin
Administrator
 
Justin's Avatar
 
Join Date: Jan 2005
Location: NYC
Posts: 15,746
Default

Ah yeah, it's because it's looking for the resourcedir\Scripts prefix, and you're giving it resourcedir/Scripts... anyway, fixing!
Justin is offline   Reply With Quote
Old 04-04-2022, 12:36 PM   #6
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,630
Default

Thanks
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - Donate, if you wish

On vacation for the time being...
Meo-Ada Mespotine is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 05:27 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.