fernandreu / office-ribbonx-editor

An overhauled fork of the original Custom UI Editor for Microsoft Office, built with WPF
MIT License
526 stars 104 forks source link

Adding Shortcut for Validation #125

Closed skorpio07 closed 3 years ago

skorpio07 commented 3 years ago

Is it possible to add a shortcut for validation (say maybe Ctrl+L). i use autoit and it would be great if i could get that to work.

fernandreu commented 3 years ago

Hi skorpio07, yeah, it should be something fairly easy / quick to do. I'll get it done at some point this week

skorpio07 commented 3 years ago

can you also do Callbacks (Ctrl+K). really appreciate you doing this for me. and thanks for the speedy response. gotta love Git and open source...

fernandreu commented 3 years ago

No problem! I've set those two shortcuts as Ctrl+Shift+V and Ctrl+Shift+C because there are quite a few undocumented Ctrl+Letter shortcuts already so it would cause some issues to anybody already using those. Namely, Ctrl+L deletes an entire line.

The new version should be available in this build... if it doesn't fail. Otherwise, I'll fix it tomorrow.

I'm in the middle of several other changes affecting the way the tool is built, so the files are not getting signed right now. Also, the .NET Framework version is no longer a single executable, but rather a zip file with a bunch of files. It is probably going to stay that way from now on. On the plus side, there are new self-contained .NET 5 artifacts which, although a bit larger in size than the others, they should not require any framework / runtime / etc. installed separately.

skorpio07 commented 3 years ago

thanks fernandreu, can't wait to try out the new version. let me know if it passes muster.

fernandreu commented 3 years ago

Yeah, the build went fine, all binaries are here: https://dev.azure.com/fernandreu-public/OfficeRibbonXEditor/_build/results?buildId=949&view=artifacts&type=publishedArtifacts

skorpio07 commented 3 years ago

just wanted to thank you again for doing this. btw are you aware of AutoIT? it's an automation tool that i am using to side load the xml into an an excel workbook. if you'd like, i could show you a demo of how i am using customui editor...

skorpio07 commented 3 years ago

got a question on the build. when i open the callbacks viewer, i try to do a ctrl+a to select all the text but the focus is not in the editbox. autoit has a controlfocus command but it's not working as expected. can you shed some light on this? or maybe shift the focus so that i can do a control+a combo and grab the callbacks code?

fernandreu commented 3 years ago

Perhaps you can just use the tab key until the text editor is focused? I think you only need one tab, then Ctrl+A already works fine

skorpio07 commented 3 years ago

yup, that did the trick. now i can verify that the xml is formed well, copy the callbacks to notepad and then save it. really appreciate the help with this. couldn't have done it without you!!!

skorpio07 commented 3 years ago

got a question on your undocumented shortcuts. is there one to access the XML Validation Results window? (there is a wealth of information there, could automate fixing the xml if i could copy that to the clipboard [or do a Ctrl+A, Ctrl+C combo])

fernandreu commented 3 years ago

Normally, I'd say everything should be reachable by pressing Tab enough times, but the text editor captures this and adds indentation instead. Can you access UI elements in any way apart from via the keyboard?

The tool contains a lot of useful information that you can use to identify elements, such as automation IDs; this is how I emulate clicks when doing automated UI tests after all. You can check these with a few tools such as:

In particular, that results window has the automation ID ResultsScintilla. So, if you can find an element like that and simulate a click on it, you'll be almost there:

image

The other thing to mention is that, if you can access elements that way, you could also just take the text from the Value property:

image

fernandreu commented 3 years ago

Also, if you really want to go down the automation route, I could try to improve the command line options so that the UI isn't needed at all. Right now, I think you can only open a specific file and that's about it, but I could add more arguments so you can do more of those actions.

Another alternative if you know / don't have any issues learning C# / PowerShell / VB.NET is to access the tool from those languages directly, using the same classes the UI currently uses. I'd recommend C# because it's what I use; however, it requires Visual Studio installed, plus every time you change something you'd need to recompile. MainWindowViewModelTests.cs might be a good example of how this might work. On the other hand, PowerShell can interact with .NET assemblies relatively easily and does not require compilation, or any special tool to work (although I'd recommend VSCode as the IDE).

This would be the most flexible / in-depth approach but, likewise, the most complex. It would work better if I splitted the tool into an .exe containing the actual UI and a .dll containing all those classes underneath, with a documented interface to access / interact with them.

skorpio07 commented 3 years ago

so it looks like i can get the class of the control (at least i think) and can see the Text attribute. if i can copy that, then i will be golden, so no need so far to add to the functionality of the editor. but appreciate you going the extra mile for me.

skorpio07 commented 3 years ago

have a few questions for you re: Editor. I am trying to automate the copy of ribbon code from source to target. issue is the target doesn't have a schema attached so I need to insert it. first, the filename must be double-clicked (no tabbing) and then I can insert the schema via Alt I/enter keyboard shortcut, which picks 2010 so all is good with that. however the schema must be double-clicked before you can paste code in the editor. I am using control Viewer to grab titles and controls but don't see a way of doing this. can you shed some light on this (and maybe a way to work around the issues)?

skorpio07 commented 3 years ago

just an update, got the mouseclick method working and after a few hours of coding was able to make this work without you doing anything. but this brought up another issue in that images being loaded for source workbook don't get transferred to the target workbook. would there be away to have the ability to move the icon's from one container to another?

fernandreu commented 3 years ago

Right now, there is no way of even exporting an icon to a file, so no, dragging them from one file to another is not available either.

I could add those options, but just thinking: if you want that level of fine-tuning, wouldn't it be simpler to automate the work outside the editor instead? By that, I mean unzipping the file, modifying the internal elements you need (or copying them from another unzipped file in this case), then zip it again. Not only you wouldn't have to rely on what the tool can or cannot do, but also it should be a bit faster / reliable than anything involving a GUI. You could open the file in the editor as a last step. You could to that in PowerShell for example.

I guess another option is to have the icons externally somewhere and automate their insertion one by one via the GUI.

skorpio07 commented 3 years ago

i like the last option, having the images in a dedicated folder and then insert them individually. i could check the xml file for 'image=' and get an image count, could compare that and then open the editor and insert them one by one.

thanks for the suggestion, you ROCK!

skorpio07 commented 3 years ago

Hey Fernandreu,

Got a problem with the editor that i don't know how to solve. I have reinstalled, uninstalled, rebooted and still get the issue. It says that 'the process cannot access the file (sometmpname.tmp) because it is being used by another process.

Any ideas on how to solve this?

tmpError

fernandreu commented 3 years ago

Hi, just in case you didn't see it, I answered you in #161. This is just so that I can keep track of what I've fixed a bit better, for release notes and such.

skorpio07 commented 3 years ago

so nope, i just installed newest copy and still the file locking issue with excel. as i said, it opens up word files no problem. now i think i see the problem, it works if i choose a local copy on not one on the network. just copied a xlam from network to local and it worked no problem. so it definently has to do with the network. does that help at all?