KnowBrainer Speech Recognition
Decrease font size
Increase font size
Topic Title: Sharing Script to save current vocabulary words to a backup up location, depending on computer
Topic Summary:
Created On: 05/17/2020 02:17 PM
Status: Post and Reply
Linear : Threading : Single : Branch
Keyword
 05/17/2020 02:17 PM
User is offline View Users Profile Print this message

Author Icon
dicdoc
Top-Tier Member

Posts: 207
Joined: 07/31/2014

I Just figured out a relatively reliable way to backup current vocabulary to a backup location, using Getword.exe, which I put in a reference folder (into KB that is).

Since I use DMPE on 3 different computers, for som mysterious reason, althoug I login with the same MS windows profile, the username is not the same. This code takes it into account.

Now if someone has an idea how to save vocabulary without using getword, I'd be glad for help :

 

====== 

Sub Main
Dim WusrName, WusrComputerName, GWFileLocation, GWFilePath, newVocFile, SpecificComputerFolder, BackupFileLocation1, BackupFileLocation2, BackupFile1, BackupFile2 As String
 Dim eng As New DgnEngineControl, Chgt As Integer, CurrTop As String
' gets current vocabulary name into a string
CurrTop = eng.Topic

SetMicrophone 0

WusrName =  Environ ( "username" )  ' returns current windows user name on this computer
WusrComputerName =  Environ ( "COMPUTERNAME" )  ' returns computer name

'msgbox("WusrName : " & WusrName, vbMsgBoxSetForeground)
'msgbox("WusrComputerName : " & WusrComputerName, vbMsgBoxSetForeground)


If WusrComputerName = "COMPUTER1" Then SpecificComputerFolder = "DTH"
If WusrComputerName = "COMPUTER2" Then SpecificComputerFolder = "DTV"
If WusrComputerName = "COMPUTER3" Then SpecificComputerFolder = "SB2"
'msgbox("SpecificComputerFolder : " & SpecificComputerFolder, vbMsgBoxSetForeground) GWFilePath = "C:\Users\"& WusrName & "\AppData\Roaming\KnowBrainer\KnowBrainerCommands\KbBatsAndFiles\" GWFileLocation = GWFilePath & "1-GetWords.exe" 'msgbox("GWFileLocation : " & GWFileLocation) BackupFileLocation1 = "C:\Users\"& WusrName & "\OneDrive - Cabinet de Psychothérapie et de Psychiatrie du Chablais\Voc Dragon\" & SpecificComputerFolder & "\" BackupFileLocation2 = "C:\Users\"& WusrName & "\Documents\Cloud OSMIA Gestion\2-CPPC\IT\Profils\Profil SET\Voc Dragon\" & SpecificComputerFolder & "\" 'msgbox("BackupFileLocation1 : " & BackupFileLocation1, vbMsgBoxSetForeground) 'msgbox("BackupFileLocation2 : " & BackupFileLocation2, vbMsgBoxSetForeground) newVocFile = CurrTop & "-Voc-" & SpecificComputerFolder & "-" & Format (Now, "yyyymmdd-hhmm") 'msgbox("newVocFile : " & newVocFile, vbMsgBoxSetForeground) BackupFile1 = BackupFileLocation1 & newVocFile Clipboard BackupFile1 Wait .3 'msgbox("BackupFile1 : " & BackupFile1, vbMsgBoxSetForeground) ShellExecute GWFileLocation, 1 Wait .3 SendKeys "^v",1 Wait.3 SendKeys "%i",1 ' includes special oral forms Wait.3 SendKeys "%c",1 ' starts getword Wait.3 MsgBox ("Wait end of backup then click OK to backup from 1st location to 2nd", vbMsgBoxSetForeground) Wait .3 BackupFile1 = BackupFile1 & ".txt" BackupFile2 = BackupFileLocation2 & newVocFile & ".txt" 'msgbox(WusrName) FileCopy BackupFile1 , BackupFile2 Wait .5 BackupFileLocation1 = "C:\Users\"& WusrName & "\LOCATION1\Voc Dragon\" & SpecificComputerFolder BackupFileLocation2 = "C:\Users\"& WusrName & "\LOCATION2\Voc Dragon\" & SpecificComputerFolder
'msgbox("BackupFileLocation1 : " & BackupFileLocation1, vbMsgBoxSetForeground) 'msgbox("BackupFileLocation2 : " & BackupFileLocation2, vbMsgBoxSetForeground) ShellExecute BackupFileLocation1, 1 Wait .5 ShellExecute BackupFileLocation2, 1 Wait .5 End Sub


-------------------------

Memory: 16GB Microphone Brand and Model: Rec Mic II Operating System: win 10, latest update; Surface Book 2, Processor (CPU) Type & Speed: I7 8650 Soundcard Brand and Model: none Speech Software: Dragon Medical Practice Edition, french version: 4.0 Using KnowBrainer?: No

Statistics
31594 users are registered to the KnowBrainer Speech Recognition forum.
There are currently 1 users logged in.
The most users ever online was 3936 on 09/08/2015 at 11:44 AM.
There are currently 440 guests browsing this forum, which makes a total of 441 users using this forum.

FuseTalk Standard Edition v4.0 - © 1999-2020 FuseTalk™ Inc. All rights reserved.