First time here? Check out the FAQ!
1

hotkey to swap backslashes with forward slashes?

  • retag add tags

Hi, I am bouncing between all major operating systems all the time and often need to copy/paste file paths into my code for testing. Windows' backslashes have always driven me up the all and I know I can just use raw strings to use them as-is in my python code. But I would much prefer to swap them for forward slashes instead. I can obviously seatch and replace but was wondering if this could be set up as a macro of sorts and tied to a hotkey?

Cheers, frank

frueter's avatar
25
frueter
asked 2022-09-05 16:33:48 -0600
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

1 Answer

0

You can write a script to do this -- take a look at remove_prompts_and_paste() in scripts/editor-extensions.py in Wing's installation directory. That's close to what you want. You can make your own scripts file in scripts/myscripts.py (or any *.py file name) in your Settings Directory (listed in WIng's About box), add your script there, and then do Edit > Reload All Scripts to make it available in Wing. Reload All Scripts is only needed if you added a script file; after that WIng auto reloads changed script files so you can edit, save, and immediately test. You can invoke that script from Edit > Command by Name or bind a key to it in the User Interface > Keyboard > Custom Key Bindings preference.

For more info on extending Wing with Python scripts, see https://wingware.com/doc/scripting/index

Wingware Support's avatar
4k
Wingware Support
answered 2022-09-06 08:06:34 -0600
edit flag offensive 0 remove flag delete link

Comments

Perfect, thanks!

frueter's avatar frueter (2022-09-07 02:51:12 -0600) edit
add a comment see more comments

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss.

Add Answer