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

Notification

Icon
Error

Options
Go to last post Go to first unread
liuchina  
#1 Posted : Tuesday, December 22, 2020 2:29:08 AM(UTC)
liuchina

Rank: Advanced Member

Reputation:

Groups: Approved
Joined: 9/26/2018(UTC)
Posts: 73
China
Location: 北京

Thanks: 18 times
Was thanked: 1 time(s) in 1 post(s)
This code does not work and asks for help. Thank you.

On my computer, sp. RunOrActivate ('C:'Windows'System32') works in other scripts, but in ShowPopupMenuEx, it always has error prompts
no


Code:

//For script is running in an action, otherwise use a Point instead of action.End
var popupMenuInfoEx = new PopupMenuInfoEx(action.Start);
popupMenuInfoEx.MenuItems.Add(new PopupMenuItem("System", `sp.RunOrActivate('C:\\Windows\\System32');`));//
popupMenuInfoEx.MenuItems.Add(new PopupMenuItem("-"));
var mnuSubMenu = new PopupMenuItem("Sub Menu");
    mnuSubMenu.SubMenuItems.Add(new PopupMenuItem("Sub Item 1", `sp.MessageBox("Sub Item 1", "Sub Item 1");`));
    var mnuSubSubMenu = new PopupMenuItem("Sub Sub Menu");
        mnuSubSubMenu.SubMenuItems.Add(new PopupMenuItem("Sub Sub Item 1", `sp.MessageBox("Sub Sub Item 1", "Sub Sub Item 1");`));
    mnuSubMenu.SubMenuItems.Add(mnuSubSubMenu);
    mnuSubMenu.SubMenuItems.Add(new PopupMenuItem("Sub Item 2", `sp.MessageBox("Sub Item 2", "Sub Item 2");`));
popupMenuInfoEx.MenuItems.Add(mnuSubMenu);
popupMenuInfoEx.MenuItems.Add(new PopupMenuItem("Last", `sp.MessageBox("Last", "Last");`));
popupMenuInfoEx.MenuItems.Add(new PopupMenuItem("-"));
popupMenuInfoEx.MenuItems.Add(new PopupMenuItem("Close Popup", ""));
sp.ShowPopupMenuEx(popupMenuInfoEx);
sp.MouseMove(new Point(action.Start.X+100, action.Start.Y+150));

Edited by user Wednesday, December 23, 2020 12:43:24 AM(UTC)  | Reason: Not specified

Rob  
#2 Posted : Tuesday, December 22, 2020 8:28:33 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 works fine for me.

Do you get any kind of error message?
Rob Otter  
#3 Posted : Tuesday, December 22, 2020 11:07:15 AM(UTC)
Rob Otter

Rank: Advanced Member

Reputation:

Groups: Approved
Joined: 10/26/2020(UTC)
Posts: 50
Germany
Location: Darmstadt

Thanks: 15 times
Was thanked: 2 time(s) in 2 post(s)
I also don´t have any error with your script - must be something on your machine. I´m running Windows 10 Pro latest.
Btw., nice example, I was not aware of the possibility yet!
liuchina  
#4 Posted : Wednesday, December 23, 2020 12:27:47 AM(UTC)
liuchina

Rank: Advanced Member

Reputation:

Groups: Approved
Joined: 9/26/2018(UTC)
Posts: 73
China
Location: 北京

Thanks: 18 times
Was thanked: 1 time(s) in 1 post(s)
On my computer, sp. RunOrActivate ('C:'Windows'System32') works in other scripts, but in ShowPopupMenuEx, it always has error prompts



no

Edited by user Wednesday, December 23, 2020 12:35:29 AM(UTC)  | Reason: Not specified

Rob  
#5 Posted : Wednesday, December 23, 2020 1:38:57 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)
Ah I see now. Because the string is being passed twice (once in script, once when executed), it has to have special characters escaped twice.

sp.RunOrActivate('C:\\\\Windows\\\\System32');
Code:
var popupMenuInfoEx = new PopupMenuInfoEx(action.Start);
popupMenuInfoEx.MenuItems.Add(new PopupMenuItem("System", `sp.RunOrActivate('C:\\\\Windows\\\\System32');`));//
popupMenuInfoEx.MenuItems.Add(new PopupMenuItem("-"));
var mnuSubMenu = new PopupMenuItem("Sub Menu");
    mnuSubMenu.SubMenuItems.Add(new PopupMenuItem("Sub Item 1", `sp.MessageBox("Sub Item 1", "Sub Item 1");`));
    var mnuSubSubMenu = new PopupMenuItem("Sub Sub Menu");
        mnuSubSubMenu.SubMenuItems.Add(new PopupMenuItem("Sub Sub Item 1", `sp.MessageBox("Sub Sub Item 1", "Sub Sub Item 1");`));
    mnuSubMenu.SubMenuItems.Add(mnuSubSubMenu);
    mnuSubMenu.SubMenuItems.Add(new PopupMenuItem("Sub Item 2", `sp.MessageBox("Sub Item 2", "Sub Item 2");`));
popupMenuInfoEx.MenuItems.Add(mnuSubMenu);
popupMenuInfoEx.MenuItems.Add(new PopupMenuItem("Last", `sp.MessageBox("Last", "Last");`));
popupMenuInfoEx.MenuItems.Add(new PopupMenuItem("-"));
popupMenuInfoEx.MenuItems.Add(new PopupMenuItem("Close Popup", ""));
sp.ShowPopupMenuEx(popupMenuInfoEx);
sp.MouseMove(new Point(action.Start.X+100, action.Start.Y+150));
thanks 1 user thanked Rob for this useful post.
liuchina on 12/23/2020(UTC)
liuchina  
#6 Posted : Thursday, December 24, 2020 12:17:43 AM(UTC)
liuchina

Rank: Advanced Member

Reputation:

Groups: Approved
Joined: 9/26/2018(UTC)
Posts: 73
China
Location: 北京

Thanks: 18 times
Was thanked: 1 time(s) in 1 post(s)
Now, the script is working properly
Thank you Rob
Users browsing this topic
Similar Topics
Specific font characters/glyphs are not rendering in SP, yet visible everywhere else in the system (General Discussion)
by Swagboy69 3/15/2024 12:19:54 PM(UTC)
Help needed, apps fall into ignore list (General Discussion)
by gsom9000 10/8/2023 4:12:50 AM(UTC)
JSON error on startup, settings lost (0.5.7.4) (General Discussion)
by Swagboy69 8/1/2023 10:43:36 PM(UTC)
Laptop , no gestures on some Apps (Bug Reports)
by bossl 7/2/2023 5:17:18 PM(UTC)
After VMware starts up, directly enter the Win7 system (Scripts)
by 2014218866 6/29/2023 9:12:36 AM(UTC)
How to distinguish between the two situations when closing a document?, (General Discussion)
by sery111 4/26/2023 9:12:00 AM(UTC)
Script interactive support, hope someone can help me (Scripts)
by SJqingtan 12/3/2021 3:23:44 PM(UTC)
手势名称相同,无法删除 (Bug Reports)
by Final 11/2/2021 2:24:08 AM(UTC)
Empty "Virtual Key" menus, and "Steps/Scripts" relationship (General Discussion)
by Swagboy69 10/27/2021 2:47:11 PM(UTC)
No script engine is available, discarding script. Try again. (General Discussion)
by berlihingen 9/16/2021 9:07:04 PM(UTC)
Hi, I'm new, please help with these scripts (Scripts)
by Patrick97 6/3/2021 3:44:35 PM(UTC)
如何调整屏幕亮度?问上帝,谢谢 (Feature Requests)
by 该昵称已被注册 5/20/2021 3:46:25 AM(UTC)
Consult the boss, double-click the script in the window. (Scripts)
by Wiki.Joo 5/6/2021 3:21:07 AM(UTC)
Right click double-click mouse ,HELP (Scripts)
by thepromises 3/25/2021 5:30:04 AM(UTC)
Flexible pause, a script I often use. (Scripts)
by liuchina 2/22/2021 12:58:12 AM(UTC)
How to activate a specified Google webpage with a script, I have opened many webpages, and I need to (Steps)
by heart7311 2/20/2021 10:06:57 AM(UTC)
About sp.StoreHistoryScript, it always fails to run (Scripts)
by liuchina 1/26/2021 2:42:37 AM(UTC)
How to pass arguments, use special characters in script (General Discussion)
by Robert "Bob" Belcher, Jr. 12/4/2020 5:18:58 PM(UTC)
Resize windows based on region, holding ALT (Scripts)
by Rob 10/23/2020 7:02:46 PM(UTC)
How can I open a link in background, and how to remove a bookmark (General Discussion)
by soooulp 4/23/2020 4:07:40 PM(UTC)
How to turn off monitor, sleep , hibernate? (Scripts)
by sunnyabcd 4/16/2020 3:53:16 AM(UTC)
Just thanks for your work, Rob! It is great application! (General Discussion)
by kypaku 12/30/2019 8:45:49 PM(UTC)
Hot key, make window always on top? (Feature Requests)
by parrottm 12/12/2019 7:37:33 AM(UTC)
全屏应用时,禁用手势功能 (General Discussion)
by Final 8/14/2019 2:00:42 AM(UTC)
Mouse Events (Hotkeys on X1, X2) sent twice (Bug Reports)
by Roland 6/25/2019 12:27:32 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.