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

Notification

Icon
Error

Options
Go to last post Go to first unread
liuxilu  
#1 Posted : Friday, May 22, 2020 7:33:18 AM(UTC)
liuxilu

Rank: Advanced Member

Reputation:

Groups: Translators, Moderators, Approved
Joined: 4/6/2020(UTC)
Posts: 79
China

Thanks: 1 times
Was thanked: 21 time(s) in 21 post(s)
The 'temporary solution' I posted in here is pretty rough and bad, after Yuichi 's reusing my script, I realized I should rewrite it, for not just a 'temporary solution'.
Scripts below may not visible or outdated, please be suject to this: https://gist.github.com/...29ebb643f2c68eba4d737872

Edited by user Friday, May 22, 2020 12:07:51 PM(UTC)  | Reason: Not specified

thanks 1 user thanked liuxilu for this useful post.
Yuichi on 5/23/2020(UTC)
liuxilu  
#2 Posted : Friday, May 22, 2020 9:08:02 AM(UTC)
liuxilu

Rank: Advanced Member

Reputation:

Groups: Translators, Moderators, Approved
Joined: 4/6/2020(UTC)
Posts: 79
China

Thanks: 1 times
Was thanked: 21 time(s) in 21 post(s)
Usage: Syntax: ShowImage(img, pt, border)
For Parameter border:
0 for a bordered window, can adjust size like a normal window.
a number greater than 0 for a window without border, can adjust size by draging at the bottom-right corner.
Both can adjust size by scrolling on.
main function:

Edited by user Monday, May 25, 2020 10:19:33 AM(UTC)  | Reason: Not specified

thanks 1 user thanked liuxilu for this useful post.
sunnyabcd on 5/22/2020(UTC)
liuxilu  
#3 Posted : Friday, May 22, 2020 9:09:23 AM(UTC)
liuxilu

Rank: Advanced Member

Reputation:

Groups: Translators, Moderators, Approved
Joined: 4/6/2020(UTC)
Posts: 79
China

Thanks: 1 times
Was thanked: 21 time(s) in 21 post(s)
Functions used by main function:

Edited by user Monday, May 25, 2020 5:14:55 AM(UTC)  | Reason: resize

thanks 1 user thanked liuxilu for this useful post.
zyxi on 5/22/2020(UTC)
zyxi  
#4 Posted : Friday, May 22, 2020 10:29:40 AM(UTC)
zyxi

Rank: Advanced Member

Reputation:

Groups: Approved
Joined: 3/30/2019(UTC)
Posts: 74
China

Thanks: 8 times
Was thanked: 1 time(s) in 1 post(s)
Dear Liu,could you tell me how to use it ? I want to try it. thanks a lot.
zyxi  
#5 Posted : Friday, May 22, 2020 3:24:40 PM(UTC)
zyxi

Rank: Advanced Member

Reputation:

Groups: Approved
Joined: 3/30/2019(UTC)
Posts: 74
China

Thanks: 8 times
Was thanked: 1 time(s) in 1 post(s)
Dear friend, as you can see, S + cannot perform this function normally on many softwares,
and the screenshots are not placed above other software.
I don't know what went wrong with S + on my win7 system。

UserPostedImage
2014218866  
#6 Posted : Saturday, May 23, 2020 12:42:34 AM(UTC)
2014218866

Rank: Advanced Member

Reputation:

Groups: Approved
Joined: 5/6/2019(UTC)
Posts: 111
China

Thanks: 19 times
Was thanked: 1 time(s) in 1 post(s)
Indeed, the screenshot is not placed on the top of the window,
and S + will prompt an error when using the script.
S + is the latest version 0.3.8.8, in win7

UserPostedImage

See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'Microsoft.ClearScript.V8.V8ScriptEngine'.
at Microsoft.ClearScript.V8.V8ScriptEngine.VerifyNotDisposed()
at Microsoft.ClearScript.V8.V8ScriptEngine.ScriptInvoke[T](Func`1 func)
at Microsoft.ClearScript.ScriptItem.TryWrappedBindAndInvoke(DynamicMetaObjectBinder binder, Object[] wrappedArgs, Object& result)
at Microsoft.ClearScript.ScriptItem.TryWrappedInvokeOrInvokeMember(DynamicMetaObjectBinder binder, ParameterInfo[] parameters, Object[] args, Object& result)
at Microsoft.ClearScript.ScriptItem.TryInvoke(InvokeBinder binder, Object[] args, Object& result)
at CallSite.Target(Closure , CallSite , Object , Object , MouseEventArgs )
at Microsoft.ClearScript.DelegateFactory.ProcShim`3.<>c__DisplayClass5_0.<InvokeTarget>b__0()
at System.Windows.Forms.Control.OnMouseMove(MouseEventArgs e)
at System.Windows.Forms.Control.WmMouseMove(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Loaded Assemblies **************
mscorlib
Assembly Version: 4.0.0.0
Win32 Version: 4.6.1590.0 built by: NETFXREL2
CodeBase: file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/mscorlib.dll

StrokesPlus.net
Assembly Version: 0.3.8.8
Win32 Version: 0.3.8.8
CodeBase: file:///D:/Software/StrokesPlus.net_Portable_0.3.4.7/StrokesPlus.net.exe

System.Windows.Forms
Assembly Version: 4.0.0.0
Win32 Version: 4.6.1590.0 built by: NETFXREL2
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll

System
Assembly Version: 4.0.0.0
Win32 Version: 4.6.1590.0 built by: NETFXREL2
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll

System.Drawing
Assembly Version: 4.0.0.0
Win32 Version: 4.6.1590.0 built by: NETFXREL2
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll

ManagedWinapi
Assembly Version: 0.3.0.0
Win32 Version: 0.3
CodeBase: file:///D:/Software/StrokesPlus.net_Portable_0.3.4.7/ManagedWinapi.DLL

Accessibility
Assembly Version: 4.0.0.0
Win32 Version: 4.6.1590.0 built by: NETFXREL2
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/Accessibility/v4.0_4.0.0.0__b03f5f7f11d50a3a/Accessibility.dll

WindowsInput
Assembly Version: 1.0.7.0
Win32 Version: 1.0.7.0
CodeBase: file:///D:/Software/StrokesPlus.net_Portable_0.3.4.7/WindowsInput.DLL

System.Core
Assembly Version: 4.0.0.0
Win32 Version: 4.6.1590.0 built by: NETFXREL2
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll

System.Configuration
Assembly Version: 4.0.0.0
Win32 Version: 4.6.1590.0 built by: NETFXREL2
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll

System.Xml
Assembly Version: 4.0.0.0
Win32 Version: 4.6.1590.0 built by: NETFXREL2
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll

ClearScript
Assembly Version: 5.5.5.0
Win32 Version: 5.5.5.0
CodeBase: file:///D:/Software/StrokesPlus.net_Portable_0.3.4.7/ClearScript.DLL

System.Security
Assembly Version: 4.0.0.0
Win32 Version: 4.6.1590.0 built by: NETFXREL2
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Security/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Security.dll

System.Windows
Assembly Version: 4.0.0.0
Win32 Version: 4.6.1590.0
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Windows.dll

System.Net
Assembly Version: 4.0.0.0
Win32 Version: 4.6.1590.0
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Net/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Net.dll

System.Net.Http
Assembly Version: 4.0.0.0
Win32 Version: 4.6.1590.0 built by:
Rob  
#7 Posted : Saturday, May 23, 2020 3:01:11 AM(UTC)
Rob

Rank: Administration

Reputation:

Groups: Translators, Members, Administrators
Joined: 1/11/2018(UTC)
Posts: 1,349
United States
Location: Tampa, FL

Thanks: 28 times
Was thanked: 416 time(s) in 354 post(s)
This type of functionality, while very impressive to accomplish in a script(!), is better suited as a plug-in.

ShowDialog() is a blocking call, which can exhaust the script engines as they are waiting until the window is closed before they can finish the script and release the engine for another gesture.

Additionally, the event binding can lead to the errors you're seeing with accessing disposed object - it's simply a lot to try and run via script.

I took the scripts lioxilu# made and put them into a class library project (from here:https://forum.strokesplus.net/posts/t7202findunread-Enhanced-sp-ShowImage).

Here is the source code (loads/builds fine in Visual Studio 2019 Community), as I'm sure based on previous requests, people will want to add more functionality like drawing lines and adding text.

https://www.strokesplus.net/files/ShowImageWithMenu_1.1.zip

In the \ShowImageWithMenu\bin\Debug folder, there is the ShowImageWithMenu.dll plug-in that you can browse to via Add Plug-In in the Settings window.

IMPORTANT: If you download/extract with Windows, the DLL might be blocked. You will need to right-click the DLL and select Properties. In there, you will need to click the Unblock checkbox or button, then click OK.

This runs the image window(s) on their own threads, so you can have multiple open without holding up the script engines. I don't have Windows 7 easily available, so I was only able to test it in Windows 10.

Example code for the Snip Screen Area action/gesture:
Code:
//Delay to ensure S+ has cleared the gesture and hint
sp.Sleep(100); 
//Create a new Bitmap in memory
var memoryImage = new drawing.System.Drawing.Bitmap(action.Bounds.Width, action.Bounds.Height);
//Create a graphics object associated with the bitmap
var memoryGraphics = drawing.System.Drawing.Graphics.FromImage(memoryImage);
//Copy the screen within the bounding rectangle of the drawn gesture area
//I used a square gesture since that seems more intuitive, but it's not neccessary
memoryGraphics.CopyFromScreen(action.Bounds.X, action.Bounds.Y, 0, 0, action.Bounds.Size);
//Copy the image to the clipboard
clip.SetImage(memoryImage);
memoryGraphics.Dispose();
memoryImage.Dispose();

ImageWithMenu.Show(clip.GetImage(), action.Start, 0);

Edited by user Saturday, May 23, 2020 2:12:36 PM(UTC)  | Reason: Updated download to fix date format issue, change to right-click save dialog, update for topmost

liuxilu  
#8 Posted : Saturday, May 23, 2020 3:25:28 AM(UTC)
liuxilu

Rank: Advanced Member

Reputation:

Groups: Translators, Moderators, Approved
Joined: 4/6/2020(UTC)
Posts: 79
China

Thanks: 1 times
Was thanked: 21 time(s) in 21 post(s)
Updated, should fix now.
zyxi  
#9 Posted : Saturday, May 23, 2020 3:32:33 AM(UTC)
zyxi

Rank: Advanced Member

Reputation:

Groups: Approved
Joined: 3/30/2019(UTC)
Posts: 74
China

Thanks: 8 times
Was thanked: 1 time(s) in 1 post(s)
Thank you for your reply, but the screenshot still cannot be placed on the top level, and the save file also prompts that the file name is invalid.
In addition, right-clicking and saving is not better than choosing to save?
liuxilu  
#10 Posted : Saturday, May 23, 2020 3:36:34 AM(UTC)
liuxilu

Rank: Advanced Member

Reputation:

Groups: Translators, Moderators, Approved
Joined: 4/6/2020(UTC)
Posts: 79
China

Thanks: 1 times
Was thanked: 21 time(s) in 21 post(s)
best suited in s+ itself Laugh
liuxilu  
#11 Posted : Saturday, May 23, 2020 3:41:41 AM(UTC)
liuxilu

Rank: Advanced Member

Reputation:

Groups: Translators, Moderators, Approved
Joined: 4/6/2020(UTC)
Posts: 79
China

Thanks: 1 times
Was thanked: 21 time(s) in 21 post(s)
I have no idea then. Works well on my win10.
zyxi  
#12 Posted : Saturday, May 23, 2020 3:51:58 AM(UTC)
zyxi

Rank: Advanced Member

Reputation:

Groups: Approved
Joined: 3/30/2019(UTC)
Posts: 74
China

Thanks: 8 times
Was thanked: 1 time(s) in 1 post(s)
The screenshot does not appear at the top of other software (but at the bottom),
and the picture cannot be saved (it should be better if you right-click and save directly)

UserPostedImage
liuxilu  
#13 Posted : Saturday, May 23, 2020 3:58:18 AM(UTC)
liuxilu

Rank: Advanced Member

Reputation:

Groups: Translators, Moderators, Approved
Joined: 4/6/2020(UTC)
Posts: 79
China

Thanks: 1 times
Was thanked: 21 time(s) in 21 post(s)
I changed my scripts posted at the top, not Rob's plugin.
zyxi  
#14 Posted : Saturday, May 23, 2020 4:08:41 AM(UTC)
zyxi

Rank: Advanced Member

Reputation:

Groups: Approved
Joined: 3/30/2019(UTC)
Posts: 74
China

Thanks: 8 times
Was thanked: 1 time(s) in 1 post(s)
UserPostedImage
liuxilu  
#15 Posted : Saturday, May 23, 2020 4:20:17 AM(UTC)
liuxilu

Rank: Advanced Member

Reputation:

Groups: Translators, Moderators, Approved
Joined: 4/6/2020(UTC)
Posts: 79
China

Thanks: 1 times
Was thanked: 21 time(s) in 21 post(s)
updated
thanks 1 user thanked liuxilu for this useful post.
zyxi on 5/23/2020(UTC)
zyxi  
#16 Posted : Saturday, May 23, 2020 4:33:05 AM(UTC)
zyxi

Rank: Advanced Member

Reputation:

Groups: Approved
Joined: 3/30/2019(UTC)
Posts: 74
China

Thanks: 8 times
Was thanked: 1 time(s) in 1 post(s)
Now it can be used normally, thank you very much, Liu.
In addition, I don't want item 1, item 2, I want to save directly by right-clicking, the original name is the current time (displayed like Rob's plug-in),
is this easy to implement?
liuxilu  
#17 Posted : Saturday, May 23, 2020 5:13:06 AM(UTC)
liuxilu

Rank: Advanced Member

Reputation:

Groups: Translators, Moderators, Approved
Joined: 4/6/2020(UTC)
Posts: 79
China

Thanks: 1 times
Was thanked: 21 time(s) in 21 post(s)
Now with a default date-time file name.
zyxi  
#18 Posted : Saturday, May 23, 2020 5:20:37 AM(UTC)
zyxi

Rank: Advanced Member

Reputation:

Groups: Approved
Joined: 3/30/2019(UTC)
Posts: 74
China

Thanks: 8 times
Was thanked: 1 time(s) in 1 post(s)
https://gist.github.com/liuxilu/8aa619cd29ebb643f2c68eba4d737872
It's great, but can it be saved directly by right-clicking? Instead of right-clicking and selecting "Save file" to save it

Edited by user Saturday, May 23, 2020 5:26:53 AM(UTC)  | Reason: Not specified

liuxilu  
#19 Posted : Saturday, May 23, 2020 5:43:48 AM(UTC)
liuxilu

Rank: Advanced Member

Reputation:

Groups: Translators, Moderators, Approved
Joined: 4/6/2020(UTC)
Posts: 79
China

Thanks: 1 times
Was thanked: 21 time(s) in 21 post(s)
Add this before Application.Run
Code:
    var pic_mouseClick = 
    pic.MouseClick.connect(
    function (sender, args) {
        if (args.Button == Forms.MouseButtons.Right) {
            var env = clr.System.Environment;
            var desktop = env.GetFolderPath(env.SpecialFolder.DesktopDirectory);
            pic.Image.Save(
                `${desktop}\\${clr.System.DateTime.Now.ToString().replace(/[/\*?":<>| ]/g, '_')}.png`, 
                drawing.System.Drawing.Imaging.ImageFormat.Png);
        }
    });

And comment or delete
Code:
menuBlind = ShowImageBindAllMenu(form, pic);

Edited by user Saturday, May 23, 2020 5:52:46 AM(UTC)  | Reason: Not specified

zyxi  
#20 Posted : Saturday, May 23, 2020 5:50:54 AM(UTC)
zyxi

Rank: Advanced Member

Reputation:

Groups: Approved
Joined: 3/30/2019(UTC)
Posts: 74
China

Thanks: 8 times
Was thanked: 1 time(s) in 1 post(s)
Dear, liu, sorry, I did n’t make it clear, I mean skip the selection of this "save file" and the save window will appear directly by right-clicking
liuxilu  
#21 Posted : Saturday, May 23, 2020 6:00:54 AM(UTC)
liuxilu

Rank: Advanced Member

Reputation:

Groups: Translators, Moderators, Approved
Joined: 4/6/2020(UTC)
Posts: 79
China

Thanks: 1 times
Was thanked: 21 time(s) in 21 post(s)
Just one more click.
zyxi  
#22 Posted : Saturday, May 23, 2020 6:12:46 AM(UTC)
zyxi

Rank: Advanced Member

Reputation:

Groups: Approved
Joined: 3/30/2019(UTC)
Posts: 74
China

Thanks: 8 times
Was thanked: 1 time(s) in 1 post(s)
Okay, skip selection of this "save file" and directly enter Figure below by right-clicking

UserPostedImage

2014218866  
#23 Posted : Saturday, May 23, 2020 7:31:20 AM(UTC)
2014218866

Rank: Advanced Member

Reputation:

Groups: Approved
Joined: 5/6/2019(UTC)
Posts: 111
China

Thanks: 19 times
Was thanked: 1 time(s) in 1 post(s)
Thanks to everyone,
but why it can cut two pictures at most, can't take more pictures, unlike Rob's plugin (but the picture can't be on top)
2014218866  
#24 Posted : Saturday, May 23, 2020 9:04:01 AM(UTC)
2014218866

Rank: Advanced Member

Reputation:

Groups: Approved
Joined: 5/6/2019(UTC)
Posts: 111
China

Thanks: 19 times
Was thanked: 1 time(s) in 1 post(s)
UserPostedImage
Rob  
#25 Posted : Saturday, May 23, 2020 2:33:37 PM(UTC)
Rob

Rank: Administration

Reputation:

Groups: Translators, Members, Administrators
Joined: 1/11/2018(UTC)
Posts: 1,349
United States
Location: Tampa, FL

Thanks: 28 times
Was thanked: 416 time(s) in 354 post(s)
Clearly this is a very active thread and request!

I do want to encourage folks to make plug-ins, primarily because there are always going to be special requests and I would like the community to continue to extend StrokesPlus.net. Plus, there are always going to be people who want something to work one way, where another person will want it to work differently. Plug-ins allow everyone to get what they want, where I try to keep things as minimal as possible to ensure the functionality provides the basic needs - otherwise I would end up creating and maintain either multiple versions of functions, or result in the function parameter list to become overly complicated and confusing.

Also, for those who may want to work on plug-ins, it is very easy to do with Visual Studio Community (free). Plus, you can debug while you're testing the plug-in - for example if you add the project's bin/Debug folder to S+ Plug-In search locations, you can build the DLL, click Apply in S+ settings (which reloads the plug-in DLL), then attach to the StrokesPlus.net.exe process and breakpoints will be hit in Visual Studio. Note that due to the low-level hooks, your script should probably call sp.Disable() before the script line that will trigger the breakpoint, otherwise the mouse will lag for several seconds each time you step into a line of code in VS.

So with all of that said, and given the amount of activity here, I've updated sp.DisplayImage in 0.3.8.9 to support right-click save snip (no menu) and optional allowScrollZooming parameter which allows mouse wheel scroll zooming (which also allows API calls to resize form, image stretches).

Code:
sp.DisplayImage(clip.GetImage(), true); //Assumes an image is on the clipboard, enables mouse wheel scroll zooming

I want to thank those of you who came up with a way to actually create a window and bind events! It was really amazing to see and not something I would have thought possible, so even though my update may make the main functionality of the scripts moot (unless someone wants more menu options, etc.), I feel these scripts will serve as a great template for others who may want to create a custom window in the future.
thanks 3 users thanked Rob for this useful post.
Yuichi on 5/23/2020(UTC), 2014218866 on 5/23/2020(UTC), zyxi on 5/23/2020(UTC)
Yuichi  
#26 Posted : Saturday, May 23, 2020 2:41:32 PM(UTC)
Yuichi

Rank: Advanced Member

Reputation:

Groups: Approved
Joined: 9/13/2018(UTC)
Posts: 54
Poland

Thanks: 18 times
Was thanked: 18 time(s) in 13 post(s)
It's nice to see that even my small contribution can make a difference :)
thanks 2 users thanked Yuichi for this useful post.
2014218866 on 5/23/2020(UTC), Rob on 5/23/2020(UTC)
2014218866  
#27 Posted : Saturday, May 23, 2020 3:06:53 PM(UTC)
2014218866

Rank: Advanced Member

Reputation:

Groups: Approved
Joined: 5/6/2019(UTC)
Posts: 111
China

Thanks: 19 times
Was thanked: 1 time(s) in 1 post(s)
Thank you, my friends.
You have made this imaging function possible, which has helped me a lot. Thank you very much, S + has become more perfect on the screenshot.
zyxi  
#28 Posted : Saturday, May 23, 2020 3:16:09 PM(UTC)
zyxi

Rank: Advanced Member

Reputation:

Groups: Approved
Joined: 3/30/2019(UTC)
Posts: 74
China

Thanks: 8 times
Was thanked: 1 time(s) in 1 post(s)
Now S + is so great. All the glory belongs to you, my friends. Thank you very much for making this function possible.
liuxilu  
#29 Posted : Saturday, May 23, 2020 3:56:12 PM(UTC)
liuxilu

Rank: Advanced Member

Reputation:

Groups: Translators, Moderators, Approved
Joined: 4/6/2020(UTC)
Posts: 79
China

Thanks: 1 times
Was thanked: 21 time(s) in 21 post(s)
Haha, we eventually have Rob to do that. BigGrin
BTW, I'm inspired by a PowerShell form script.
lyscop  
#30 Posted : Sunday, May 24, 2020 3:59:43 AM(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)
Aha, S+net updated yesterday, we do not need to create a new window to show the image anymore.

I find it is so interesting as the program named MouseInc, and I still do not know why I need this function. Oh yeah~~
liuxilu  
#31 Posted : Sunday, May 24, 2020 8:35:35 AM(UTC)
liuxilu

Rank: Advanced Member

Reputation:

Groups: Translators, Moderators, Approved
Joined: 4/6/2020(UTC)
Posts: 79
China

Thanks: 1 times
Was thanked: 21 time(s) in 21 post(s)
MouseInc?
lyscop  
#32 Posted : Sunday, May 24, 2020 8:42:53 AM(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)
Yeah, it is a gesture program created by Shuax in china. I think this snip function is original from that.
zzm  
#33 Posted : Sunday, May 24, 2020 5:31:57 PM(UTC)
zzm

Rank: Member

Reputation:

Groups: Approved
Joined: 5/5/2019(UTC)
Posts: 12
China

Thanks: 6 times
Originally Posted by: liuxilu_2 Go to Quoted Post
MouseInc?

Originally Posted by: lyscop Go to Quoted Post
Yeah, it is a gesture program created by Shuax in china. I think this snip function is original from that.

I made a request in this post, which is indeed MouseInc based on shuax
There is still a lack of a window transparency function, which is more perfect if implemented. But it has fully met the demand.
Thank you everybody!

Edited by user Sunday, May 24, 2020 5:47:56 PM(UTC)  | Reason: Not specified

lyscop  
#34 Posted : Monday, May 25, 2020 5:31:21 AM(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)
Aha, I see the update by Liuxilu.

If I set the border as 1, there is no frame anymore, it is so nice.

It is better then the original blue frame that shows by sp.DisplayImage(clip.GetImage(), true);

I have not tested it on Win10, the result on Win7 is OK.
soooulp  
#35 Posted : Saturday, February 27, 2021 5:43:05 AM(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: liuxilu Go to Quoted Post
Usage: Syntax: ShowImage(img, pt, border)
For Parameter border:
0 for a bordered window, can adjust size like a normal window.
a number greater than 0 for a window without border, can adjust size by draging at the bottom-right corner.
Both can adjust size by scrolling on.
main function:




大佬,有空能帮忙看下,Win10中

使用sp.DisplayImage(clip.GetImage(), true);桌面可以保留多个截图窗口

使用ShowImage(clip.GetImage(), action.End,1);有2个窗口的时候就报错

UserPostedImage
liuxilu  
#36 Posted : Tuesday, March 2, 2021 7:41:23 AM(UTC)
liuxilu

Rank: Advanced Member

Reputation:

Groups: Translators, Moderators, Approved
Joined: 4/6/2020(UTC)
Posts: 79
China

Thanks: 1 times
Was thanked: 21 time(s) in 21 post(s)
是这样的,每个窗口占用一个引擎
选项->高级->脚本池容量
thanks 1 user thanked liuxilu for this useful post.
soooulp on 3/2/2021(UTC)
soooulp  
#37 Posted : Tuesday, March 2, 2021 7:43:20 AM(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: liuxilu Go to Quoted Post
是这样的,每个窗口占用一个引擎
选项->高级->脚本池容量



原来这样,大佬牛批
soooulp  
#38 Posted : Thursday, March 4, 2021 11:44:06 AM(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: liuxilu Go to Quoted Post
是这样的,每个窗口占用一个引擎
选项->高级->脚本池容量


大佬求救
定义了一个ShowText函数显示文字,替代Windows的message box
然后参考Rob的显示message box的办法 ,Text prompt when Capslock is activated 在启动里面监控大小写按键,用ShowText显示了文字提示,如何关闭呀


全局动作-启动/退出中
Code:

sp.CreateTimer("CAPSLangWatch", 
               250, 
               250, 
               `
                eval(sp.GetMacroScript("Functions", "ShowText"));

                var infotx = {}
                infotx.tx = ""; 
                infotx.sz =  new Size(0, 0);
                infotx.pt = new Point(0, 0);
                infotx.cl = Color.FromArgb(0,0,0);
                infotx.border = 0; 

                if(sp.IsKeyToggled(vk.CAPITAL)) {
                    infotx.tx = "CAPS Lock is ON";
                    infotx.sz =  new Size(300, 40);
                    infotx.pt = new Point(560, 560);
                    infotx.cl = Color.FromArgb(56,169,255);
                } else if(new Keyboard().GetCurrentKeyboardLayout() == 0x409) {//美国键盘
                    infotx.tx = "En Keyboard ACTIVE";
                    infotx.sz =  new Size(300, 40);
                    infotx.pt = new Point(560, 560);
                    infotx.cl = Color.FromArgb(15,179,98);
                } else if(sp.IsKeyToggled(vk.CAPITAL) && new Keyboard().GetCurrentKeyboardLayout() == 0x409) {
                    //同时打开,显示另一个form,前面2个关闭
                    infotx.tx = "CAPS Lock is ON & En Keyboard ACTIVE";
                    infotx.sz =  new Size(600, 40);
                    infotx.pt = new Point(560, 560);
                    infotx.cl = Color.FromArgb(255,105,180);
                }
                if(infotxa.tx.length > 0) { 
                    ShowText(infotx.tx, infotx.sz, infotx.pt, infotx.cl, infotx.border);
                } else {
                    ShowText.form.Close();                      //如何关闭form
                }
               `
);



宏里面,tx文字,sz尺寸,pt坐标,cl背景颜色,border边框
Code:

function ShowText(tx, sz, pt, cl, border) {
    if (tx== null) return;

    var Forms = forms.System.Windows.Forms;
    if (border == null) border = 0;
    if (border != 0) { pt = new Point(pt.X - border, pt.Y - border); }

    var form = new Forms.Form;
    form.StartPosition = Forms.FormStartPosition.Manual;
    form.FormBorderStyle = (border == 0) ? //border != 0白框
        Forms.FormBorderStyle.None :
        Forms.FormBorderStyle.SizableToolWindow ;
    form.TopMost = true;
    form.ControlBox = false;
    form.ShowInTaskbar = false;
    form.Margin = new Forms.Padding(0);
    if (border != 0) { form.Padding = new Forms.Padding(border); }
    //form.MinimumSize = new Size(200, 40);
    //form.Size = new Size(200, 40);
    //form.Location = new Point(560, 120);
    form.MinimumSize = sz;
    form.Size = sz;
    form.Location = pt;
    form.Opacity = 0.5;
    form.AutoSize = true;
    form.GetType().GetProperty("DoubleBuffered",
        host.flags(clr.System.Reflection.BindingFlags.NonPublic,
        clr.System.Reflection.BindingFlags.Instance))
        .SetValue(form, true);
    form.BackColor = drawing.System.Drawing.SystemColors.HotTrack;

    var text = new Forms.Label();
    text.Anchor = new Forms.AnchorStyles;
    //text.Size = new Size(200, 40);
    text.Size = sz;
    text.Font = new Font("Segoe UI Semibold", 11);
    text.ForeColor = Color.FromArgb(255,255,255);
    //text.BackColor = Color.FromArgb(255,255,255);
    text.BackColor = cl;
    text.Location = new Point(5, 5);
    text.TextAlign = drawing.System.Drawing.ContentAlignment.MiddleCenter;
    text.Text = tx;

    form.Controls.Add(text);
    text.Dock = Forms.DockStyle.Fill;

    var form_shown = 
    form.Shown.connect(
    function (sender, args) {
        form.TopMost = true;
        form.Activate();
    });

    var text_doubleClick =
    text.DoubleClick.connect(
    function (sender, args) {
        form.Close();
    });


    Forms.Application.Run(form);
}
Users browsing this topic
Similar Topics
Snip screen area by Win10 default Snipping Tool based on Enhanced sp.ShowImage (Scripts)
by soooulp 5/6/2021 1:38:53 PM(UTC)
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.