![]() |
KnowBrainer Speech Recognition | ![]() |
Topic Title: Saving files Topic Summary: Looking for code which saves a file to a specified folder Created On: 05/26/2020 11:02 AM Status: Post and Reply |
|
![]() |
![]() |
- Brevitatis | - 05/26/2020 11:02 AM |
![]() |
![]() |
- Alan Cantor | - 05/26/2020 12:31 PM |
![]() |
![]() |
- Brevitatis | - 05/27/2020 04:37 AM |
![]() |
![]() |
- Lunis Orcutt | - 05/26/2020 09:30 PM |
![]() |
![]() |
- Brevitatis | - 05/27/2020 04:39 AM |
![]() |
![]() |
- Alan Cantor | - 05/27/2020 08:36 AM |
![]() |
![]() |
- Brevitatis | - 05/27/2020 11:03 AM |
![]() |
![]() |
- kkkwj | - 05/27/2020 03:24 PM |
![]() |
![]() |
- Alan Cantor | - 05/28/2020 02:20 PM |
![]() |
![]() |
- kkkwj | - 05/29/2020 03:30 AM |
![]() |
![]() |
- Alan Cantor | - 05/29/2020 12:15 PM |
![]() |
![]() |
- kkkwj | - 06/01/2020 12:13 PM |
![]() |
![]() |
- Lunis Orcutt | - 06/01/2020 03:08 PM |
![]() |
![]() |
- newbiecoder | - 06/16/2020 01:22 PM |
![]() |
![]() |
- Karen Willenken | - 07/18/2020 02:21 PM |
![]() |
![]() |
- Matt_Chambers | - 07/18/2020 04:25 PM |
![]() |
![]() |
- Karen Willenken | - 08/15/2020 12:36 PM |
![]() |
|
I've been immersing myself in DNS for weeks because of lockdown but I can't find what I'm looking for! I would like to save a file (usually a Word document) into a folder which I name in the voice instruction. I think ListVar1 has something to do with it but I cannot find any example which shows me how to do it. Anybody any idea?! |
|
|
|
![]() |
|
I haven't tested this. This is for Word, which uses "F12" as "Save As..." Not every program uses this hotkey. I have indicated more general key sequence in the code.
Save To <folders>
SendDragonKeys "{F12}" ' Save As... Wait .3 ' SendDragonKeys "{Alt+f}" ' File menu ' Wait .3 ' SendDragonkeys "a" ' Save As... ' Wait .3 ' SendDragonKeys "o" ' Browse. (This extra step is needed in recent versions of Office) ' Wait .3 Path = Mid(ListVar1, 1, Instr(ListVar1, "|" ) -1 ) SendDragonKeys Path ' You may or may not need to press Enter key at this point to navigate to the folder
<folders> consists of lines like this. The | character separates the spoken form from the written form.
John|c:\users\hello\goodbye\ Budget|c:\users\budget\ Temporary|p:\tmp\ |
|
|
|
![]() |
|
Many thanks indeed Alan for taking the time to message me with your intriguing code! I've not seen this command before (Path =Mid(List....-1) but I'll give it a go and let you know how I get on. Exciting |
|
|
|
![]() |
|
Welcome (See Mission Statement)
Sub Main SetMicrophone 0 'turns microphone off SendKeys "{F12}" 'save as Wait 0.5 ' 1\2 second timeout SendKeys "{Home}" 'moves cursor to beginning of line to avoid removing Word's recomment title Wait 0.5 If ListVar1 = "Documents" Then SendKeys "{%}UserProfile{%}\Documents\" If ListVar1 = "My Documents" Then SendKeys "{%}UserProfile{%}\Documents\" If ListVar1 = "Desktop" Then SendKeys "{%}UserProfile{%}\Desktop\" Wait 0.5 SendKeys "+{End}" 'selects original name TTSPlayString "save as?" 'verbally prompts you Wait 0.5 SetMicrophone 1 'turns microphone back on
Save As <dictation>
Sub Main Str = ListVar1 arrStr = Split(Str," ") For i=0 To UBound(arrStr) word = LCase(Trim(arrStr(i))) word = Replace(word,Mid(word,1,1),Chr(Asc(Mid(word,1,1))-32),1,1) str1 = str1 & word & " " Next SendKeys str1 Wait 1 SendKeys "%s" End Sub
------------------------- Forum Mission Statement |
|
|
|
![]() |
|
Excellent! I'm extremely grateful to you. Take the day off! No I insist.
|
|
|
|
![]() |
|
Brevitatis, |
|
|
|
![]() |
|
Thanks again. That's also very helpful.
I previously tried to navigate between folders by simply recording the number of times I pressed the tab key, but ended up tied up in knots! I hadn't thought of copying the folder paths, despite having regularly used them with the AppBringUp command. it's amazing how easy it is to miss the obvious! |
|
|
|
![]() |
|
Hi Alan, you say you use macros to output path information - do you mean the macro you posted above that has your folders in a Listvar? I am interested in the contents of your "handful of keyboard macros and voice macros to jump around from folder to folder." Would you be willing to post the macro names, functions, and the supporting lists that they use? (I imagine they encode all the folders that you jump around to.)
------------------------- Win10/x64, AMD Ryzen 7 3700X, 64GB RAM, Dragon 15.3, SP 6 PRO, SpeechStart, Office 365, KB 2017, Dragon Capture, Samson Meteor USB Desk Mic, Klim and JUKSTG earbuds with microphones, 3 BenQ 2560x1440 monitors, Microsoft Sculpt Keyboard and fat mouse |
|
|
|
![]() |
|
I currently use two macros to output paths. (There have been times I have had more.) Both macros output the paths to folders that bring me to, or close, to the folders I regularly go to.
Virtually all of the subfolders I navigate to regularly are in this folder. My File Explorer settings combined with my folder-naming convention makes it easy to navigate to the folder I want to open by either typing the first few characters, or if I am using Dragon, by saying the name of the folder. |
|
|
|
![]() |
|
Ah, I see. You get into a FileOpen dialog textbox that wants a path, then use a short keyboard macro to expand and type out the long form of the path you want. Very efficient! I think I'll try that. Heavens knows I spend enough time clicking and up and down folder hierarchies to get to the places I want to go. I had Macro Express installed at one time a year or two ago along with AHK, but I didn't want to invest the time into those tools when I was trying to develop my voice skills and macros. There is so much to learn. Thank you for making yet another educational post! (Someone should write a book on all these kinds of tips that you, PG, Phil, Chuck, Lunis, Lindsay, Rob, (and others) have built up over the years. It's a long, unguided road for a newbie!) ------------------------- Win10/x64, AMD Ryzen 7 3700X, 64GB RAM, Dragon 15.3, SP 6 PRO, SpeechStart, Office 365, KB 2017, Dragon Capture, Samson Meteor USB Desk Mic, Klim and JUKSTG earbuds with microphones, 3 BenQ 2560x1440 monitors, Microsoft Sculpt Keyboard and fat mouse |
|
|
|
![]() |
|
You can use either Macro Express or AutoHotkey to make these kinds of typing shortcuts to output paths. (Or make Dragon commands so you can say them instead of type them.)
In Macro Express, I prefer to use "prefix Shortkeys," which means the initial character (or characters) that are typed signals a macro is about to be activated. (In contrast, a "suffix" Shortkey is triggered by its final character, usually the space-bar, Enter key, or punctuation mark.) I don't recall what prefix-activated typing shortcuts are called in AutoHotkey. But I'm almost sure AutoHotkey supports them. The learning curve for Macro Express is significantly shorter than for AutoHotkey. I found Macro Express fairly easy to figure out. AutoHotkey was more challenging, but it is ultimately more versatile. I use Macro Express 80% or 90% of the time, and AutoHotkey for the remainder. (Not counting Dragon commands....) There is a modest cost for Macro Express, whereas AutoHotkey is free. You can use Macro Express for free for one month. But don't let the cost of Macro Express dissuade you from using it. For me, Macro Express paid for itself (in terms of getting more stuff done quickly and easily) in a day or less. |
|
|
|
![]() |
|
Hi Lunis, I see that you turned the microphone off and on in the script you posted above: ------------------------- Win10/x64, AMD Ryzen 7 3700X, 64GB RAM, Dragon 15.3, SP 6 PRO, SpeechStart, Office 365, KB 2017, Dragon Capture, Samson Meteor USB Desk Mic, Klim and JUKSTG earbuds with microphones, 3 BenQ 2560x1440 monitors, Microsoft Sculpt Keyboard and fat mouse |
|
|
|
![]() |
|
You nailed it. If the TTSPlayString is too loud, it can be heard by your microphone and produce undesired results. We also make a habit of turning the Dragon microphone off and on in circumstances where a command is going to take 10 seconds or more. ------------------------- Forum Mission Statement |
|
|
|
![]() |
|
Probably a better way to do it, but this seems to work for me not only in word but in Adobe. You would have to name the document after the macro runs – but you can dictate that, of course.
Sub Main SendSystemKeys "{alt+f}" Wait 0.3 SendSystemKeys "a" Wait 1.9 SendKeys "C:\Users\Documents\newfolder\"
End Sub |
|
|
|
![]() |
|
On the topic of navigating/typing folders, I have several commands that rely on a list of shortcut phrases, e.g. "Case 1 working papers" and "Case 2 court file". I have commands that have a bunch of lines with this general format:
If ListVar1 = "Case 1 working papers" Then sendkeys "[full folder path of the Case 1 working papers directory" ' for typing the directory address into a File Open or Save dialog box, or into the Windows Explorer address bar or If ListVar1 = "Case 2 court file" Then AppBringUp "[full folder path of the Case 1 working papers directory" ' opens a new instance of the directory in Windows Explorer Alan Cantor's complex list approach is new to me and might work better (easier to update), but as clunky as my commands are, I find them enormously useful. I'd seen complex lists in the Larry Allen book but they use "\" as the delimiter, which obviously doesn't work if your string has backslashes in it. I'll have to try Alan's approach the next time I update my directory lists. |
|
|
|
![]() |
|
Karen, Another option is to set up the List of folder paths using something other than a backslash. For example, I have a command (and used to have a bunch more before I retired) that uses a "." in place of the backslash (you could use an *, I suppose). I have Dragon use the Larry Allen method of extracting everything before the "\", take what is extracted, and use the Replace command to replace all the "." with "\". So an item name would be something like: C:.Users.matth.Box.No-Action Letters\no action letters where I would say something like "explore no action letters" and the command would take "C:.Users.matth.Box.No-Action Letters" and convert it to "C:.Users\matth\Box\No-Action Letters" by using these lines: a=Mid(ListVar1,1,InStr(ListVar1,"\")-1) a=Replace (a, ".", "\") Just another approach. Matt
|
|
|
|
![]() |
|
Thanks, Matt! That's a really good point. I'm in the process of updating my commands now to use this functionality. I have several commands that all rely on the same list -- "get me" triggers an AppBringUp, but sometimes I want to "hyperlink to" something (e.g. in an email to colleagues) or simply "type" one of the items in the list (e.g. in the Save As dialog box). Until now I have not updated these commands as frequently as I'd like because each command had a long list of "if [spoken form] then [function]" commands, each of which had to be updated. Now I can keep the commands the same, and only update the list!
Next step is to develop a script that will allow me to quickly edit the list, which includes a) file paths of folders I might want to access or save to (I have an unusually large number of these because I use a complex, standardized file structure with a different shared directory for each case, rather than saving documents to my "Documents" folders); b) addresses of websites I access fairly frequently; c) fullpaths of files I access frequently (such as Larry Allen's scripting guide). The more frequently I update this list, the more time I will save with my commands. |
|
|
FuseTalk Standard Edition v4.0 - © 1999-2021 FuseTalk™ Inc. All rights reserved.