AutoHotkey Community

It is currently May 26th, 2012, 5:08 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 38 posts ]  Go to page Previous  1, 2, 3  Next
Author Message
 Post subject:
PostPosted: November 5th, 2008, 7:32 pm 
Offline

Joined: October 24th, 2007, 10:27 pm
Posts: 24
Thanks for the work,

And thanks for the vocola help.

Also, while we are on the speech recognition thing with AHK.

Does anyone know of a way of interfacing AHK with the vista speech recognition system that comes installed with vista?.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 4th, 2009, 3:42 am 
Offline

Joined: February 20th, 2007, 1:37 pm
Posts: 198
Location: D.C.
Hi all, just wanted to say thanks for this! I'll definitely be trying it out. ATM I just use DNS for dictation into a word processor, accompanying this with a number of ahk hotkeys, with no problems. This looks very promising!!!


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 10th, 2009, 5:33 am 
Offline

Joined: February 20th, 2007, 1:37 pm
Posts: 198
Location: D.C.
Hi everybody, and BY JOVE! I think we have something to celebrate! All drink a toast to the advent of DragonPad2!

IMHO a VAST improvement over DragonPad, and one that allows user to incorporate any command of the entire AHK universe, with spoken words. Does not require Vocola or Natspeak, and it's free. Only problem is you have to learn at least the rudiments of AutoHotKey. :) But this baby is really extensible, and shall be extended, believe me!

DragonPad2 is a basic select-and-say compatible text editor that will initiate commands, triggered by dictated input (NOT Dragon "commands".) And since it's an AHK program, you can incorporate a whole lot more into it than that. And all the hotkeys you like. Enter the DragonPad2.

Suggested usage:

You dicate into DragonPad2, which has basic select-and-say compatibility, unlike most quality text editor programs out there (one of my biggest complaints with DNS) and it can either send the text you've dictated by the press of a hotkey (in this instance Ctrl-Shift-Win-S) or it will send it at timed intervals, here set at every 5 sec.

The 5 sec timed function is not present in DragonPad, and allows continuous dictation to a non-select-and-say program, for one thing. And by using made-up words for different items like speaker IDs, headings, whatever, you can mostly avoid using DNS's clunky commands at all, and let AHK handle that.

If any of the words you've dictated have been set up as commands in this script, they will execute as the text is being sent to your selected word processor program; here, WordPerfect 12. And since DNS allows custom words with arbitrary pronunciations, you can designate commands with any pronunciations. Alternately you may just use whatever words you want to use as commands.

DragonPad2 also appends all Dragon's text to a textfile before interpreting its commands, as I am a belt-and-suspenders kinda guy. The name is tempy.txt and the path is the default working directory.

You put all your command names without spaces in the list at the top called "commandlist," separated by commas

Then add a corresponding command at the bottom of the script, using the syntax for gosub commands.


Win-K to see all hotkeys, which yields this:

---------------------------
Hotkeys and Hotstrings list
---------------------------
Where + = Shift, ^ = Ctrl, and ! = Alt

^+Win-d Activate DragonPad2
^+Win-p Init timed CutNPaste
^+Win-F1 STOP timed CutNPaste
^+Win-s Single instance CutNPaste
Win-k List of Hotkeys

---------------------------
OK
---------------------------


Pls. try it. You will probably need to change the references to WordPerfect to your word processor's ID's and you will need to add your own commands.



Code:
; DragonPad2 -- FREEWARE by ribbet.1 and many others
; who have taught me or provided code I've lifted from, including MikeG and
; most especially Chris

; You are free to distribute this script, modify or compile it, and MAY NOT CHARGE MONEY FOR IT!

; DragonPad2 is  a script using the AutoHotKey scripting engine, a
; software released under the GNU Public License.  For a copy of the
; license, goto:  http://www.autohotkey.com/docs/license.htm

;-----------------------------------------------------
; To add a new command you must type one in here. 
; Some characters are illegal and must be escaped or left unused, such as comma, pipe, or colon.

Commandlist = @1,@2

; Example: Simple text editor with menu bar.

; Create the sub-menus for the menu bar:
Menu, FileMenu, Add, &New, FileNew
Menu, FileMenu, Add, &Open, FileOpen
Menu, FileMenu, Add, &Save, FileSave
Menu, FileMenu, Add, Save &As, FileSaveAs
Menu, FileMenu, Add  ; Separator line.
Menu, FileMenu, Add, E&xit, FileExit
Menu, HelpMenu, Add, &About, HelpAbout
Menu, MyMenuBar, Add, &File, :FileMenu
Menu, MyMenuBar, Add, &Help, :HelpMenu

; Attach the menu bar to the window:
Gui, Menu, MyMenuBar

; Create the main Edit control and display the window:
Gui, +Resize  ; Make the window resizable.
Gui, Add, Edit, vMainEdit WantTab W600 R20
Gui, Show,, DragonPad2
CurrentFileName =  ; Indicate that there is no current file.
return
;-----------------------------------------------------
FileNew:
GuiControl,, MainEdit  ; Clear the Edit control.
return
;-----------------------------------------------------
FileOpen:

Gui +OwnDialogs  ; Force the user to dismiss the FileSelectFile dialog before returning to the main window.
FileSelectFile, SelectedFileName, 3,, Open File, Text Documents (*.txt)
if SelectedFileName =  ; No file selected.
    return
Gosub FileRead
return
;-----------------------------------------------------
FileRead:  ; Caller has set the variable SelectedFileName for us.
FileRead, MainEdit, %SelectedFileName%  ; Read the file's contents into the variable.
if ErrorLevel
{
    MsgBox Could not open "%SelectedFileName%".
    return
}
GuiControl,, MainEdit, %MainEdit%  ; Put the text into the control.
CurrentFileName = %SelectedFileName%
Gui, Show,, DragonPad2   ; Show file name in title bar.
return

FileSave:
if CurrentFileName =   ; No filename selected yet, so do Save-As instead.
    Goto FileSaveAs
Gosub SaveCurrentFile
return
;-----------------------------------------------------
FileSaveAs:
Gui +OwnDialogs  ; Force the user to dismiss the FileSelectFile dialog before returning to the main window.
FileSelectFile, SelectedFileName, S16,, Save File, Text Documents (*.txt)
if SelectedFileName =  ; No file selected.
    return
CurrentFileName = %SelectedFileName%
Gosub SaveCurrentFile
return
;-----------------------------------------------------
SaveCurrentFile:  ; Caller has ensured that CurrentFileName is not blank.
IfExist %CurrentFileName%
{
    FileDelete %CurrentFileName%
    if ErrorLevel
    {
        MsgBox The attempt to overwrite "%CurrentFileName%" failed.
        return
    }
}
GuiControlGet, MainEdit  ; Retrieve the contents of the Edit control.
FileAppend, %MainEdit%, %CurrentFileName%  ; Save the contents to the file.
Gui, Show,, DragonPad2
return
;-----------------------------------------------------
HelpAbout:
Gui, 2:+owner1  ; Make the main window (Gui #1) the owner of the "about box" (Gui #2).
Gui +Disabled  ; Disable main window.
Gui, 2:Add, Text,, Text for about box.
Gui, 2:Add, Button, Default, OK
Gui, 2:Show
return
;-----------------------------------------------------
2ButtonOK:  ; This section is used by the "about box" above.
2GuiClose:
2GuiEscape:
Gui, 1:-Disabled  ; Re-enable the main window (must be done prior to the next step).
Gui Destroy  ; Destroy the about box.
return
;-----------------------------------------------------
GuiDropFiles:  ; Support drag & drop.
Loop, parse, A_GuiEvent, `n
{
    SelectedFileName = %A_LoopField%  ; Get the first file only (in case there's more than one).
    break
}
Gosub FileRead
return
;----------------------------------------------------- 
GuiSize:
if ErrorLevel = 1  ; The window has been minimized.  No action needed.
    return
; Otherwise, the window has been resized or maximized. Resize the Edit control to match.
NewWidth := A_GuiWidth - 20
NewHeight := A_GuiHeight - 20
GuiControl, Move, MainEdit, W%NewWidth% H%NewHeight%
return
;-----------------------------------------------------   
FileExit:     ; User chose "Exit" from the File menu.
GuiClose:      ; User closed the window.
ExitApp
;-----------------------------------------------------
^+#d::  ;;Activate DragonPad2
WinActivate,DragonPad2
Return
;-----------------------------------------------------
^+#p::  ;;Init timed CutNPaste
SetTimer,CutNPaste,5000 ;Change this for more or less frequent CutNpaste
Return
;-----------------------------------------------------
^+#F1::  ;;STOP timed CutNPaste
SetTimer, CutNPaste, Off
Return
;-----------------------------------------------------
^+#s::  ;;Single instance CutNPaste
Gosub,CutNPaste
Return
;-----------------------------------------------------
;Syntax of:
;ControlSend,WPDocClient1,%Commandlist% %A_Space%,ahk_class WordPerfect.12.00
;Controlsend sends text without giving the focus
;WPDocClient1 is the ahk name for the main text window in WP 12, at least on my machine
;%Commandlist% refers to the list at the very top of this script,
;which are in fact also the labels for the Gosubs at the bottom of this script
;ahk_class WordPerfect.12.00 is ahk's name for the Wordperfect 12 window

CutNPaste:
SetKeyDelay, 1, 0
Clipboard =
Winactivate,DragonPad2
ControlSend,Edit1,^a,DragonPad2
ControlSend,Edit1,^x,DragonPad2
MsgBox,Clipboard = %Clipboard%
FileAppend %A_Space%%Clipboard%,Testy.txt
Loop,Parse,Clipboard,%A_Space%
{
Kali = %A_Loopfield%
;MsgBox,Kali = %Kali%
If Kali in %Commandlist%
{
;MsgBox, %Kali%, is in Commandlist
Gosub, %Kali%
}
Else
ControlSend,WPDocClient1,%Kali%%A_Space%,ahk_class WordPerfect.12.00
;This is the word processor you intend to send text to.  In this case it's WordPerfect.
}
Return


@1:
;MsgBox, Command = %Kali%
ControlSend,WPDocClient1,`n{Tab}{Tab}Atty.A:*.{Space}{Space},ahk_class WordPerfect.12.00
Return

@2:
;MsgBox, Command = @2
ControlSend,WPDocClient1,`n{Tab}{Tab}Atty.B:*.{Space}{Space},ahk_class WordPerfect.12.00
Return

;*  GuiClose:
;*  Exit

;-------------------------------
;=== The killswitch shortcut (Ctrl-Alt-Backspace)
^!Backspace::ExitApp
;-------------------------------
#k::  ;;List of Hotkeys
;*******************************************************************************
;(c) by MikeG
; Extract a list of Hotstrings and Hotkeys from this script and display them
;*******************************************************************************
KeyList:
KeyList=
  AutoTrim,off
  Loop,Read,%A_ScriptFullPath%
  {
    Line=%A_LoopReadLine%
    StringLeft,C2,Line,2
; Insert blank lines
    IfEqual,C2,`;`;
    KeyList=%KeyList%`n
; Insert Hotstrings
    IfEqual,C2,`:`:
    {
      StringTrimLeft,Line,Line,2
      StringSplit,Keys,Line,`:
      Keys=%Keys1%               !
      StringLeft,Keys,Keys,15
      StringSplit,Desc,Line,`;
      StringTrimLeft,Desc,Desc%Desc0%,0
      KeyList=%KeyList%%Keys%`t%Desc%`n
    }
; Insert Hotkeys with ;;comments
    IfInString,Line,`;`;,IfInString,Line,`:`:
    {
         StringSplit,Keys,Line,`:
          StringReplace,Keys,Keys1,#,Win-
;*        StringReplace,Keys,Keys,!,Alt-
;*        StringReplace,Keys,Keys,^,Ctrl-
;*        StringReplace,Keys,Keys,+,Shift-
;*        StringReplace,Keys,Keys,,
      Keys=%Keys%               !
      StringLeft,Keys,Keys,15
      StringSplit,Desc,Line,`;
      StringTrimLeft,Desc,Desc%Desc0%,0
      KeyList=%KeyList%%Keys%`t%Desc%`n
    }
  }
  MsgBox,0,Hotkeys and Hotstrings list,Where `+ = Shift`, ^ = Ctrl`, and `! = Alt`n`n%KeyList%
Return
;---------------------------------------------------


I'm looking for DNS users to try this, and AHK coders to help improve this code. I think I got everything right, but I'm a novice an I've only tested it for a little while now. One thing I want to do next is have it read the commands from an external file so I can compile this and still be able to modify it. I have many ideas for improvement and shall be implementing them as I go along. I've heavily commented this script for convenience, and you may feel free to remove comments although the speed improvement won't likely be noticable.

Pls. keep your eye on this one. Very excited here!

:lol: :!: :lol: :!: :lol: :!: :lol: :!:


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 18th, 2009, 7:25 pm 
Offline

Joined: February 20th, 2007, 1:37 pm
Posts: 198
Location: D.C.
Made some improvements. Added a timer, realtime clock, and a word count display, and the timer and realtime clock are used to timestamp the backup textfile with each entry. Made the name more cute too.

Image


Code:
#Persistent
settimer, update_clock, 50
;return

Commandlist = Atty1,Atty2

Dweezil = @%nTime%@%timez%@
Wordcount = 0

; DragonPad2 -- FREEWARE by ribbet.1 and many others
; who have taught me or provided code I've lifted from, including MikeG and
; most especially Chris and SKAN!

; You are free to distribute this script, modify or compile it, and MAY NOT CHARGE MONEY FOR IT! 

; To add a new command you must type one in here. 
; Some characters are illegal and must be escaped or left unused, such as comma, pipe, or colon.

; Example: Simple text editor with menu bar.

; Create the sub-menus for the menu bar:
DateTimeStamp=20061103000000
Menu, FileMenu, Add, &New, FileNew
Menu, FileMenu, Add, &Open, FileOpen
Menu, FileMenu, Add, &Save, FileSave
Menu, FileMenu, Add, Save &As, FileSaveAs
Menu, FileMenu, Add  ; Separator line.
Menu, FileMenu, Add, E&xit, FileExit
Menu, HelpMenu, Add, &About, HelpAbout
Menu, HelpMenu, Add, &Woids, HelpWoids
Menu, ActionsMenu, Add, &TimedCutNpaste, TimedCutNpaste
Menu, ActionsMenu, Add, &STOPTimedCutNpaste, STOPTimedCutNpaste
Menu, ActionsMenu, Add, &SingleCutNpaste, SingleCutNpaste
Menu, MyMenuBar, Add, &File, :FileMenu
Menu, MyMenuBar, Add, &Help, :HelpMenu
Menu, MyMenuBar, Add, &Actions, :ActionsMenu
Reset


; Attach the menu bar to the window:
Gui, Menu, MyMenuBar

; Create the main Edit control and display the window:
Gui, +Resize -MaximizeBox  ; Make the window resizable.
Gui, Add,Edit,vMainEdit WantTab x10 y28 w600 h80
Gui, Add, Button, x346 y4 w50 h20 vStartStop gStartStop, Start
Gui, Add, Button, x396 y4 w50 h20 vPauseResume gPauseResume, Pause
Gui, Add, Button, x446 y4 w50 h20 vReset gReset, Reset
Gui, Add, Text, x508 y8 w50 h20 +Center, 00:00:00
Gui, Add, Text, x556 y8 w50 h20 +Center, 00:00:00
Gui, Add, Text, x256 y8 w90 h20, 0 Words

Gui, Font, S12 CDefault, Verdana
CurrentFileName =  ; Indicate that there is no current file.
Gui,Tab,2
Gui, Show,, DragonPad²
;return

FileSelectFile,Filn
If Filn =
{
Filn = %A_MM%-%A_DD%-%A_Hour%-%A_Min%.txt
Fileappend, Created %A_MM%-%A_DD%-%A_Hour%-%A_Min%`n,%Filn%
MsgBox,The literal textstrings are being saved to `n%A_Workingdir%%Filn%`n
Return
}
Else
Return
;-----------------------------------------------------
FileNew:
GuiControl,, MainEdit  ; Clear the Edit control.
return
;-----------------------------------------------------
FileOpen:
Gui +OwnDialogs  ; Force the user to dismiss the FileSelectFile dialog before returning to the main window.
FileSelectFile, SelectedFileName, 3,, Open File, Text Documents (*.txt)
if SelectedFileName =  ; No file selected.
    return
Gosub FileRead
return
;-----------------------------------------------------
FileRead:  ; Caller has set the variable SelectedFileName for us.
FileRead, MainEdit, %SelectedFileName%  ; Read the file's contents into the variable.
if ErrorLevel
{
    MsgBox Could not open "%SelectedFileName%".
    return
}
GuiControl,, MainEdit, %MainEdit%  ; Put the text into the control.
CurrentFileName = %SelectedFileName%
Gui, Show,, DragonPad²   ; Show file name in title bar.
return

FileSave:
if CurrentFileName =   ; No filename selected yet, so do Save-As instead.
    Goto FileSaveAs
Gosub SaveCurrentFile
return
;-----------------------------------------------------
FileSaveAs:
Gui +OwnDialogs  ; Force the user to dismiss the FileSelectFile dialog before returning to the main window.
FileSelectFile, SelectedFileName, S16,, Save File, Text Documents (*.txt)
if SelectedFileName =  ; No file selected.
    return
CurrentFileName = %SelectedFileName%
Gosub SaveCurrentFile
return
;-----------------------------------------------------
SaveCurrentFile:  ; Caller has ensured that CurrentFileName is not blank.
IfExist %CurrentFileName%
{
    FileDelete %CurrentFileName%
    if ErrorLevel
    {
        MsgBox The attempt to overwrite "%CurrentFileName%" failed.
        return
    }
}

GuiControlGet, MainEdit  ; Retrieve the contents of the Edit control.
FileAppend, %MainEdit%, %CurrentFileName%  ; Save the contents to the file.
Gui, Show,, DragonPad²
return
;-----------------------------------------------------
HelpAbout:
Gui, 2:+owner1  ; Make the main window (Gui #1) the owner of the "about box" (Gui #2).
Gui +Disabled  ; Disable main window.
Gui, 2:Add, Text,, Text for about box.
Gui, 2:Add, Button, Default, OK
Gui, 2:Show
return
;-----------------------------------------------------
HelpWoids:
^+#4::
MsgBox,Nookey   Q-tab`nPookey   Period-Q`nCukey   ?-Q`nDookie   -- Q`nPoofer   Period-A`nCufer   ?-A`nDoofer   -- A`nNoofer   Just A`nDada   Just Period`nDaCue   Just ?`nDadash   Just --
Return
;-----------------------------------------------------
2ButtonOK:  ; This section is used by the "about box" above.
2GuiClose:
2GuiEscape:
Gui, 1:-Disabled  ; Re-enable the main window (must be done prior to the next step).
Gui Destroy  ; Destroy the about box.
return
;-----------------------------------------------------
GuiDropFiles:  ; Support drag & drop.
Loop, parse, A_GuiEvent, `n
{
    SelectedFileName = %A_LoopField%  ; Get the first file only (in case there's more than one).
    break
}
Gosub FileRead
return
;----------------------------------------------------- 
GuiSize:
if ErrorLevel = 1  ; The window has been minimized.  No action needed.
    return
; Otherwise, the window has been resized or maximized. Resize the Edit control to match.
NewWidth := A_GuiWidth - 20
NewHeight := A_GuiHeight - 34
Button1posw := A_GuiWidth - 295
Button2posw := A_GuiWidth - 245
Button3posw := A_GuiWidth - 195
Static1posw := A_GuiWidth - 133
Static2posw := A_GuiWidth - 85
Static3posw := A_GuiWidth - 385

GuiControl, Move, MainEdit, W%NewWidth% H%NewHeight%
GuiControl, Move, MainEdit2, W%NewWidth% H%NewHeight%
GuiControl, Move, SysTabControl321, W%NewWidth% H%NewHeight%

GuiControl, Move, Button1, x%Button1posw% y4
GuiControl, Move, Button2, x%Button2posw% y4
GuiControl, Move, Button3, x%Button3posw% y4
GuiControl, Move, Static1, x%Static1posw% y8
GuiControl, Move, Static2, x%Static2posw% y8
GuiControl, Move, Static3, x%Static3posw% y8

return
;-----------------------------------------------------   
FileExit:     ; User chose "Exit" from the File menu.
GuiClose:      ; User closed the window.
ExitApp
;-----------------------------------------------------
^+#d::  ;;Activate DragonPad²
WinActivate,DragonPad²
Return
;-----------------------------------------------------
TimedCutNpaste:
^+#p::  ;;Init timed CutNPaste
SetTimer,CutNPaste,5000 ;Change this for more or less frequent cut and send
Return
;-----------------------------------------------------
STOPTimedCutNpaste:
^+#F1::  ;;STOP timed CutNPaste
SetTimer, CutNPaste, Off
Return
;-----------------------------------------------------
SingleCutNpaste:
^+#s::  ;;Single instance CutNPaste
Gosub,CutNPaste
Return
;-----------------------------------------------------
^+#Backspace::  ;;Exit
ExitApp
Return
;-----------------------------------------------------
^+#5::
Winactivate,WordPerfect
Winactivate,DragonPad²
Return
;-----------------------------------------------------
CutNPaste:
SetKeyDelay, -1, 0
Clipboard =
Winactivate,DragonPad²
ControlSend,Edit1,^a,DragonPad²
ControlSend,Edit1,^x,DragonPad²
FileAppend `n%timez%%ntime% -- %A_Space%%Clipboard%,Testy.txt
StringReplace,Clipboard,Clipboard,`n`n,`n,all
StringReplace,Clipboard,Clipboard,%A_Space%%A_Space%,%A_Space%,all
Loop,Parse,Clipboard,%A_Space%
{
Kali = %A_Loopfield%
If Kali in %Commandlist%
{
;MsgBox, %Kali%, is in Commandlist
Gosub, %Kali%
}
Else
ControlSend,WPDocClient1,%Kali%%A_Space%,ahk_class WordPerfect.12.00
;This is the word processor you intend to send text to.  In this case it's WordPerfect.
Durga = %A_Index%
}
Wordcount+=%Durga%
GuiControlGet, Static3
If ( Static3 <> Wordcount )            ; Update the control only when needed
GuiControl,, Static3, %Wordcount% words  ; this avoids flicker
Return
;-----------------------------------------------------
Atty1:
ControlSend,WPDocClient1,`n*%nTime%*%timez%*`n{Tab}{Tab}{Tab}Atty.1:*.{Space}{Space},WordPerfect 12
Return

Atty2:
ControlSend,WPDocClient1,`n*%nTime%*%timez%*`n{Tab}{Tab}{Tab}Atty.2:*.{Space}{Space},WordPerfect 12
Return


;-------------------------------
;=== The killswitch shortcut (Ctrl-Alt-Backspace)
^!Backspace::ExitApp
;---------------------------------------------------

StartStop:

 GuiControlGet, StartStop
 If ( StartStop = "Start" )
  {
     GuiControl,, StartStop, Stop
     SetTimer, Count,990
  }
 Else
  {
     GuiControl,, StartStop, Start
     SetTimer, Count, Off
     GuiControl,, PauseResume, Pause
     DateTimeStamp = 20061103000000

  }
Return
 
PauseResume:

 GuiControlGet, StartStop
 If ( StartStop = "Start" )
     Return
 GuiControlGet, PauseResume
 If ( PauseResume = "Pause" )
  {
     GuiControl,, PauseResume, Resume
     SetTimer, Count, OFF
  }
 Else
  {
     GuiControl,, PauseResume, Pause
     SetTimer, Count, 990
  }
Return

Reset:

  GuiControl,, Static1, 00:00:00
  DateTimeStamp = 20061103000000
Return


Count:

DateTimeStamp += 1, Seconds
FormatTime, nTime, %DateTimeStamp%, HH:mm:ss
GuiControlGet, Static1
If ( Static1 <> nTime )            ; Update the control only when needed
GuiControl,, Static1, %nTime%  ; this avoids flicker
Return

update_clock:

FormatTime, timez,, HH:mm:ss
ControlSetText, Static2,%timez%,DragonPad²
Return

; The updateclock function is courtesy of SKAN -- ONCE AGAIN!

#k::  ;;List of Hotkeys
;*******************************************************************************
;(c) by MikeG
; Extract a list of Hotstrings and Hotkeys from this script and display them
;*******************************************************************************
KeyList:
KeyList=
  AutoTrim,off
  Loop,Read,%A_ScriptFullPath%
  {
    Line=%A_LoopReadLine%
    StringLeft,C2,Line,2
; Insert blank lines
    IfEqual,C2,`;`;
    KeyList=%KeyList%`n
; Insert Hotstrings
    IfEqual,C2,`:`:
    {
      StringTrimLeft,Line,Line,2
      StringSplit,Keys,Line,`:
      Keys=%Keys1%               !
      StringLeft,Keys,Keys,20
      StringSplit,Desc,Line,`;
      StringTrimLeft,Desc,Desc%Desc0%,0
      KeyList=%KeyList%%Keys%`t`t%Desc%`n
    }
; Insert Hotkeys with ;;comments
    IfInString,Line,`;`;,IfInString,Line,`:`:
    {
      StringSplit,Keys,Line,`:
      StringReplace,Keys,Keys1,#,Win-
      StringReplace,Keys,Keys,!,Alt-
      StringReplace,Keys,Keys,^,Ctrl-
      StringReplace,Keys,Keys,+,Shift-
      StringReplace,Keys,Keys,`;,
      Keys=%Keys%               !
      StringLeft,Keys,Keys,20
      StringSplit,Desc,Line,`;
      StringTrimLeft,Desc,Desc%Desc0%,0
      KeyList=%KeyList%%Keys%`t`t%Desc%`n
    }
  }
  MsgBox,0,Hotkeys and Hotstrings list,%KeyList%
Return
;---------------------------------------------------
^+#o::ListHotKeys



Ongoing issues:
The characters ^,+,#, and !, being crucial operators in the AHK language, do not transcribe properly here. They were showing up as nothing, and after reading up a bit on it in these forums, especially this thread ( http://www.autohotkey.com/forum/viewtop ... c&start=15 ) I've just done a crude workaround so far. The characters ^,+,#, and !, will be replaced with the tokens @1, @2, @3, @4 for the present. For me, if I'm using this little program to transcribe with Dragon, I'm seldom going to dictate those symbols anyway so it's not crucial.

Biggest issue is that I want to change this program so instead of cutting the entire contents of the main edit window in order to send them I'd like to just copy them. Seems simple but it's not. If I could do that you could use Dragon's "correction" on your dictated text for a longer time period. But I have not come up with a way to do this that's fast enough for practical usage yet. The best I have so far is like this -- replace the function CutNpaste with the following:
Code:
CutNPaste:
SetKeyDelay, 1, 0
Clipboard =
Winactivate,DragonPad²
ControlSend,Edit1,^a,DragonPad²
ControlSend,Edit1,^c,DragonPad²
ControlSend,Edit1,{End},DragonPad²
Stringreplace,Clipboard,Clipboard,`n,%A_Space%n%A_Space%,All
Loop,Parse,Clipboard,`n%A_Space%,%A_Space%
Yuga = %A_Index%
;Loop,Parse,Clipboard,`n,`n
;Dharma = %A_Index%
;Yuga+=%Dharma%
MsgBox,Yuga %Yuga% -- Wordcount %Wordcount%
If Yuga <= %Wordcount%
Return
Else
If Yuga > %Wordcount%
Yuga-=%Wordcount%
MsgBox,New Yuga is %Yuga%
Winactivate,DragonPad²
Sendinput,^{End}
Loop,%Yuga%
{
Sendinput,^+{Left}
;Sleep,100
}
FileAppend `n%timez%%ntime% -- %A_Space%%Clipboard%,Testy.txt
Stringreplace,Clipboard,Clipboard,`^,@1,A
Stringreplace,Clipboard,Clipboard,`+,@2,A
Stringreplace,Clipboard,Clipboard,`!,@3,A
Stringreplace,Clipboard,Clipboard,`{,@4,A
Stringreplace,Clipboard,Clipboard,`},@5,A
 
Loop,Parse,Clipboard,`n%A_Space%,%A_Space%`n
{
Kali = %A_Loopfield%
;MsgBox,Kali = %Kali%
If Kali in %Commandlist%
{
;MsgBox, %Kali%, is in Commandlist
Gosub, %Kali%
}
Else
ControlSend,WPDocClient1,%Kali%%A_Space%,ahk_class WordPerfect.12.00
;This is the word processor you intend to send text to.  In this case it's WordPerfect.
Durga = %A_Index%
}
Wordcount+=%Yuga%
GuiControlGet, Static3
If ( Static3 <> Wordcount )            ; Update the control only when needed
GuiControl,, Static3, %Wordcount% words  ; this avoids flicker

Return


And you will see it's not fast enough, partly because I'm sending my finished text to WordPerfect, which requires a slow setkeydelay AFAIK.

Subsequently, DragonPad² is not really a text editor, but really a fancy text entry box. I'd like to give it more real text editor features but not quite there yet. It will provide the functionality I wanted it to however; that of adding the power of AHK to Dragon Naturally Speaking, and thereby giving you advanced macro power with the preferred version.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 8th, 2009, 9:26 pm 
Offline

Joined: June 11th, 2005, 9:34 am
Posts: 264
Location: England ish
Thank you for this, I'll be trying this out.

I'm quite new at using Dragon, and . Iam still trying stuff out


it seems like it's not more about you teaching the program to recognise your voice, but more about youlearning how to dictate into the program...

Leo

P.S I typed this using Dragon naturally speaking

_________________
::
I Have Spoken
::


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 9th, 2009, 3:25 pm 
TheLeO wrote:
Thank you for this, I'll be trying this out.

I'm quite new at using Dragon, and . Iam still trying stuff out


it seems like it's not more about you teaching the program to recognise your voice, but more about youlearning how to dictate into the program...

Leo

P.S I typed this using Dragon naturally speaking


Leo! I am about to post an improved version of this, adn it does need some improvement. You might want to hang on for a day or two until I can post it. Right now I'm having a family emergency and can't do anything.

Ribbet.1


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 10th, 2009, 7:24 pm 
Offline

Joined: February 20th, 2007, 1:37 pm
Posts: 198
Location: D.C.
Hi, I've done some much needed improvements to my little DragonPad² project, and I think it works much better now. And for demonstration purposes, this instance of the script now sends its text to notepad, so it should be easier for anybody to try it quickly and easily.
...

The basic idea is this: You dictate to Dragon, and set the focus on DragonPad². It copies any text in its edit box to a variable, and then reads that variable, passing any text to (in this case) Notepad. In the event that variable contains any word that's been designated as a command, it executes that command instead of passing it through as text.

It performs this way either on a one-time basis that you can repeat as desired (which has a couple of uses outside of Dragon dictation) or on a regular timed basis, where it checks the edit field every 250ms, and if it finds it isn't empty, performs the function and then loops back again.

All text dictated to DragonPad² is both appended to a timestamped logfile, and to a variable. When finished dictating, you may view everything you have dictated by pressing f4, and after a brief pause, everything you've dictated or typed into DragonPad²'s edit field will display there, from the variable. To clear that variable, press f5.

You can assign any word whatsoever to an AHK command, by adding it to the command list, and creating a gosub for that command. See the example script. When Dragon types the command into DragonPad2, said command is executed.

Additional features include :

* all text from edit field being appended to a textfile, with timestamps.
* Numerical stamps or optionally timestamps appended to any command. See my examples.
* When you stop the timed cutnpaste, it now puts all the text you've sent to Dragonpad2 back in the edit field.
* Built in timer and word count display.

Usage:

Quick demo:

Start the script, go through the textfile creation dialog (in a hurry you can just keep pressing escape and it will do it all for you.) It will create a file called deleme.txt and open it in Notepad. If not, you need to do this yourself. Then press rctrl-numpad2 to activate DragonPad², and type or dictate some words and then @1 @2 @3 @4 @5 @6 into DragonPad² and then hit Ctrl-numpad0. Watch it work, and then press f4. Take a look at the results.

Or the long version:

Start the script. You should have no problem if you compile it, either. It will open a dialog to create a backup textfile. Eiher name the textfile or let it do that for you. The default is activedir/%A_MM%-%A_DD%-%A_Hour%-%A_Min%.txt
DragonPad² will also open an instance of notepad, and create a file named deleme.txt for it to dictate to by default. You can easily reconfigure it to send to any other word processor instead.

Activate DragonPad² by selecting it or by pressing Ctrl-1 or Ctrl-2. Ctrl-1 displays a messagebox reminding you to do whatever you need to before dictating, such as putting Dragon in "dictate" mode (highly recommended).

Start the timer by pressing the "start" button. When ready to dictate, press "timedcutnpaste" on the menu bar, or else press Ctrl-numpad0.

When DragonPad² has focus, you can dictate directly into it, and any command on the commandlist will be executed as a command instead of passed through as text. I have created 6 examples: @1,@2,@3,@4,@5,@6, and each one demonstrates a couple built-in features and limitations of this program.

When you want to pause DragonPad² you can either press "pause" or f4, or on the menubar, select actions>stoptimedcutnpaste. There will be a brief pause, and then everything you have dictated to it will display in the edit field. To re-send it, re-start timed cutnpaste again. To clear it, press f5, or reload the script.

Train Dragon for a few words. Replace the words in the commandlist, add the desired commands in the gosub section, and test them. Standard AHK syntax rules here.

Problems/bugs:


* The word count includes spaces right now. I aim to fix this soon. Does not affect basic functioning in any way.

* Basically, DragonPad² was designed for being dictated to with Dragon, and so if you manually enter text, you may see some spurious results. Dragon sends words as whole words, so when dictating the timed cutnpaste will not send incomplete words -- not so for typing and timed cutnpaste. A simple solution if you are typing into it for some reason, like testing, is to use the cutnpaste that is not timed, when you are done typing. And several things you would normally type need to be sent in the form of commands instead.

* DragonPad2 will not pass through the symbols {,},^,+,#,!, and probably one or two others I've forgotten, as they are AHK code symbols and AHK reads them as such. The workaround for this was more extensive than I wanted to undertake so far. A number of simple workarounds are available but I didn't want to clutter up the demo version any worse than it is already.

* At present, DragonPad² is not good at reading and sending carriage returns to the target program, and if you have a carriage return before a command, the command may get passed as text instead or may not get executed. I don't anticipate dictating carriage returns, and so I didn't design it for that. The solution is to create a carriage return command for DragonPad² to execute a carriage return in the word processor that you are sending to, rather than in DragonPad² itself. That is to say, do not dictate "New Line" to DragonPad² but rather dictate some made-up word like "dookie" and create an entry in the commandlist, and create a command that looks like:

Code:
dookie:
Controlsend,Edit1,`n *Now we are on a new line*,deleme.txt - Notepad
Return


* Due to the current typing rate of my keyboard, I have been forced to use a setkeydelay setting of 1,1 which is pretty slow. At the default setting, there are errors and bad capitalizations. In all likelihood this will never be an issue when dictating, even at the setting of 1,1, because it's pretty rare that you will dictate that fast for any duration. And DragonPad² does keep it all in a buffer, so any lag in transmission between DragonPad² and your target word processor is not lost, even if you don't see it right away.

;-----------------------------------------------------

The overall purpose of this program is to extend the potential of Dragon Naturally Speaking, to dictate with DNS at a higher speed. and to provide an alternative way of sending commands, including "text commands" without the 1/2-second pause you always get with Dragon while it executes a command. (Or at least you do with the Preferred version. I can't speak to the "Pro" version.) And of course, like Dragon's own DragonPad, another important use of this program is to allow one to dictate freely to programs that are not "select and say compliant," which is pretty much anything but Windows native applications and WordPerfect, and Mozilla. Using this program, for instance, I can now dictate to my favorite text editor, Textpad. I could not before.

Todo:
Fix the word count
Enable an accurate wpm counter
Rewrite the cutnpaste and timedcutnpaste so they do not cut text from the edit field, but rather read the last words entered. This is important.

Code:
#Persistent
settimer, update_clock, 50
;return

; Grier = 1
Commandlist = @0,@1,@2,@3,@4,@5,@6
Wordcount = 0

; DragonPad2 -- FREEWARE by ribbet.1 and many others
; who have taught me or provided code I've lifted from,
; most especially Chris and SKAN!

; You are free to distribute this script, modify or compile it, and MAY NOT CHARGE MONEY FOR IT! 

; A minor note of apology for my use of religious terminology for my variables.  I am very much in love with the dieties of the Hindu pantheon, and that is why I used them.  There is no offense intended.

; To add a new command you must type one in here. 
; Some characters are illegal and must be escaped or left unused, such as comma, pipe, or colon.

; This program is initially based on the 'simple text editor with menu bar,' provided at the ahk website, nothing more.

; Create the sub-menus for the menu bar:
DateTimeStamp=20061103000000
Menu, FileMenu, Add, &New, FileNew
Menu, FileMenu, Add, &Open, FileOpen
Menu, FileMenu, Add, &Save, FileSave
Menu, FileMenu, Add, Save &As, FileSaveAs
Menu, FileMenu, Add  ; Separator line.
Menu, FileMenu, Add, E&xit, FileExit
Menu, HelpMenu, Add, &About, HelpAbout
Menu, HelpMenu, Add, &Woids, Helpwords
Menu, ActionsMenu, Add, &TimedCutNpaste, TimedCutNpaste
Menu, ActionsMenu, Add, &STOPTimedCutNpaste -- F4, STOPTimedCutNpaste
Menu, ActionsMenu, Add, &SingleCutNpaste -- Ctrl-Shift-Win-v, SingleCutNpaste
;Menu, StopwatchMenu, Add, &StartStop, StartStop
;Menu, StopwatchMenu, Add, &PauseResume, PauseResume
Menu, MyMenuBar, Add, &File, :FileMenu
Menu, MyMenuBar, Add, &Help, :HelpMenu
Menu, MyMenuBar, Add, &Actions, :ActionsMenu
Menu, MyMenuBar, Add, &TimedCutNpaste, TimedCutNpaste
;Menu, MyMenuBar, Add, &Actions, :Actions
;Menu, StopwatchMenu, Add, &Stopwatch, StartStopwatch
;Menu, MyMenuBar, Add, &Stopwatch, StartStopwatcher
;Menu, StopwatchMenu, Add, &Reset, Reset


; Attach the menu bar to the window:
Gui, Menu, MyMenuBar

; Create the main Edit control and display the window:
Gui, +Resize -MaximizeBox  ; Make the window resizable.
;Gui, Add, Tab2,w600 h80,Main||Non-Main
Gui, Add,Edit,vMainEdit WantTab x10 y28 w600 h80
Gui, Add, Button, x326 y4 w50 h20 vStartStop gStartStop, Start
Gui, Add, Button, x376 y4 w50 h20 vPauseResume gPauseResume, Pause
Gui, Add, Button, x426 y4 w50 h20 vReset gReset, Reset
Gui, Add, Text, x508 y8 w50 h20 +Center, 00:00:00
Gui, Add, Text, x556 y8 w50 h20 +Center, 00:00:00
Gui, Add, Text, x256 y8 w90 h20, 0 Words

Gui, Font, S12 CDefault, Verdana
CurrentFiln =  ; Indicate that there is no current file.
Gui,Tab,2
;Gui, Add,Edit,vMainEdit2 WantTab x10 y28 w600 h80
Gui, Show,, DragonPad²
;return
;-----------------------------------------------------
; This simply creates a text editor to for DragonPad² to send text to.  You will probably want to replace it with your favorite text editor, such as Word, WP, Textpad, whatever floats your boat.
Fileappend, Created %A_MM%-%A_DD%-%A_Hour%-%A_Min%,deleme.txt
Sleep,500
Run, Notepad.exe deleme.txt
FileSelectFile,CurrentFiln
;-----------------------------------------------------
; This creates a textfile that all strings are sent to, as sort of a backup.  In the event DragonPad² has a problem, you can still have this, and in fact you can paste it into DragonPad² and send it to your text editor again.

If CurrentFiln =
{
CurrentFiln = %A_MM%-%A_DD%-%A_Hour%-%A_Min%.txt
Fileappend, Created %A_MM%-%A_DD%-%A_Hour%-%A_Min%`n,%CurrentFiln%
MsgBox,The literal textstrings are being saved to `n%A_Workingdir%\%CurrentFiln%`n
FullCurFiln = %A_Workingdir%\%CurrentFiln%
MsgBox,%FullCurFiln%
WinActivate,DragonPad²
Return
}
Else
MsgBox,%CurrentFiln%
WinActivate,DragonPad²
Return 
;-----------------------------------------------------
FileNew:
GuiControl,, MainEdit  ; Clear the Edit control.
return
;-----------------------------------------------------
FileOpen:
Gui +OwnDialogs  ; Force the user to dismiss the FileSelectFile dialog before returning to the main window.
FileSelectFile, SelectedFileName, 3,, Open File, Text Documents (*.txt)
if SelectedFileName =  ; No file selected.
    return
Gosub FileRead
return
;-----------------------------------------------------
FileRead:  ; Caller has set the variable SelectedFileName for us.
FileRead, MainEdit, %SelectedFileName%  ; Read the file's contents into the variable.
if ErrorLevel
{
    MsgBox Could not open "%SelectedFileName%".
    return
}
GuiControl,, MainEdit, %MainEdit%  ; Put the text into the control.
FullCurFiln = %SelectedFileName%
Gui, Show,, DragonPad²   ; Show file name in title bar.
MsgBox,%FullCurFiln%
return

FileSave:
if FullCurFiln =   ; No filename selected yet, so do Save-As instead.
    Goto FileSaveAs
Gosub SaveCurrentFile
return
;-----------------------------------------------------
FileSaveAs:
Gui +OwnDialogs  ; Force the user to dismiss the FileSelectFile dialog before returning to the main window.
FileSelectFile, SelectedFileName, S16,, Save File, Text Documents (*.txt)
if SelectedFileName =  ; No file selected.
    return
FullCurFiln = %SelectedFileName%
Gosub SaveCurrentFile
return
;-----------------------------------------------------
SaveCurrentFile:  ; Caller has ensured that CurrentFiln is not blank.
IfExist %FullCurFiln%
{
    FileDelete %FullCurFiln%
    if ErrorLevel
    {
        MsgBox The attempt to overwrite "%FullCurFiln%" failed.
        return
    }
}


GuiControlGet, MainEdit  ; Retrieve the contents of the Edit control.
FileAppend, %MainEdit%, %FullCurFiln%  ; Save the contents to the file.
Gui, Show,, DragonPad²
MsgBox,%FullCurFiln%
return
;-----------------------------------------------------
HelpAbout:
Gui, 2:+owner1  ; Make the main window (Gui #1) the owner of the "about box" (Gui #2).
Gui +Disabled  ; Disable main window.
Gui, 2:Add, Text,, Text for about box.
Gui, 2:Add, Button, Default, OK
Gui, 2:Show
return
;-----------------------------------------------------
Helpwords:  ;This is a simple textbox I manually add my words from my commandlist into for fast reference.
^#!f1::
Msgbox,Commandlist = @1,@2,@3,@4,@5,@6,
Return
;-----------------------------------------------------
2ButtonOK:  ; This section is used by the "about box" above.
2GuiClose:
2GuiEscape:
Gui, 1:-Disabled  ; Re-enable the main window (must be done prior to the next step).
Gui Destroy  ; Destroy the about box.
return
;-----------------------------------------------------
GuiDropFiles:  ; Support drag & drop.
Loop, parse, A_GuiEvent, `n
{
    SelectedFileName = %A_LoopField%  ; Get the first file only (in case there's more than one).
    break
}
Gosub FileRead
return
;----------------------------------------------------- 
GuiSize:
if ErrorLevel = 1  ; The window has been minimized.  No action needed.
    return
; Otherwise, the window has been resized or maximized. Resize the Edit control to match.
NewWidth := A_GuiWidth - 20
NewHeight := A_GuiHeight - 34
Button1posw := A_GuiWidth - 295
Button2posw := A_GuiWidth - 245
Button3posw := A_GuiWidth - 195
Static1posw := A_GuiWidth - 133
Static2posw := A_GuiWidth - 85
Static3posw := A_GuiWidth - 385

GuiControl, Move, MainEdit, W%NewWidth% H%NewHeight%
GuiControl, Move, MainEdit2, W%NewWidth% H%NewHeight%
GuiControl, Move, SysTabControl321, W%NewWidth% H%NewHeight%
;GuiControl, Move, Tab 2, W%NewWidth% H%NewHeight%


GuiControl, Move, Button1, x%Button1posw% y4
GuiControl, Move, Button2, x%Button2posw% y4
GuiControl, Move, Button3, x%Button3posw% y4
GuiControl, Move, Static1, x%Static1posw% y8
GuiControl, Move, Static2, x%Static2posw% y8
GuiControl, Move, Static3, x%Static3posw% y8

return
;-----------------------------------------------------   
FileExit:     ; User chose "Exit" from the File menu.
GuiClose:      ; User closed the window.
ExitApp
;-----------------------------------------------------
^+#d::  ;;Activate DragonPad²
WinActivate,DragonPad²
Return
;-----------------------------------------------------
pause::pause
;-----------------------------------------------------
STOPTimedCutNpaste:

If stop = 1
stop = 0
Else
stop = 1
ControlSetText,Edit1,%Vishnu%,DragonPad²
return
;-----------------------------------------------------
SingleCutNpaste:
^!#v::  ;;Single instance CutNPaste -- not timed that is :)
Gosub,CutNPaste
Return
;-----------------------------------------------------
^+#Backspace::  ;;Exit
ExitApp
Return
;-----------------------------------------------------
^+#5::
Winactivate,WordPerfect
Winactivate,DragonPad²
Return
;-----------------------------------------------------
CutNPaste:
^#!b::  ;;CutnPaste Single Instance
ControlSend,Edit1,^{end},deleme.txt - Notepad
SetKeyDelay, 1, 0
Clipboard =
Winactivate,DragonPad²
ControlSend,Edit1,^a,DragonPad²
ControlSend,Edit1,^x,DragonPad²
;MsgBox,Clipboard = %Clipboard%
FileAppend `n*%timez%*%ntime%* -- %A_Space%%Clipboard%,Testy.txt
StringReplace,Clipboard,Clipboard,`n`n,`n,all
StringReplace,Clipboard,Clipboard,%A_Space%%A_Space%,%A_Space%,all
Loop,Parse,Clipboard,%A_Space%
{
Kali = %A_Loopfield%
;MsgBox,Kali = %Kali%
If Kali in %Commandlist%
{
;MsgBox, %Kali%, is in Commandlist
Grier++
FileAppend, `n|%Grier%|%timez%%ntime% -- %A_Space%%Kali%,%FullCurFiln%
SetKeyDelay,1,1
Gosub, %Kali%
}
Else
ControlSend,Edit1,%Kali%%A_Space%,deleme.txt - Notepad
;This is the word processor you intend to send text to.  In this case it's WordPerfect.
Durga = %A_Index%
}
Wordcount+=%Durga%
GuiControlGet, Static3
If ( Static3 <> Wordcount )            ; Update the control only when needed
GuiControl,, Static3, %Wordcount% words  ; this avoids flicker
;SetKeyDelay -1,-1
Return
;-----------------------------------------------------
;-----------------------------------------------------
; This is where the commands go. There have to be entries in the commandlist for these to work.

@1:
;MsgBox, Command = @1
ControlSend,Edit1,^{end} `n{Tab}|%Grier%| {Tab} This is some example text.  Please note that the number between the pipes will match the corresponding entry in the backup textfile.  That number is associated with the variable grier and is incremented with every successful cutnpaste.   This can be very useful. To see what it does try doing all of these demo commands and then opening up the backup textfile which would be %FullCurFiln%.deleme.txt.,deleme.txt - Notepad

Return

@2:
;MsgBox, Command = @2
ControlSend,Edit1,^{end} `n{Tab}|%Grier%| {Tab} *%nTime%*%timez%* {Tab} This is a time-stamped example text.  If you didn't start the timer`, you will only see a single time and if you start the timer you will see two. HINT -- You start the timer by pressing the Start button. :){Space}{Space},deleme.txt - Notepad
Return

@3:
;MsgBox, Command = @3
SetKeyDelay, -1, -1
ControlSend,Edit1,^{end} `n{Tab}|%Grier%|{Tab}{f5} -- This is example text being sent to Notepad using the setkeydelay command to speed up input.  In my experience so far this can result in errors such as the wrong letters being capitalized etc.  If you see no errors in this text`, you may be want to experiment with using the -1`,-1 setting.  Otherwise you may have to keep it as I set it`, at 1`,1., deleme.txt - Notepad
SetKeyDelay, 1,1
Return

@4:
;MsgBox, Command = @4
WinActivate, deleme.txt - Notepad
SendInput,^{end} `n{Tab}|%Grier%|{Tab}And this method sends text much faster but it also does not send it in the background.
WinActivate,DragonPad²
Return

@5:
;MsgBox, Command = @5
Blockinput, On
WinActivate, deleme.txt - Notepad
SendInput,^{end} `n{Tab}|%Grier%|{tab}And this is the same method protecting the function with Blockinput.  I have not experimented with using Dragon at the same time as this.  You cannot use the mouse/keyboard while blockinput is on`, and I doubt you can use Dragon either`, but as I said I have not tried yet.
BlockInput, Off
WinActivate,DragonPad²
Return

@6:
;MsgBox, Command = @6
ControlSend,Edit1,^{end} `n{Tab}|%Grier%|{tab}*%nTime%*%timez%* And this should open up your backup textfile. You will see that it resembles a logfile`, and logs commands sent as their command names rather than the resulting text., deleme.txt - Notepad
Run, Notepad.exe %FullCurFiln%
Return

;=== The killswitch shortcut (Ctrl-Alt-Backspace)
^!Backspace::Reload
;---------------------------------------------------

StartStop:

 GuiControlGet, StartStop
 If ( StartStop = "Start" )
  {
     GuiControl,, StartStop, Stop
     SetTimer, Count,990
  }
 Else
  {
     GuiControl,, StartStop, Start
     SetTimer, Count, Off
     GuiControl,, PauseResume, Pause
     DateTimeStamp = 20061103000000

  }
Return
 
PauseResume:

 GuiControlGet, StartStop
 If ( StartStop = "Start" )
     Return
 GuiControlGet, PauseResume
 If ( PauseResume = "Pause" )
  {
     GuiControl,, PauseResume, Resume
     SetTimer, Count, OFF
  }
 Else
  {
     GuiControl,, PauseResume, Pause
     SetTimer, Count, 990
  }
Return

Reset:

  GuiControl,, Static1, 00:00:00
  DateTimeStamp = 20061103000000
Return


Count:

DateTimeStamp += 1, Seconds
FormatTime, nTime, %DateTimeStamp%, HH:mm:ss
GuiControlGet, Static1
If ( Static1 <> nTime )            ; Update the control only when needed
GuiControl,, Static1, %nTime%  ; this avoids flicker
Return

update_clock:

FormatTime, timez,, HH:mm:ss
ControlSetText, Static2,%timez%,DragonPad²
Return

; The updateclock function is courtesy of SKAN -- ONCE AGAIN!
;-----------------------------------------------------

rctrl & numpad1::
MsgBox,Make Sure Dragon is in Dictation Mode.`nTurn on the recording.`nStart the timer.
Send, ^{f12}
WinActivate, deleme.txt - Notepad
WinActivate, DragonPad²
Return

rctrl & numpad2::
WinActivate, deleme.txt - Notepad
WinActivate, DragonPad²
Return

;-----------------------------------------------------
; OK, this new version of timed cutnpaste is working.  Gotta test it further with Dragon. 

TIMEDCUTNPASTE:

rctrl & numpad0::  ;;Init timed CutNPaste
ControlSend,Edit1,^{end},deleme.txt - Notepad
stop = 0
WinActivate, deleme.txt - Notepad
Winactivate, DragonPad²
SetKeyDelay, 1, 1
Loop
{ ;111
Winactivate,DragonPad²
if stop = 1
break
else
Lakshmi =
Loop
{  ;222
if stop = 1
break
else
ControlGetText,Lakshmi,Edit1,DragonPad²
If Lakshmi =
Sleep, 250
else
break
}  ;222
ControlSetText,Edit1,,DragonPad²
Krsna := jaganath . " " . Lakshmi
Vishnu := Krsna
;MsgBox,Lakshmi = %Lakshmi%
FileAppend `n|%grier%| {tab} *%timez%*%ntime%* -- %A_Space%%Lakshmi%,%FullCurFiln%
StringReplace,Lakshmi,Lakshmi,`n`n,`n,all
StringReplace,Lakshmi,Lakshmi,%A_Space%%A_Space%,%A_Space%,all
Loop,Parse,Lakshmi,%A_Space%,%A_Space%
{ ;333
Kali = %A_Loopfield%
;MsgBox,Kali = %Kali%
If Kali in %Commandlist%
{ ;444
Grier++
FileAppend, `n|%Grier%|*%timez%*%ntime%* -- %A_Space%%Kali%,%FullCurFiln%
Sleep,50
Gosub, %Kali%
} ;444
Else
ControlSend,Edit1,%Kali%%A_Space%,deleme.txt - Notepad
;This is the word processor you intend to send text to.  In this case it's Notepad.
Durga = %A_Index%
} ;333
Wordcount+=%Durga%
GuiControlGet, Static3
If ( Static3 <> Wordcount )            ; Update the control only when needed
GuiControl,, Static3, %Wordcount% words  ; this avoids flicker
Sleep, 2000
jaganath := Krsna
If stop = 1
Break
} ;111
ControlSetText,Edit1,%Vishnu%,DragonPad²
ControlSend,Edit1,^{end},DragonPad²
Return

F4::
stop = 1

F5::
ControlSetText,Edit1,,DragonPad²
Vishnu =

Enderz:
;ControlSetText,Edit1,%Vishnu%,DragonPad²
ControlSend,Edit1,^{end},DragonPad²
return



Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 11th, 2009, 7:49 pm 
Offline

Joined: February 20th, 2007, 1:37 pm
Posts: 198
Location: D.C.
Hi, just did a significant improvement and there are more to come. I think I will start a dedicated thread for my little project, and try not to take over the thread entirely.

But I just revised the timed cutnpaste function so it no longer cuts existing text out of the edit field when passing it through to your word processor. Which mean that you can stop the timed cutnpaste and use dragon to make corrections; thereby training Dragon. This was a crucial fix, and I'm very pleased that I finally figured out how to do it. So once again, improved (and not for the last time either!) :

Code:
#Persistent
settimer, update_clock, 50
;return

; Grier = 1
Commandlist = @0,@1,@2,@3,@4,@5,@6
Wordcount = 0

; DragonPad2 -- FREEWARE by ribbet.1 and many others
; who have taught me mro provided code I've lifted from,
; most especially Chris and SKAN!

; You are free to distribute this script, modify or compile it, and MAY NOT CHARGE MONEY FOR IT! 

; A minor note of apology for my use of religious terminology for my variables.  I am very much in love with the dieties of the Hindu pantheon, and that is why I used them.  There is no offense intended.

; To add a new command you must type one in here. 
; Some characters are illegal and must be escaped or left unused, such as comma, pipe, or colon.

; This program is initially based on the 'simple text editor with menu bar,' provided at the ahk website, nothing more.

; Create the sub-menus for the menu bar:
DateTimeStamp=20061103000000
Menu, FileMenu, Add, &New, FileNew
Menu, FileMenu, Add, &Open, FileOpen
Menu, FileMenu, Add, &Save, FileSave
Menu, FileMenu, Add, Save &As, FileSaveAs
Menu, FileMenu, Add  ; Separator line.
Menu, FileMenu, Add, E&xit, FileExit
Menu, HelpMenu, Add, &About, HelpAbout
Menu, HelpMenu, Add, &Woids, Helpwords
Menu, ActionsMenu, Add, &TimedCutNpaste, TimedCutNpaste
Menu, ActionsMenu, Add, &STOPTimedCutNpaste -- F4, STOPTimedCutNpaste
Menu, ActionsMenu, Add, &SingleCutNpaste -- Ctrl-Shift-Win-v, SingleCutNpaste
Menu, MyMenuBar, Add, &File, :FileMenu
Menu, MyMenuBar, Add, &Help, :HelpMenu
Menu, MyMenuBar, Add, &Actions, :ActionsMenu
Menu, MyMenuBar, Add, &TimedCutNpaste, TimedCutNpaste

; Attach the menu bar to the window:
Gui, Menu, MyMenuBar

; Create the main Edit control and display the window:
Gui, +Resize -MaximizeBox  ; Make the window resizable.
;Gui, Add, Tab2,w600 h80,Main||Non-Main
Gui, Add,Edit,vMainEdit WantTab x10 y28 w600 h80
Gui, Add, Button, x326 y4 w50 h20 vStartStop gStartStop, Start
Gui, Add, Button, x376 y4 w50 h20 vPauseResume gPauseResume, Pause
Gui, Add, Button, x426 y4 w50 h20 vReset gReset, Reset
Gui, Add, Text, x508 y8 w50 h20 +Center, 00:00:00
Gui, Add, Text, x556 y8 w50 h20 +Center, 00:00:00
Gui, Add, Text, x256 y8 w90 h20, 0 Words

Gui, Font, S12 CDefault, Verdana
CurrentFiln =  ; Indicate that there is no current file.
Gui,Tab,2
;Gui, Add,Edit,vMainEdit2 WantTab x10 y28 w600 h80
Gui, Show,, DragonPad²
;return
;-----------------------------------------------------
; This simply creates a text editor to for DragonPad² to send text to.  You will probably want to replace it with your favorite text editor, such as Word, WP, Textpad, whatever floats your boat.
Fileappend, Created %A_MM%-%A_DD%-%A_Hour%-%A_Min%,deleme.txt
Sleep,500
WinActivate, Notepad.exe deleme.txt ;was a run command but I changed it for testing purposes
FileSelectFile,CurrentFiln
;-----------------------------------------------------
; This creates a textfile that all strings are sent to, as sort of a backup.  In the event DragonPad² has a problem, you can still have this, and in fact you can paste it into DragonPad² and send it to your text editor again.

If CurrentFiln =
{
CurrentFiln = %A_MM%-%A_DD%-%A_Hour%-%A_Min%.txt
Fileappend, Created %A_MM%-%A_DD%-%A_Hour%-%A_Min%`n,%CurrentFiln%
MsgBox,The literal textstrings are being saved to `n%A_Workingdir%\%CurrentFiln%`n
FullCurFiln = %A_Workingdir%\%CurrentFiln%
;MsgBox,%FullCurFiln%
WinActivate,DragonPad²
Return
}
Else
WinActivate,DragonPad²
Return 
;-----------------------------------------------------
FileNew:
GuiControl,, MainEdit  ; Clear the Edit control.
return
;-----------------------------------------------------
FileOpen:
Gui +OwnDialogs  ; Force the user to dismiss the FileSelectFile dialog before returning to the main window.
FileSelectFile, SelectedFileName, 3,, Open File, Text Documents (*.txt)
if SelectedFileName =  ; No file selected.
    return
Gosub FileRead
return
;-----------------------------------------------------
FileRead:  ; Caller has set the variable SelectedFileName for us.
FileRead, MainEdit, %SelectedFileName%  ; Read the file's contents into the variable.
if ErrorLevel
{
    MsgBox Could not open "%SelectedFileName%".
    return
}
GuiControl,, MainEdit, %MainEdit%  ; Put the text into the control.
FullCurFiln = %SelectedFileName%
Gui, Show,, DragonPad²   ; Show file name in title bar.
return

FileSave:
if FullCurFiln =   ; No filename selected yet, so do Save-As instead.
    Goto FileSaveAs
Gosub SaveCurrentFile
return
;-----------------------------------------------------
FileSaveAs:
Gui +OwnDialogs  ; Force the user to dismiss the FileSelectFile dialog before returning to the main window.
FileSelectFile, SelectedFileName, S16,, Save File, Text Documents (*.txt)
if SelectedFileName =  ; No file selected.
    return
FullCurFiln = %SelectedFileName%
Gosub SaveCurrentFile
return
;-----------------------------------------------------
SaveCurrentFile:  ; Caller has ensured that CurrentFiln is not blank.
IfExist %FullCurFiln%
{
    FileDelete %FullCurFiln%
    if ErrorLevel
    {
        MsgBox The attempt to overwrite "%FullCurFiln%" failed.
        return
    }
}


GuiControlGet, MainEdit  ; Retrieve the contents of the Edit control.
FileAppend, %MainEdit%, %FullCurFiln%  ; Save the contents to the file.
Gui, Show,, DragonPad²
return
;-----------------------------------------------------
HelpAbout:
Gui, 2:+owner1  ; Make the main window (Gui #1) the owner of the "about box" (Gui #2).
Gui +Disabled  ; Disable main window.
Gui, 2:Add, Text,, Text for about box.
Gui, 2:Add, Button, Default, OK
Gui, 2:Show
return
;-----------------------------------------------------
Helpwords:  ;This is a simple textbox I manually add my words from my commandlist into for fast reference.
^#!f1::
Msgbox,Commandlist = @1,@2,@3,@4,@5,@6,
Return
;-----------------------------------------------------
2ButtonOK:  ; This section is used by the "about box" above.
2GuiClose:
2GuiEscape:
Gui, 1:-Disabled  ; Re-enable the main window (must be done prior to the next step).
Gui Destroy  ; Destroy the about box.
return
;-----------------------------------------------------
GuiDropFiles:  ; Support drag & drop.
Loop, parse, A_GuiEvent, `n
{
    SelectedFileName = %A_LoopField%  ; Get the first file only (in case there's more than one).
    break
}
Gosub FileRead
return
;----------------------------------------------------- 
GuiSize:
if ErrorLevel = 1  ; The window has been minimized.  No action needed.
    return
; Otherwise, the window has been resized or maximized. Resize the Edit control to match.
NewWidth := A_GuiWidth - 20
NewHeight := A_GuiHeight - 34
Button1posw := A_GuiWidth - 295
Button2posw := A_GuiWidth - 245
Button3posw := A_GuiWidth - 195
Static1posw := A_GuiWidth - 133
Static2posw := A_GuiWidth - 85
Static3posw := A_GuiWidth - 385

GuiControl, Move, MainEdit, W%NewWidth% H%NewHeight%
GuiControl, Move, MainEdit2, W%NewWidth% H%NewHeight%
GuiControl, Move, SysTabControl321, W%NewWidth% H%NewHeight%
;GuiControl, Move, Tab 2, W%NewWidth% H%NewHeight%


GuiControl, Move, Button1, x%Button1posw% y4
GuiControl, Move, Button2, x%Button2posw% y4
GuiControl, Move, Button3, x%Button3posw% y4
GuiControl, Move, Static1, x%Static1posw% y8
GuiControl, Move, Static2, x%Static2posw% y8
GuiControl, Move, Static3, x%Static3posw% y8

return
;-----------------------------------------------------   
FileExit:     ; User chose "Exit" from the File menu.
GuiClose:      ; User closed the window.
ExitApp
;-----------------------------------------------------
^+#d::  ;;Activate DragonPad²
WinActivate,DragonPad²
Return
;-----------------------------------------------------
pause::pause
;-----------------------------------------------------
STOPTimedCutNpaste:

If stop = 1
stop = 0
Else
stop = 1
ControlSetText,Edit1,%Vishnu%,DragonPad²
return
;-----------------------------------------------------
SingleCutNpaste:
^!#v::  ;;Single instance CutNPaste -- not timed that is :)
Gosub,CutNPaste
Return
;-----------------------------------------------------
^+#Backspace::  ;;Exit
ExitApp
Return
;-----------------------------------------------------
^+#5::
Winactivate,WordPerfect
Winactivate,DragonPad²
Return
;-----------------------------------------------------
CutNPaste:
^#!b::  ;;CutnPaste Single Instance
ControlSend,Edit1,^{end},deleme.txt - Notepad
SetKeyDelay, 1, 0
Clipboard =
Winactivate,DragonPad²
ControlSend,Edit1,^a,DragonPad²
ControlSend,Edit1,^x,DragonPad²
;MsgBox,Clipboard = %Clipboard%
FileAppend `n*%timez%*%ntime%* -- %A_Space%%Clipboard%,Testy.txt
StringReplace,Clipboard,Clipboard,`n`n,`n,all
StringReplace,Clipboard,Clipboard,%A_Space%%A_Space%,%A_Space%,all
Loop,Parse,Clipboard,%A_Space%
{
Kali = %A_Loopfield%
;MsgBox,Kali = %Kali%
If Kali in %Commandlist%
{
;MsgBox, %Kali%, is in Commandlist
Grier++
FileAppend, `n|%Grier%|%timez%%ntime% -- %A_Space%%Kali%,%FullCurFiln%
SetKeyDelay,1,1
Gosub, %Kali%
}
Else
ControlSend,Edit1,%Kali%%A_Space%,deleme.txt - Notepad
;This is the word processor you intend to send text to.  In this case it's WordPerfect.
Durga = %A_Index%
}
Wordcount+=%Durga%
GuiControlGet, Static3
If ( Static3 <> Wordcount )            ; Update the control only when needed
GuiControl,, Static3, %Wordcount% words  ; this avoids flicker
;SetKeyDelay -1,-1
Return
;-----------------------------------------------------
;-----------------------------------------------------
; This is where the commands go. There have to be entries in the commandlist for these to work.

@1:
;MsgBox, Command = @1
ControlSend,Edit1,^{end} `n{Tab}|%Grier%| {Tab} This is some example text.  Please note that the number between the pipes will match the corresponding entry in the backup textfile.  That number is associated with the variable grier and is incremented with every successful cutnpaste.   This can be very useful. To see what it does try doing all of these demo commands and then opening up the backup textfile which would be %FullCurFiln%.deleme.txt.,deleme.txt - Notepad

Return

@2:
;MsgBox, Command = @2
ControlSend,Edit1,^{end} `n{Tab}|%Grier%| {Tab} *%nTime%*%timez%* {Tab} This is a time-stamped example text.  If you didn't start the timer`, you will only see a single time and if you start the timer you will see two. HINT -- You start the timer by pressing the Start button. :){Space}{Space},deleme.txt - Notepad
Return

@3:
;MsgBox, Command = @3
SetKeyDelay, -1, -1
ControlSend,Edit1,^{end} `n{Tab}|%Grier%|{Tab}{f5} -- This is example text being sent to Notepad using the setkeydelay command to speed up input.  In my experience so far this can result in errors such as the wrong letters being capitalized etc.  If you see no errors in this text`, you may be want to experiment with using the -1`,-1 setting.  Otherwise you may have to keep it as I set it`, at 1`,1., deleme.txt - Notepad
SetKeyDelay, 1,1
Return

@4:
;MsgBox, Command = @4
WinActivate, deleme.txt - Notepad
SendInput,^{end} `n{Tab}|%Grier%|{Tab}And this method sends text much faster but it also does not send it in the background.
WinActivate,DragonPad²
Return

@5:
;MsgBox, Command = @5
Blockinput, On
WinActivate, deleme.txt - Notepad
SendInput,^{end} `n{Tab}|%Grier%|{tab}And this is the same method protecting the function with Blockinput.  I have not experimented with using Dragon at the same time as this.  You cannot use the mouse/keyboard while blockinput is on`, and I doubt you can use Dragon either`, but as I said I have not tried yet.
BlockInput, Off
WinActivate,DragonPad²
Return

@6:
;MsgBox, Command = @6
ControlSend,Edit1,^{end} `n{Tab}|%Grier%|{tab}*%nTime%*%timez%* And this should open up your backup textfile. You will see that it resembles a logfile`, and logs commands sent as their command names rather than the resulting text., deleme.txt - Notepad
Run, Notepad.exe %FullCurFiln%
Return

;=== The killswitch shortcut (Ctrl-Alt-Backspace)
^!Backspace::Reload
;---------------------------------------------------

StartStop:

 GuiControlGet, StartStop
 If ( StartStop = "Start" )
  {
     GuiControl,, StartStop, Stop
     SetTimer, Count,990
  }
 Else
  {
     GuiControl,, StartStop, Start
     SetTimer, Count, Off
     GuiControl,, PauseResume, Pause
     DateTimeStamp = 20061103000000

  }
Return
 
PauseResume:

 GuiControlGet, StartStop
 If ( StartStop = "Start" )
     Return
 GuiControlGet, PauseResume
 If ( PauseResume = "Pause" )
  {
     GuiControl,, PauseResume, Resume
     SetTimer, Count, OFF
  }
 Else
  {
     GuiControl,, PauseResume, Pause
     SetTimer, Count, 990
  }
Return

Reset:

  GuiControl,, Static1, 00:00:00
  DateTimeStamp = 20061103000000
Return


Count:

DateTimeStamp += 1, Seconds
FormatTime, nTime, %DateTimeStamp%, HH:mm:ss
GuiControlGet, Static1
If ( Static1 <> nTime )            ; Update the control only when needed
GuiControl,, Static1, %nTime%  ; this avoids flicker
Return

update_clock:

FormatTime, timez,, HH:mm:ss
ControlSetText, Static2,%timez%,DragonPad²
Return

; The updateclock function is courtesy of SKAN -- ONCE AGAIN!
;-----------------------------------------------------

rctrl & numpad1::
MsgBox,Make Sure Dragon is in Dictation Mode.`nStart the timer.
Send, ^{f12}
WinActivate, deleme.txt - Notepad
WinActivate, DragonPad²
Return

rctrl & numpad2::
WinActivate, deleme.txt - Notepad
WinActivate, DragonPad²
Return

;-----------------------------------------------------

;OK, NEW VERSION OF TIMEDCUTNPASTE ADDED 02.11.09

TIMEDCUTNPASTE:
rctrl & numpad0::  ;;Init timed CutNPaste
ControlSend,Edit1,^{end},deleme.txt - Notepad
stop = 0
WinActivate, deleme.txt - Notepad
Winactivate, DragonPad²
SetKeyDelay, 1, 1
Loop
{ ;111 This is the main loop that contains all others
Winactivate,DragonPad²
if stop = 1
break
else
Lakshmi =
Loop
{  ;222 This loop just waits for input in the main edit
if stop = 1
break
else
ControlGetText,Lakshmi,Edit1,DragonPad²
StringLen,LakshmiLen,Lakshmi
Stringlen,SaraLen,Sarasvati
;MsgBox,%Lakshmi% -- %LakshmiLen% -- %SaraLen%
; If Lakshmi =  ;If Lskshmi is 0 then Sarasvati should be also, normally!
if %LakshmiLen% = %SaraLen%
Sleep, 250
else
break
}  ;222
Ganesa := ( LakshmiLen - SaraLen ) ;Ganesa represents the number of new characters
;MsgBox,%Ganesa%
StringRight,Hanuman,Lakshmi,%Ganesa% ;Hanuman is those characters
;MsgBox,%Hanuman%

FileAppend `n|%grier%| {tab} *%timez%*%ntime%* -- %A_Space%%Hanuman%,%FullCurFiln% ; Appends Hanuman to logfile

Balaram := RegexReplace(Hanuman,"\s+"," ")

;MsgBox,%Balaram%
Loop,Parse,Balaram,%A_Space%;  ; parses based on A-Space as separater
{ ;333 This is where we separate words from commmands
AutoTrim,On
Kali = %A_Loopfield%
;MsgBox,Kali = %Kali%
Wordcount = %A_Index%
If Kali in %Commandlist%
{ ;444 ;This is where commands are transferred to their respective gosubs
Grier++ ;This increments var Grier
FileAppend, `n|%Grier%|*%timez%*%ntime%* -- %A_Space%%Kali%,%FullCurFiln%
Sleep,50 ;may not be necessary, I don't remember
Gosub, %Kali%
} ;444
Else
ControlSend,Edit1,%Kali%%A_Space%,deleme.txt - Notepad
;This is the word processor you intend to send text to.  In this case it's Notepad.
Durga = %A_Index%
} ;333
GuiControlGet, Static3
If ( Static3 <> Wordcount )            ; Update the control only when needed
GuiControl,, Static3, %Wordcount% words  ; this avoids flicker
Sleep, 2000
Sarasvati := Lakshmi


Parvati := Sarasvati . " " . Lakshmi

If stop = 1
Break
} ;111
ControlSend,Edit1,^{end},DragonPad²
Return

F4::
stop = 1
return


I think this is a really exciting project and it's a good thing I do because nobody else seems to :-) You are welcome to distribute it, modify it, delete all the comments, whatever, but you are forbidden to sell this for money or to claim authorship of it. The AutoHotKey scripting language is licensed under the GNU convention, and as the guy who's been putting this together using said scripting language, I pronounce the results of my work to be under the same auspices.

So there.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 26th, 2009, 7:03 am 
Offline

Joined: January 20th, 2007, 7:47 pm
Posts: 110
THANKS. I love ahk though, and love dragon (but not nuance), and wish I could use them together, so if this will help I'm all for it.

I have the script running. But I don't understand what it does, beyond bring up a pad. I don't understand the example. I can't get the @1 etc commands to work, don't know how to enter a command, how to set up a new command, etc.

Not the sharpest tool in the shed, am I?

Btw, what the benefit is of dictating in a pad? I've always dictated directly into the app directly (I don't use Dragon's pad either). And, always used Normal mode, do I have to create commands to replace the existing dragon Normal Mode ones (a few of which, like "cap that" are actually reliable)?

Thanks again for this.

_________________
...Ed


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 26th, 2009, 10:11 am 
Offline

Joined: February 20th, 2007, 1:37 pm
Posts: 198
Location: D.C.
EdScriptNewbie wrote:
THANKS. I love ahk though, and love dragon (but not nuance), and wish I could use them together, so if this will help I'm all for it.

Hi Ed. You and I are on the same page in this regard.
EdScriptNewbie wrote:
I have the script running. But I don't understand what it does, beyond bring up a pad. I don't understand the example. I can't get the @1 etc commands to work, don't know how to enter a command, how to set up a new command, etc.

Not the sharpest tool in the shed, am I?

Well did you get your own special school bus?

I'm really doing this project for my own purposes and it may not suit yours. My purposes include dictating very fast. I can't wait for Dragon to execute a command. So I dictate to a program that executes commands PDQ Bach when it gets certain words input to it.

Try replacing the @1 @2 @3 etc with words, both in the commandlist at the top and the gosub labels at bottom.
Start Dragon.
Start DragonPad². It should create and open a file called deleme.txt. If it doesn't for some reason, you must do so.

-- Oh, dookie, it doesn't. Line 65 should say

Run, Notepad.exe deleme.txt

instead of

WinActivate, NOtepad.exe deleme.txt

OK, to continue:
Select on the DragonPad² "timed cutnpaste"
Turn on your mic in Dragon, and click once on DragonPad² to let Dragon know you are dictating to it. And dictation mode is recommended for any real use here, BTW.
Say those words into Dragon. If Dragon got them right, they will show up in DragonPad², be copied and if they are both in the command list and in the gosubs, the associated command will be executed in Notepad.
View the results.

The sample commands I provided just show some of the possibilities that could be explored with this project. And I'll tell you, I have abandoned using ControlSend to send the text to Notepad (or in my case, Textpad) because it's too slow. Instead I'm appending text to a textfile, and refreshing the view after every command. Much less lag. And I am controlling another program using DragonPad² in my own version that I haven't posted yet.

And BTW, I have started a thread dedicated to my little project, so as not to clutter up this one any more than I have already. I will be posting updates to my project there, and I am working on the new one now. If you or anybody is interested in this DragonPad² project, please post your remarks there instead of here.

http://www.autohotkey.com/forum/viewtopic.php?t=40877

Cheers, ribbet


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 26th, 2009, 3:13 pm 
Offline

Joined: January 20th, 2007, 7:47 pm
Posts: 110
You bet, Rib, I just hold the bar in front and bounce on the seat all the way home, yeehaa. That's why they call me Special Ed.

So, dumb question (naturally), is there any way you could do all this without the pad? Probably not.

I'm still confused by the @1 business. Any chance you could post your version that you actually use? (I'm assuming you have replaced @1 etc with actual words yourself, right?)

Thanks again.

_________________
...Ed


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 26th, 2009, 6:08 pm 
Offline

Joined: February 20th, 2007, 1:37 pm
Posts: 198
Location: D.C.
EdScriptNewbie wrote:
So, dumb question (naturally), is there any way you could do all this without the pad? Probably not.
Ed, there's no such thing as a dumb question. Now dumb people, that's another matter. :-)
Sure. I see one other post here regarding how to do it. And surely there are more perhaps better ways of doing what I'm trying to do. And I would sure love to hear them.
Quote:
I'm still confused by the @1 business. Any chance you could post your version that you actually use? (I'm assuming you have replaced @1 etc with actual words yourself, right?)

Thanks again.


Hey Ed. I'll tell you what. I have to put up some sheetrock, so I can't put up any code right now. I'll have something for you by dawn tomorrow, along with some improvements. I will post it at the aforementioned:

http://www.autohotkey.com/forum/viewtopic.php?t=40877

And you can give me further questions or feedback there.

Stay special, you know you are! :-)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 16th, 2009, 4:56 pm 
Offline

Joined: May 8th, 2009, 1:58 pm
Posts: 1
Hi,

I think this is what I am looking for ;-)

I have a small exe UDP client program that sends a string to a specified server.

arniechat.exe 10.7.4.55 I want to write this letter to john

arniechat.exe (is programs)
1st argument is always IP address of UDP server
rest of arguments are the string to be sent.

What I want to do is capture what I say with DragonNS (Can't say DNS as I excluded DNS as that means domain name server :-) ) (9.5) and pass that onto arniechate.exe

Where abouts in your hotkey script would I (& example would be lovely) put arniechat.exe?

_________________
--
http://www.shadowrobot.com/ need a hand??


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 17th, 2009, 3:34 am 
Offline

Joined: February 20th, 2007, 1:37 pm
Posts: 198
Location: D.C.
I don't have enough detail here. If you are simply doing one "Letter to John" at a time, it doesn't need to be as complicated as what I have been trying to do with DragonPad². If it's just one letter at a time, you just dictate one letter at a time, and then send all the dictated text to an IP address, and then append the letter to a logfile or whatever for record keeping, and start another. I don't see that much reason to use the commands like I've been playing with to do that.

But tell me, can the "dear john letters" be done one at a time? And do you really need speech-activated commands to send them? Because if you don't it would be much simpler and more reliable to have the stuff appended to a "run arniechat (ipaddress) (dear john letter)" using a keypress or a gui button. Is it a different IP addy each time, or always the same?

So you can use an edit box much like I'm using in DragonPad² and you're free to lift the code, and strip out a lot of the fancy commands in there, and put in some simple ones that get you where you want to go.

OTOH, you can use AHK to make a program that copies the "dear john letter" from DragonPad (the real dragonpad) and send it to an IP addy of your choice, I assume using the "run" command once again. My little edit box doesn't have as many features as DragonPad. Just a few options.


Last edited by ribbet.1 on June 4th, 2009, 5:03 am, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 3rd, 2009, 8:36 pm 
Offline

Joined: November 21st, 2006, 4:28 pm
Posts: 17
awesome work

i got DNS standard today and had the exact same idea

will definitely look at this more closely and contribute more to it, if poss


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 38 posts ]  Go to page Previous  1, 2, 3  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: Yahoo [Bot] and 9 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group