Old 06-15-2017, 01:15 PM   #1
deeb
Human being with feelings
 
Join Date: Feb 2017
Posts: 177
Default 'SetToggleCommandState' (number expected, got string)



How can i use this function with non numerical command id's? because this works:reaper.SetToggleCommandState("40853");
Thanks
Attached Images
File Type: jpg Screen Shot 2017-06-15 at 21.10.14.jpg (52.2 KB, 45 views)
deeb is offline   Reply With Quote
Old 06-15-2017, 01:30 PM   #2
cfillion
Human being with feelings
 
Join Date: May 2015
Location: Québec, Canada
Posts: 1,146
Default

Use NamedCommandLookup to get the current underlying numerical ID. You can also lookup your own script's ID using ({reaper.get_action_context()})[4].
cfillion is offline   Reply With Quote
Old 06-15-2017, 01:53 PM   #3
deeb
Human being with feelings
 
Join Date: Feb 2017
Posts: 177
Default

Quote:
Originally Posted by cfillion View Post
Use NamedCommandLookup to get the current underlying numerical ID. You can also lookup your own script's ID using ({reaper.get_action_context()})[4].
Thanks a lot!
deeb is offline   Reply With Quote
Old 06-15-2017, 02:37 PM   #4
deeb
Human being with feelings
 
Join Date: Feb 2017
Posts: 177
Default

excuse me, but i am trying to do:

command_id=reaper.NamedCommandLookup('_SWSTL_TOGTC P')
reaper.SetToggleCommandState(1,command_id,1);


this does nothing and no errors? what am i missing?
and how do i know a section id?
deeb is offline   Reply With Quote
Old 06-15-2017, 02:59 PM   #5
cfillion
Human being with feelings
 
Join Date: May 2015
Location: Québec, Canada
Posts: 1,146
Default

Your example returns false here (the doc says it should return true on success). SetToggleCommandState is only for ReaScripts, to make its toolbar icon appear pressed like this: .
It doesn't work on extension actions. Use Main_OnCommand if you just want to run _SWSTL_TOGTCP or SetMediaTrackInfo_Value to set the TCP visibility of a given track.

As for the section identifiers:
Code:
0/100=main/main alt, 32063=media explorer, 32060=midi editor, 32061=midi event list editor, 32062=midi inline editor, etc

Last edited by cfillion; 06-15-2017 at 03:12 PM.
cfillion is offline   Reply With Quote
Old 06-15-2017, 03:12 PM   #6
deeb
Human being with feelings
 
Join Date: Feb 2017
Posts: 177
Default

Quote:
Originally Posted by cfillion View Post
Your example returns false here (the doc says it should return true on success). SetToggleCommandState is only for ReaScripts, to make its toolbar icon appear like this: .
It doesn't work on extension actions. Use Main_OnCommand if you just want to run _SWSTL_TOGTCP or SetMediaTrackInfo_Value to set the TCP visibility of a given track.

As for the section identifiers:
Code:
0/100=main/main alt, 32063=media explorer, 32060=midi editor, 32061=midi event list editor, 32062=midi inline editor, etc

Thanks a lot that was it! cheers
deeb 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:25 AM.


Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2017, vBulletin Solutions, Inc.