StrokesPlus.net
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
soooulp  
#1 Posted : Friday, July 29, 2022 6:00:50 PM(UTC)
soooulp

Rank: Advanced Member

Reputation:

Groups: Moderators, Approved
Joined: 4/23/2020(UTC)
Posts: 161
China

Thanks: 46 times
Was thanked: 23 time(s) in 17 post(s)
It will popup an icons bar with defined functions near the cursor even if you select words, and it can do anything when clicking one icon, the basic actions like launch a program, or handle select text like Copy, Paste, Cut, open a link, search on the browser, translate, or control the media, deal with the files, etc.

It is just a Demo that I haven't designed many icons with actions to show, if you need any actions, add or modify the info in the Object.

First, Such as I add 6 icons info in the imgData Object to show on the Winform bar as well as a set of 6 variables in the varLabel Array.
image is the icon shown on the bar, please create a folder named icons in your S+ path, and add entire image name with the folder as "\\icons\\name"(eg, path+"\\icons\\Rename.png").
tt is the tooltip that shows when the mouse hovers each icon, which use to exhibit the description.
popup is the script to do the action.

Note:
1 It's better if the background of the image is transparent, and I suggest the format of the image like PNG, BMP, etc.
2 The size of the original image suggests 16x16(Need to resize the Label on the Winform) or 22x22(Default)

Second, after editing the icons info into the imgData Object, then adding the icons Click Event with the template with the equal number of icons.

The icons bar will show by a Gesture or a Hotkey, and it can close by clicking the blank area or scrolling, putting the third and fourth part code into the Left Click script, and Scroll script.

Two years ago I posted Whether can S+net popup an icon bar, in which I mentioned the PopClip program on MAC OS that with more than 100 actions inside, and I still think the icons bar is as necessary as the context menu which may show too wider with long text, another reason is that there are many plugins or javascript codes that are efficient, and frequently used in the Browser for searching the selected words.

The insufficient is that the icons bar with edit actions launched by the gesture instead auto recognizes the selected words.
From now on, getting the selected words directly without Copy still seems impossible from different Windows.

I may add transparency backcolor to the form and as an option or with others like transplant and color if someone needs it.

UserPostedImage

Put the first code into Global Actions-Load/Unload
Code:
if(!NativeModules.User32)
{
    var IntPtrT = host.typeOf(clr.System.IntPtr);
    var Int32T = host.typeOf(clr.System.Int32);
    var BooleanT = host.typeOf(clr.System.Boolean);
	
    var user32TB = sp.NativeModule().DefineType("User32", "Class,Public,SequentialLayout,Serializable");

	user32TB.DefinePInvokeMethod("ShowWindow",
								 "user32.dll",
								 [IntPtrT,Int32T], 
								 BooleanT, 
								 "PreserveSig");

    user32TB.DefinePInvokeMethod("SetWindowPos",
								 "user32.dll",
								 [IntPtrT,Int32T,Int32T,Int32T,Int32T,Int32T,Int32T], 
								 BooleanT, 
								 "PreserveSig");

	user32TB.Create();
}


Update:
20220812 Re-define the varLabel labelClick labelMouseEnter labelMouseLeave array
20220807 Update large picture to show in the icons bar
20220806 Set a variable sz that the size of each icon, default 22(shows 22x22)





Put into Left Click script to close the icons bar

Code:
    if(sp.GetStoredBool('shownS1')) {
        try {
            if (sp.WindowFromPoint(sp.GetCurrentMousePoint(), true).ClassName != "WindowsForms10.Window.8.app.0.13965fa_r6_ad1" &&
                sp.WindowFromClassOrTitle("WindowsForms10.Window.8.app.0.13965fa_r6_ad1", "").Process.MainModule.ModuleName == "StrokesPlus.net.exe") {
                sp.StoreBool('shownS1', false);
                sp.WindowFromHandle(sp.GetStoredHandle('formHWDS1')).SendClose();
                sp.DeleteStoredHandle('formHWDS1');
            }
        } catch {}
    }


Scroll script
Code:
        sp.StoreBool('shownS1', false);
        sp.WindowFromHandle(sp.GetStoredHandle('formHWDS1')).SendClose();
        sp.DeleteStoredHandle('formHWDS1');

Edited by user Friday, August 12, 2022 2:28:29 PM(UTC)  | Reason: Not specified

thanks 1 user thanked soooulp for this useful post.
misaki4650 on 8/6/2022(UTC)
misaki4650  
#2 Posted : Saturday, August 6, 2022 12:42:16 PM(UTC)
misaki4650

Rank: Member

Reputation:

Groups: Approved
Joined: 2/21/2021(UTC)
Posts: 16
Japan
Location: nagano

Thanks: 16 times
Was thanked: 1 time(s) in 1 post(s)
Hello.
I am using this Popup an icons bar.
It is a very nice feature as it can be used for more than just browsers.
I also use an add-on for Firefox called swift selection search, can you make it the same size as this icon?
I can't get it to increase in size by changing the numbers in the script.

https://i.imgur.com/jAmXGit.mp4
soooulp  
#3 Posted : Saturday, August 6, 2022 1:03:23 PM(UTC)
soooulp

Rank: Advanced Member

Reputation:

Groups: Moderators, Approved
Joined: 4/23/2020(UTC)
Posts: 161
China

Thanks: 46 times
Was thanked: 23 time(s) in 17 post(s)
Originally Posted by: misaki4650 Go to Quoted Post
Hello.
I am using this Popup an icons bar.
It is a very nice feature as it can be used for more than just browsers.
I also use an add-on for Firefox called swift selection search, can you make it the same size as this icon?
I can't get it to increase in size by changing the numbers in the script.

https://i.imgur.com/jAmXGit.mp4


Thank you for feedback.

I do a little change, and the sz variable in the front is the size of the each icon, just change it to like 36, that will show as 36x36.

Code:
var sz = 22; // The size of the icons to show, default 22x22




thanks 1 user thanked soooulp for this useful post.
misaki4650 on 8/6/2022(UTC)
misaki4650  
#4 Posted : Saturday, August 6, 2022 9:34:22 PM(UTC)
misaki4650

Rank: Member

Reputation:

Groups: Approved
Joined: 2/21/2021(UTC)
Posts: 16
Japan
Location: nagano

Thanks: 16 times
Was thanked: 1 time(s) in 1 post(s)
Now you can use it comfortably.
Thanks for your quick response!!
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.