Old 12-04-2018, 03:28 PM   #121
Triode
Human being with feelings
 
Triode's Avatar
 
Join Date: Jan 2012
Posts: 452
Default

Does anyone know if this extension would make it technically possible to float just one plugin at a time when clicking on FX instances on a channel (closing the presently floated one automatically) ?

This would mean intercepting the mouse click on an FX instance... Would that be possible?
__________________
Brush and Beater Drums Online: www.outoftheboxdrums.co.uk
Triode is online now   Reply With Quote
Old 12-06-2018, 05:13 AM   #122
mespotine
Human being with feelings
 
mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig, Germany
Posts: 608
Default

Nice additions to the plugin. One thing I couldn't figure out: How do I separate the multiple filenames(in the get-files-functions) from each other in Lua? It seems, that Lua sees only the first part of the string and thinks, that it ends at the 0-termination.
I would suggest to use \n instead, which is easier to parse and shouldn't cause any problems in either programming-language
__________________
Ultraschall-API: https://forum.cockos.com/showthread....98#post2067798
Reaper Internals - Developerdocs for Reaper: https://forum.cockos.com/showthread.php?t=207635
mespotine is offline   Reply With Quote
Old 12-06-2018, 05:33 AM   #123
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Québec, Canada
Posts: 2,313
Default

Filenames may contain \n (anything but \0 and /) on Linux (and macOS). With the latest REAPER dev versions the extension should be able to put null bytes in Lua strings.


Last edited by cfillion; 12-06-2018 at 05:39 AM.
cfillion is online now   Reply With Quote
Old 12-06-2018, 05:38 AM   #124
mespotine
Human being with feelings
 
mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig, Germany
Posts: 608
Default

Hmm..the string always ended right after the path, so maybe this is still a bug or I'm doing it wrong...


Newlines in filenames? Is there any real usecase for that? Other than confusion?
__________________
Ultraschall-API: https://forum.cockos.com/showthread....98#post2067798
Reaper Internals - Developerdocs for Reaper: https://forum.cockos.com/showthread.php?t=207635
mespotine is offline   Reply With Quote
Old 12-06-2018, 06:05 AM   #125
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Québec, Canada
Posts: 2,313
Default

Just tested and it works here, though I get a leading null byte which isn't there on Windows. Are you're using the IDE or ShowConsoleMsg? They won't show anything past a null byte.



Windows (only the first path is absolute?):



(Also can't seem to make it accept all or no file extensions on macOS the same way that works on Windows).

Last edited by cfillion; 12-06-2018 at 07:04 AM.
cfillion is online now   Reply With Quote
Old 12-06-2018, 07:18 AM   #126
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 2,196
Default

Quote:
Originally Posted by mespotine View Post
How do I separate the multiple filenames(in the get-files-functions) from each other in Lua?
Code:
for file in files:gmatch("[^\0]+") do

Last edited by juliansader; 12-08-2018 at 04:41 AM.
juliansader is offline   Reply With Quote
Old 12-07-2018, 07:26 AM   #127
mespotine
Human being with feelings
 
mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig, Germany
Posts: 608
Default

@JulianSaders @cfillion

Thanx, using \0 to pattern match was probably too obvious for me to see. With that, it works like a charm
__________________
Ultraschall-API: https://forum.cockos.com/showthread....98#post2067798
Reaper Internals - Developerdocs for Reaper: https://forum.cockos.com/showthread.php?t=207635
mespotine is offline   Reply With Quote
Old 12-07-2018, 08:54 AM   #128
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 778
Default

Quote:
Originally Posted by juliansader View Post
Code:
for file in files:gmatch("[^\0]") do
When I use that (on Win7) I only get one char per loop.

EDIT: OK,it works if I add a '+' to the end of it,
Code:
for file in files:gmatch("[^\0]+") do
I guess that'll work.

Last edited by Edgemeal; 12-07-2018 at 12:23 PM.
Edgemeal is offline   Reply With Quote
Old 12-08-2018, 04:36 AM   #129
mespotine
Human being with feelings
 
mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig, Germany
Posts: 608
Default

I'll post a function tomorrow(forgot to put it on my USB-stick today), that'll deal with that conveniently and return the filenames as array.
__________________
Ultraschall-API: https://forum.cockos.com/showthread....98#post2067798
Reaper Internals - Developerdocs for Reaper: https://forum.cockos.com/showthread.php?t=207635
mespotine is offline   Reply With Quote
Old 12-08-2018, 04:40 AM   #130
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 2,196
Default

Quote:
Originally Posted by Edgemeal View Post
OK,it works if I add a '+' to the end of it,
Oops! Corrected.
juliansader is offline   Reply With Quote
Old 12-11-2018, 02:13 AM   #131
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 2,196
Default

I neglected to include a description of the "extensionList" parameter of the open/save file dialogs in the API help.

This parameter uses the same format as the standard C++ functions GetOpenFileName and GetSaveFileName:

This string is terminated by *double* \0 characters, and contains a list of filter substrings, each terminated by a single \0.

The filter substrings are arranged in pairs: The first substring in each pair describes the filter and is displayed to the user in the dialog; the second substring in the pair specifies the filter pattern that the operating system must use. For example, "Lua scripts (*.lua)\0*.lua"\0.

To specify multiple filter patterns for a single display string, use a semicolon to separate the patterns (for example, "*.lua;*.eel\0").

Warning: in Windows, the filter doesn't require the * filename wildcard in front of the extension, but it appears to be required in Linux. (I'm not sure about macOS.)

So, for example, to include a filter for either all files or just lua scripts, this string can be used:
Code:
"All files (*.*)\0*.*\0Lua scripts (.lua)\0*.lua\0\0"
juliansader is offline   Reply With Quote
Old 12-12-2018, 10:06 AM   #132
mespotine
Human being with feelings
 
mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig, Germany
Posts: 608
Default

For the JS_Dialog_BrowseForOpenFiles-function, you can use the following code, to separate the filenames and path:

Code:
function SplitFilenameStringAtNULLBytes(splitstring)
--  if type(splitstring)~=nil 
  -- add a NULL-Byte at the end, helps us finding the end of the string later
  splitstring=splitstring.."\0"
  local count=0
  local filenames={}
  local temp, offset
  
  -- let's get the path
  local path, offset=splitstring:match("(.-)()\0")
  splitstring=splitstring:sub(offset+1,-1)
  
  -- let's get the filenames
  while splitstring~=nil do
    -- find the next filename
    temp,offset=splitstring:match("(.-)()\0")
    
    if temp~=nil then 
      -- if the next filename isn't nil, then add it fo filenames-array and count+1
      count=count+1 
      filenames[count]=temp
      splitstring=splitstring:sub(offset+1,-1)
    else 
      -- if filename is nil, the string is probably finished splitting
      break 
    end
  end
  return count, path, filenames
end
__________________
Ultraschall-API: https://forum.cockos.com/showthread....98#post2067798
Reaper Internals - Developerdocs for Reaper: https://forum.cockos.com/showthread.php?t=207635
mespotine is offline   Reply With Quote
Old 12-12-2018, 10:51 AM   #133
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 2,196
Default

Perhaps something simpler?

The following should give you the path in t[1] and the file names in the rest of the table:
(Except if #t == 1, in which case the entire path and filename is in t[1].)
Code:
t = {}
for file in files:gmatch("[^\0]+")
    t[#t+1] = file
end
juliansader is offline   Reply With Quote
Old 12-15-2018, 04:34 AM   #134
reapero
Human being with feelings
 
Join Date: Aug 2011
Posts: 73
Default

Hey i am just curious..are there some scripts out there already using this API?
reapero is online now   Reply With Quote
Old 12-15-2018, 05:44 AM   #135
lb0
Human being with feelings
 
Join Date: Apr 2014
Posts: 2,752
Default

Quote:
Originally Posted by reapero View Post
Hey i am just curious..are there some scripts out there already using this API?
I have one in progress that uses certain functions from this API. This API has really opened up a whole new world to scripting in Reaper.
__________________
Projects - Reascripts - Lua:
LBX Stripper | LBX Chaos Engine | LBX Floating FX Positioner | LBX SRD Smart Knobs
Donate via Paypal
lb0 is online now   Reply With Quote
Old 12-15-2018, 06:07 AM   #136
reapero
Human being with feelings
 
Join Date: Aug 2011
Posts: 73
Default

Yeah..looks like it. I with i has the skills to use it
reapero is online now   Reply With Quote
Old 12-15-2018, 11:44 AM   #137
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 778
Default

Quote:
Originally Posted by reapero View Post
Hey i am just curious..are there some scripts out there already using this API?
I have one to reset vertical Vu meters, and just made this..

If you call actions from a lua script its a hassle to copy their ID/convert IDs, etc. Using this script you just highlight the action(s) you want and call this script from a shortcut and it generates the code for you, at least I hope it does.

Code:
-- Command ID Code Generator v0.04 --
-- Testing: x64, Windows 7, REAPER v5.963+dev1213, js_ReaScriptAPI v0.961.
-- v0.04 - Support multiple selected LV items.

local app_name = "Cmd_ID Code Gen"
local code = ""

local hWnd_action = reaper.JS_Window_Find("Actions", true)
if hWnd_action == nil then
  reaper.MB("Please open the Actions list!", app_name, 0)
  return
end  

local hWnd_LV = reaper.JS_Window_FindChildByID(hWnd_action, 1323)
if reaper.JS_ListView_GetItemText(hWnd_LV, 0, 3) == "" then
  reaper.MB("Please enable 'Show action IDs' in Actions list!", app_name, 0)
  return
end

-- get selected count & selected indexes
sel_count, sel_indexes = reaper.JS_ListView_ListAllSelItems(hWnd_LV)
if sel_count == 0 then
  reaper.MB("Please select one or more actions.", app_name, 0)
  return
end 

-- generate code lines for *Main*
for index in string.gmatch(sel_indexes, '[^,]+') do 
  local desc = reaper.JS_ListView_GetItemText(hWnd_LV, tonumber(index), 1)
  local cmd = reaper.JS_ListView_GetItemText(hWnd_LV, tonumber(index), 3)
  if tonumber(cmd) ~= nil then -- reaper action
    code = code .. "reaper.Main_OnCommand(" .. cmd .. ", 0) -- " .. desc .. '\r\n'
  else -- custom scripts require a lookup
    code = code .. "reaper.Main_OnCommand(reaper.NamedCommandLookup('" .. cmd .. "'), 0) -- " .. desc .. '\r\n'
  end
end -- for index

reaper.CF_SetClipboard(code)-- copy generated code to clipboard

Last edited by Edgemeal; 12-16-2018 at 02:09 AM. Reason: 4th draft
Edgemeal is offline   Reply With Quote
Old 12-15-2018, 02:48 PM   #138
reapero
Human being with feelings
 
Join Date: Aug 2011
Posts: 73
Default

So you use a script to actually write code? Jesuschrist..you guys are just too smart
reapero is online now   Reply With Quote
Old 12-15-2018, 03:41 PM   #139
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 2,196
Default

Quote:
Originally Posted by cfillion View Post
Just tested and it works here, though I get a leading null byte which isn't there on Windows. Are you're using the IDE or ShowConsoleMsg? They won't show anything past a null byte.



Windows (only the first path is absolute?):

The WDL/swell function is supposed to return the path in the first substring, and the filename (without path) in the following substrings. On Linux, it works correctly. I wonder if there is a bug in the macOS swell function? Perhaps the leading null byte is the terminator of an empty path substring?


Quote:
Originally Posted by cfillion View Post
(Also can't seem to make it accept all or no file extensions on macOS the same way that works on Windows).
Could you explain what you mean by "all or no file extensions"?

If the user gives no extension filter, the function should automatically add a *.* filter, so that the filter dropdown menu isn't just blank.

Last edited by juliansader; 12-16-2018 at 04:30 AM.
juliansader is offline   Reply With Quote
Old 12-16-2018, 03:36 AM   #140
amagalma
Human being with feelings
 
Join Date: Apr 2011
Posts: 1,341
Default

Quote:
Originally Posted by Edgemeal View Post
I have one to reset vertical Vu meters, and just made this..

If you call actions from a lua script its a hassle to copy their ID/convert IDs, etc. Using this script you just highlight the action(s) you want and call this script from a shortcut and it generates the code for you, at least I hope it does.

Code:
-- Command ID Code Generator v0.04 --
-- Testing: x64, Windows 7, REAPER v5.963+dev1213, js_ReaScriptAPI v0.961.
-- v0.04 - Support multiple selected LV items.

local app_name = "Cmd_ID Code Gen"
local code = ""

local hWnd_action = reaper.JS_Window_Find("Actions", true)
if hWnd_action == nil then
  reaper.MB("Please open the Actions list!", app_name, 0)
  return
end  

local hWnd_LV = reaper.JS_Window_FindChildByID(hWnd_action, 1323)
if reaper.JS_ListView_GetItemText(hWnd_LV, 0, 3) == "" then
  reaper.MB("Please enable 'Show action IDs' in Actions list!", app_name, 0)
  return
end

-- get selected count & selected indexes
sel_count, sel_indexes = reaper.JS_ListView_ListAllSelItems(hWnd_LV)
if sel_count == 0 then
  reaper.MB("Please select one or more actions.", app_name, 0)
  return
end 

-- generate code lines for *Main*
for index in string.gmatch(sel_indexes, '[^,]+') do 
  local desc = reaper.JS_ListView_GetItemText(hWnd_LV, tonumber(index), 1)
  local cmd = reaper.JS_ListView_GetItemText(hWnd_LV, tonumber(index), 3)
  if tonumber(cmd) ~= nil then -- reaper action
    code = code .. "reaper.Main_OnCommand(" .. cmd .. ", 0) -- " .. desc .. '\r\n'
  else -- custom scripts require a lookup
    code = code .. "reaper.Main_OnCommand(reaper.NamedCommandLookup('" .. cmd .. "'), 0) -- " .. desc .. '\r\n'
  end
end -- for index

reaper.CF_SetClipboard(code)-- copy generated code to clipboard
Brilliant! Thanks!
amagalma is online now   Reply With Quote
Old 12-16-2018, 05:11 AM   #141
amagalma
Human being with feelings
 
Join Date: Apr 2011
Posts: 1,341
Default

How could I paste the text in the clipboard to a focused window?
For example, with Spy++ I get this code when pasting into a window:
Code:
<000001> 00250490 P WM_CHAR chCharCode:'22' (22) cRepeat:1 ScanCode:2F fExtended:0 fAltDown:0 fRepeat:0 fUp:0 [wParam:00000016 lParam:002F0001]
I have tried this but it does not work:
Code:
reaper.JS_WindowMessage_Send( windowHWND, "WM_CHAR", 0x0016, 0x0000, 0x0001, 0x002F)
Any ideas?

Last edited by amagalma; 12-16-2018 at 06:30 AM.
amagalma is online now   Reply With Quote
Old 12-16-2018, 10:08 AM   #142
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 778
Default

EDIT
You got me wondering about sending text and clicking buttons now.
Since there is no support for "BM_CLICK" or "WM_SETTEXT", I guess we'd do it something like this?

CODE REMOVED! TRY AGAIN!

Last edited by Edgemeal; Yesterday at 02:38 PM.
Edgemeal is offline   Reply With Quote
Old Yesterday, 01:06 AM   #143
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 778
Default reaper.JS_Window_FindEx

reaper.JS_Window_FindEx ?
When I try to use that function the IDE higlights it in red.

v0.961 on dev+1213 , Win7_x64
Edgemeal is offline   Reply With Quote
Old Yesterday, 04:24 AM   #144
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 5,238
Default

Do you think we can get selected media files from Media Explorer and start doing some Media Explorer script ? :P
X-Raym is offline   Reply With Quote
Old Yesterday, 05:03 AM   #145
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 778
Default

Quote:
Originally Posted by X-Raym View Post
Do you think we can get selected media files from Media Explorer and start doing some Media Explorer script ? :P
Heres one way, I'd prefer using JS_Window_FindEx() to get the handle to the file Listview, the container its in seems to be the only control with an ID of 0, so tested like this,...

Code:
-- Testing: x64, Windows 7, REAPER v5.963+dev1213, js_ReaScriptAPI v0.961.

function print(str)
  reaper.ShowConsoleMsg(tostring(str) .. "\n") -- console
end

local hWnd = reaper.JS_Window_Find("Media Explorer", true)
if hWnd == nil then return end  

local container = reaper.JS_Window_FindChildByID(hWnd, 0)
local file_LV = reaper.JS_Window_FindChildByID(container, 1000)

sel_count, sel_indexes = reaper.JS_ListView_ListAllSelItems(file_LV)
if sel_count == 0 then return end 

for ndx in string.gmatch(sel_indexes, '[^,]+') do 
  index = tonumber(ndx)
  local fname = reaper.JS_ListView_GetItemText(file_LV, index, 0)
  local size = reaper.JS_ListView_GetItemText(file_LV, index, 1)
  local date = reaper.JS_ListView_GetItemText(file_LV, index, 2)
  local ftype = reaper.JS_ListView_GetItemText(file_LV, index, 3)
  print(fname .. ', ' .. size .. ', ' .. date .. ', ' .. ftype) 
end

-- get selected path  from edit control inside combobox
local combo = reaper.JS_Window_FindChildByID(hWnd, 1002)
local edit = reaper.JS_Window_FindChildByID(combo, 1001)
local path = reaper.JS_Window_GetTitle(edit, "", 255)
print(path)

Last edited by Edgemeal; Yesterday at 05:42 AM. Reason: get more column data
Edgemeal is offline   Reply With Quote
Old Yesterday, 05:25 AM   #146
juliansader
Human being with feelings
 
Join Date: Jul 2009
Posts: 2,196
Default

Quote:
Originally Posted by X-Raym View Post
Do you think we can get selected media files from Media Explorer and start doing some Media Explorer script ? :P
As Edgemeal answered, yes you can! (I am actually using some myself.)

Three remarks:

* You can open the Media Explorer (and get its HWND) using reaper.OpenMediaExplorer("", false).

* You can run any action from the Actions list's Media Explorer context (or even any item from the ME's menu), using JS_Window_OnCommand.

* If you are publishing a script that searches for any of REAPER's standard windows, such as the Media Explorer, use JS_Localize to get the translated title.
juliansader is offline   Reply With Quote
Old Yesterday, 05:39 AM   #147
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 5,238
Default

@edgemeal
This is awesome !


We can finally make a Rename from media explorer action !


Only problem is that the last clicked selected items in media explorer is in read-only mode. The trick is to close and re-open the media explorer using the native actions (or API functions) which will also refresh the media explorer (a trick I used in some databases scripts I made).

But I wonder is there is any more clever js_extension trick now ? for both release read-only mode and for refreshing the media explorer ?


@juliansader
This script really open new possibilities to scripting ! Cool it is part to default reateam repos.
X-Raym is offline   Reply With Quote
Old Yesterday, 05:59 AM   #148
amagalma
Human being with feelings
 
Join Date: Apr 2011
Posts: 1,341
Default

Quote:
Originally Posted by Edgemeal View Post
This seems to work OK, tho not sure its actually correct.

Code:
local hWnd_action = reaper.JS_Window_Find("Actions", true)
if hWnd_action ~= nil then
  -- Get handle to Filter editbox in Actions window,
  local hWnd_filter = reaper.JS_Window_FindChildByID(hWnd_action, 1324)
  -- send it an "A" Char
  ret = reaper.JS_WindowMessage_Post(hWnd_filter, "WM_CHAR", string.byte("A"), 0,0,0) 
end

Yes, simple characters work, but Ctrl+V etc do not.



Quote:
Code:
function JS_Send_Text(hWnd, str)
  for char in string.gmatch(str, "%U") do 
    ret = reaper.JS_WindowMessage_Post(hWnd, "WM_CHAR", string.byte(char), 0, 0, 0) 
    if ret ~= true then break end -- something went wrong?, abort loop!
  end
end

For some reason, this works up to 64 characters. If they are more than 64, it truncates the start.
amagalma is online now   Reply With Quote
Old Yesterday, 06:46 AM   #149
_Stevie_
Human being with feelings
 
_Stevie_'s Avatar
 
Join Date: Oct 2017
Posts: 1,314
Default

0.961 is not listed in the repo, yet, right? We have to download manually. Or did I miss something?
__________________
My Reascripts forum thread | My Reascripts on GitHub | Stephan Römer - film composer
If you wish to donate for my scripts: please consider an organization like: animal shelter, doctors without borders, UNICEF, etc...
_Stevie_ is online now   Reply With Quote
Old Yesterday, 03:02 PM   #150
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 778
Default

Quote:
Originally Posted by amagalma View Post
For some reason, this works up to 64 characters. If they are more than 64, it truncates the start.
It could be a char limit set by the target control. Yesterday that code worked flawless, today acting weird, ok lets try something diff...

EDIT New test...
Code:
local hWnd_action = reaper.JS_Window_Find("Actions", true)
if hWnd_action ~= nil then
  filter_editbox = reaper.JS_Window_FindChildByID(hWnd_action, 1324)
  reaper.JS_Window_SetTitle(filter_editbox, "tracks unselect all") -- set text of Actions Filter
end
Get Top-Level Control IDs Under Mouse (For Windows only)

Last edited by Edgemeal; Yesterday at 04:05 PM.
Edgemeal is offline   Reply With Quote
Old Today, 04:16 AM   #151
amagalma
Human being with feelings
 
Join Date: Apr 2011
Posts: 1,341
Default

Quote:
Originally Posted by Edgemeal View Post
EDIT New test...
Code:
local hWnd_action = reaper.JS_Window_Find("Actions", true)
if hWnd_action ~= nil then
  filter_editbox = reaper.JS_Window_FindChildByID(hWnd_action, 1324)
  reaper.JS_Window_SetTitle(filter_editbox, "tracks unselect all") -- set text of Actions Filter
end
Get Top-Level Control IDs Under Mouse (For Windows only)

No, this still doesn't work.. Strangely, it works for the Action List but it doesn't in all the other windows. For example, open Notepad and try this:
Code:
hWnd_action = reaper.JS_Window_Find(" - Notepad", false)
if hWnd_action ~= nil then
  child = reaper.JS_Window_FindChildByID(hWnd_action, 15)
  reaper.JS_Window_SetTitle(child, "This is a test")
end

Nothing happens.. I tried to mimic the press of Ctrl+V in order to paste the text I have in the clipboard, but again no luck:
Code:
  reaper.JS_WindowMessage_Post( child, "WM_KEYDOWN", 0x0011, 0x0000, 0x0001, 0x001D) -- Ctrl
  reaper.JS_WindowMessage_Post( child, "WM_KEYDOWN", 0x0011, 0x0000, 0x0001, 0x401D)
  reaper.JS_WindowMessage_Post( child, "WM_KEYDOWN", 0x0056, 0x0000, 0x0001, 0x002F) -- V
  reaper.JS_WindowMessage_Post( child, "WM_CHAR", 0x0016, 0x0000, 0x0001, 0x002F)
  reaper.JS_WindowMessage_Post( child, "WM_KEYUP", 0x0056, 0x0000, 0x0001, 0xC02F)
  reaper.JS_WindowMessage_Post( child, "WM_KEYUP", 0x0011, 0x0000, 0x0001, 0xC01D)

P.S. Your exe for getting the Control IDs is very handy! Thanks!
amagalma is online now   Reply With Quote
Old Today, 07:14 AM   #152
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 778
Default

Quote:
Originally Posted by amagalma View Post
No, this still doesn't work.. Strangely, it works for the Action List but it doesn't in all the other windows. For example, open Notepad and try this:
Looking at the source code 'JS_Window_SetTitle' is calling the 'SetWindowText' API which is used to change the text of a window's title bar, I'm not sure why it works on Edit controls in REAPER, but was the last thing I tried.

TEST, change title bar text of notepad...
Code:
hWnd = reaper.JS_Window_Find("Untitled - Notepad", true)
if hWnd ~= nil then
 reaper.JS_Window_SetTitle(hWnd, "This is a test")
end

In vb.net to send text to a control I do it like this,
Code:
SendMessage(hWnd, WM_SETTEXT, IntPtr.Zero, "Hello World!")
,and to use it that way I have a SendMessage declared to pass strings, which I probably got from pinvoke.net.
Code:
<DllImport("user32.dll")> _
Private Shared Function SendMessage(ByVal hWnd As IntPtr, ByVal Msg As UInt32, ByVal wParam As IntPtr, <MarshalAs(UnmanagedType.LPStr)> ByVal lParam As String) As IntPtr
End Function
Could of sworn I saw WM_SETTEXT in one of the JS source flles, but I think it was commented out so can't be used.

Last edited by Edgemeal; Today at 07:25 AM.
Edgemeal is offline   Reply With Quote
Old Today, 08:16 AM   #153
mespotine
Human being with feelings
 
mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig, Germany
Posts: 608
Default

Quote:
Originally Posted by _Stevie_ View Post
0.961 is not listed in the repo, yet, right? We have to download manually. Or did I miss something?
It works with pre-releases of Reaper only, for the moment.
Though I hope, Reaper 5.964 contains the stuff needed for an "official release".
__________________
Ultraschall-API: https://forum.cockos.com/showthread....98#post2067798
Reaper Internals - Developerdocs for Reaper: https://forum.cockos.com/showthread.php?t=207635
mespotine is offline   Reply With Quote
Old Today, 03:23 PM   #154
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Québec, Canada
Posts: 2,313
Default

Quote:
Originally Posted by Edgemeal View Post
Looking at the source code 'JS_Window_SetTitle' is calling the 'SetWindowText' API which is used to change the text of a window's title bar, I'm not sure why it works on Edit controls in REAPER, but was the last thing I tried.
https://docs.microsoft.com/en-us/win...setwindowtextw

Quote:
Changes the text of the specified window's title bar (if it has one). If the specified window is a control, the text of the control is changed. However, SetWindowText cannot change the text of a control in another application.

[...]

If the target window is owned by the current process, SetWindowText causes a WM_SETTEXT message to be sent to the specified window or control.
cfillion is online now   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 PM.


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