Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

How can I match both id and name simultaneously #771

Unanswered
fanaijun asked this question in Q&A
Discussion options

How can I move menu items that are not in the menus_id and whose names do not contain menus_name to more_options ? Just like the code I wrote, but it's completely useless
$menus_id = this.id(
id.new,
id.refresh,
id.undo,
id.redo,
id.delete,
id.properties,
id.open,
id.open_with,
id.run_as_administrator
)

$menus_name = ["zip", "Word", "Excel"]

modify(mode=mode.multiple where=(!menus_id || !str.contains(this.name, menus_name)) menu=title.more_options)

You must be logged in to vote

Replies: 1 comment 7 replies

Comment options

at first glance the logic is not correct:
not(menus_id or contains(this.name, menus_name) or !menus_id and !str.contains(this.name, menus_name)
the usage of !, &&, || is correct

You must be logged in to vote
7 replies
Comment options

In "str.contains", I can achieve this with just one string.
There are many menu items that I want to keep in the main course item and move all the other menu items into more options, but this seems unfeasible. I don't know what other way I can realize my idea.
In addition, using "cmd=io.dir.create('C:\temp')" and "cmd=io.delete('C:\temp')" cannot achieve the creation and deletion of folders in the C drive
modify(mode=mode.multiple where=!menus_id and !str.contains(this.name, "zip") menu=title.more_options)

Comment options

RubicBG Nov 17, 2025
Collaborator

modify(where=len(regex.matches(this.name, '(cut|opy|past|del)'))>0 vis=2)

... and io.dir.create() does not work on restricted paths - use cmd command with admin.
Several people have complained about the same thing recently - maybe Microsoft has changed the way an API works that this function uses. I can make command with "some complex logic" where if io.dir.create fails then the cmd command is called - that way it doesn't have to bring up an admin prompt where it's not necessary, but I don't know if it's worth it.

Comment options

Thank you for your answer, which has solved my difficulty. However, I have a new problem. The right-click menu item of my notepad++ software has turned gray and cannot be clicked. How can I solve this?

Comment options

RubicBG Nov 19, 2025
Collaborator

modify(find='Edit with Notepad++' vis=vis.remove)
Comment options

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants

AltStyle によって変換されたページ (->オリジナル) /