active tool

Moho allows users to write new tools and plugins. Discuss scripting ideas and problems here.

Moderators: Víctor Paredes, Belgarath, slowtiger

Post Reply
User avatar
davoodice2
Posts: 381
Joined: Tue Jun 15, 2021 1:14 pm

active tool

Post by davoodice2 »

Hi friends
is there any way to change moho auto tool selection after select layer?
or activating a tool from script?
خیام اگر ز باده مستی خوش باش
با ماهرخی اگر نشستی خوش باش
چون عاقبت کار جهان نیستی است
انگار که نیستی چو هستی خوش باش
User avatar
synthsin75
Posts: 10009
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: active tool

Post by synthsin75 »

No, not without an external app to hit tool shortcuts. All Lua scripting can do is tell you the active tool: https://mohoscripting.com/methods/1227
User avatar
davoodice2
Posts: 381
Joined: Tue Jun 15, 2021 1:14 pm

Re: active tool

Post by davoodice2 »

synthsin75 wrote: Sun Dec 26, 2021 8:24 pm No, not without an external app to hit tool shortcuts. All Lua scripting can do is tell you the active tool: https://mohoscripting.com/methods/1227
thanks. and
what is benefit of currentTool() ? can you tell me s simple example of usage of that?
خیام اگر ز باده مستی خوش باش
با ماهرخی اگر نشستی خوش باش
چون عاقبت کار جهان نیستی است
انگار که نیستی چو هستی خوش باش
User avatar
synthsin75
Posts: 10009
Joined: Mon Jan 14, 2008 11:20 pm
Location: Oklahoma
Contact:

Re: active tool

Post by synthsin75 »

The create shape and add points tools use it like this:

Code: Select all

	if (moho:CurrentTool() ~= "LM_AddPoint") then
		return -- this could get called when doing a double-tap on a multitouch Wacom device with a different active tool
	end
User avatar
davoodice2
Posts: 381
Joined: Tue Jun 15, 2021 1:14 pm

Re: active tool

Post by davoodice2 »

synthsin75 wrote: Sun Dec 26, 2021 10:06 pm The create shape and add points tools use it like this:

Code: Select all

	if (moho:CurrentTool() ~= "LM_AddPoint") then
		return -- this could get called when doing a double-tap on a multitouch Wacom device with a different active tool
	end
understood thanks.
خیام اگر ز باده مستی خوش باش
با ماهرخی اگر نشستی خوش باش
چون عاقبت کار جهان نیستی است
انگار که نیستی چو هستی خوش باش
Post Reply