Jump to content
Developer Wiki and Function Reference Links ×

SetToByName or SetToByIndex


Recommended Posts

Looking at the Vectorscript reference it appears that SetToByName does not support internal tools and some of the "internal tools" do not have and index.  

 

Is there any way to set the current tool using a script to those "internal tools" that do not have an index?

 

Tools that are internal without indexes are but not limited to:

"Door Tool"

"Window Tool"

"Slab Tool"

"Wall End Cap Tool"

 

@Pat Stanford@Jesse Cogswell@MullinRJ

 

image.png.bd5198827bc23794c9bf7dcebeb50867.png 

Edited by The Hamma
Link to comment
5 hours ago, Pat Stanford said:

I just tested and 

 

B1:=CallToolByName('Door Tool');

B1:=CallToolByName('Door Tool');

 

works.

 

I have not tested the others.

 

Any idea what would cause this to work on some of my custom tools, but with others, it flashes the tool in the pallete real quick then returns to the selection tool?

 

I was getting excited to write my own shortcut selector for my StreamDeck since the native shortcut system is almost full.  But I can't do it if it won't actually select the tools.

Edited by SamIWas
Link to comment
On 1/12/2024 at 7:58 PM, SamIWas said:

I was getting excited to write my own shortcut selector for my StreamDeck since the native shortcut system is almost full.  But I can't do it if it won't actually select the tools.

This is actually what I’m working on.  I have written two, scripts that I use to call the functions from stream deck with a shortcut. It calls the script and then has user input for the tool name. This is where I have stream deck, enter the name of the tool. Or the index.  Which then is executed by the script.

 

my scripts are attached.  
I am using control+shift+alt+X for the tool shortcut

And control+shift+alt+Z for the menu shortcut


If I ever finish my stream deck profile, I will upload it

PROCEDURE StreamDeckCommand;
{Input the command name with the index at the end of the name.  Use two digits for the index name. ie. for 1 use 01 for 0 use 00.  
Print command would be "Print00", Font Size 4 command would be "Font Size01" and Font size 144 would be "Font Size17"}

VAR
SDstring,SDStrInt:STRING;
SDLen,SDInt:INTEGER;

BEGIN
SDstring:=StrDialog('Command to run','');
SDLen:=Len(SDstring);
SDStrInt:=Copy(SDstring,SDLen-1,2);
SDInt:=Str2Num(SDStrInt);
SDstring:=Copy(SDString,1,SDLen-2);
if SDstring <> '' THEN DoMenuTextByName(SDstring,SDInt);
END;

RUN(StreamDeckCommand);

 

 

PROCEDURE StreamDeckTool;
{Either input the tool name or the tool index}

VAR
Istool,SDstring:STRING;
Result:BOOLEAN;

BEGIN
SDstring:=StrDialog('Command to run','');
Istool:=Copy(SDstring,1,1);
if SDstring <> '' THEN
	BEGIN
		IF Istool = '-' THEN Result:=SetToolbyIndex(Str2Num(SDstring)) ELSE Result:=SetToolByName(SDstring);
		
	END;
END;


RUN(StreamDeckTool);

 

 

StreamDeckTool.vsm

StreamDeckCommand.vsm

Edited by The Hamma
Link to comment
On 1/12/2024 at 2:49 PM, Pat Stanford said:

B1:=CallToolByName('Door Tool');

B1:=CallToolByName('Door Tool');

 

works.

Ok I was wrong about "Window Tool" and "Door Tool" being internal commands, but the other two "Slab Tool" and "Wall End Cap Tool" do not have pugins and can't be called. 

 

Link to comment
On 1/14/2024 at 8:21 PM, The Hamma said:

This is actually what I’m working on.  I have written two, scripts that I use to call the functions from stream deck with a shortcut. It calls the script and then has user input for the tool name. This is where I have stream deck, enter the name of the tool. Or the index.  Which then is executed by the script.

 

my scripts are attached.  
I am using control+shift+alt+X for the tool shortcut

And control+shift+alt+Z for the menu shortcut


If I ever finish my stream deck profile, I will upload it

PROCEDURE StreamDeckCommand;
{Input the command name with the index at the end of the name.  Use two digits for the index name. ie. for 1 use 01 for 0 use 00.  
Print command would be "Print00", Font Size 4 command would be "Font Size01" and Font size 144 would be "Font Size17"}

VAR
SDstring,SDStrInt:STRING;
SDLen,SDInt:INTEGER;

BEGIN
SDstring:=StrDialog('Command to run','');
SDLen:=Len(SDstring);
SDStrInt:=Copy(SDstring,SDLen-1,2);
SDInt:=Str2Num(SDStrInt);
SDstring:=Copy(SDString,1,SDLen-2);
if SDstring <> '' THEN DoMenuTextByName(SDstring,SDInt);
END;

RUN(StreamDeckCommand);

 

 

PROCEDURE StreamDeckTool;
{Either input the tool name or the tool index}

VAR
Istool,SDstring:STRING;
Result:BOOLEAN;

BEGIN
SDstring:=StrDialog('Command to run','');
Istool:=Copy(SDstring,1,1);
if SDstring <> '' THEN
	BEGIN
		IF Istool = '-' THEN Result:=SetToolbyIndex(Str2Num(SDstring)) ELSE Result:=SetToolByName(SDstring);
		
	END;
END;


RUN(StreamDeckTool);

 

 

StreamDeckTool.vsm 5.7 kB · 0 downloads

StreamDeckCommand.vsm 5.91 kB · 0 downloads

Just after I posted, I found SetToolByName or whatever and got it started.  But I'll look at yours, too.  

Link to comment
On 1/14/2024 at 7:43 PM, The Hamma said:

Ok I was wrong about "Window Tool" and "Door Tool" being internal commands, but the other two "Slab Tool" and "Wall End Cap Tool" do not have pugins and can't be called.

 

Hello David,

   I found constants for the Slab Tool (-248) and the Wall End Cap Tool (-355). I did not find constants for the Door or Window tools, but those two can be called with CallToolByName() or SetToolByName(), as Pat mentioned.

 

Raymond

Link to comment

Thank you. 

1 hour ago, MullinRJ said:

Hello David,

   I found constants for the Slab Tool (-248) and the Wall End Cap Tool (-355). I did not find constants for the Door or Window tools, but those two can be called with CallToolByName() or SetToolByName(), as Pat mentioned.

 

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...