KnowBrainer Speech Recognition
Decrease font size
Increase font size
Topic Title: Failing at creating a simple DVC command in Asana
Topic Summary: tab + i
Created On: 12/15/2022 12:05 PM
Status: Post and Reply
Linear : Threading : Single : Branch
 Failing at creating a simple DVC command in Asana   - brooklyn cabin - 12/15/2022 12:05 PM  
 Failing at creating a simple DVC command in Asana   - monkey8 - 12/15/2022 02:18 PM  
 Failing at creating a simple DVC command in Asana   - brooklyn cabin - 12/15/2022 02:39 PM  
 Failing at creating a simple DVC command in Asana   - Lunis Orcutt - 12/15/2022 02:21 PM  
 Failing at creating a simple DVC command in Asana   - brooklyn cabin - 12/15/2022 02:46 PM  
 Failing at creating a simple DVC command in Asana   - monkey8 - 12/15/2022 02:53 PM  
 Failing at creating a simple DVC command in Asana   - brooklyn cabin - 12/15/2022 04:15 PM  
 Failing at creating a simple DVC command in Asana   - monkey8 - 12/15/2022 05:13 PM  
 Failing at creating a simple DVC command in Asana   - brooklyn cabin - 12/15/2022 08:44 PM  
 Failing at creating a simple DVC command in Asana   - monkey8 - 12/16/2022 03:58 AM  
 Failing at creating a simple DVC command in Asana   - Alan Cantor - 12/15/2022 08:59 PM  
 Failing at creating a simple DVC command in Asana   - brooklyn cabin - 12/16/2022 04:36 PM  
 Failing at creating a simple DVC command in Asana   - brooklyn cabin - 12/16/2022 05:04 PM  
 Failing at creating a simple DVC command in Asana   - Alan Cantor - 12/16/2022 09:30 PM  
 Failing at creating a simple DVC command in Asana   - monkey8 - 12/17/2022 08:10 AM  
 Failing at creating a simple DVC command in Asana   - brooklyn cabin - 12/19/2022 01:56 PM  
 Failing at creating a simple DVC command in Asana   - brooklyn cabin - 12/28/2022 12:09 PM  
 Failing at creating a simple DVC command in Asana   - Edgar - 12/28/2022 05:10 PM  
 Failing at creating a simple DVC command in Asana   - brooklyn cabin - 12/29/2022 09:41 PM  
 Failing at creating a simple DVC command in Asana   - monkey8 - 12/30/2022 04:15 AM  
 Failing at creating a simple DVC command in Asana   - brooklyn cabin - 01/04/2023 09:25 PM  
Keyword
 12/15/2022 12:05 PM
User is offline View Users Profile Print this message

Author Icon
brooklyn cabin
Top-Tier Member

Posts: 375
Joined: 02/01/2013

My company is starting to use Asana and I'm trying to create a bunch of DVC commands to help me navigate the desktop app. They have a browser version but I figured it would be simpler for me to create keyboard shortcut commands for Desktop, so there won't be any confusion with other browser-based commands that might be similarly titled.

Is there anything missing from this command? When I say the command in Asana, I get the red exclamation mark at the top of my Dragon command bar and a string of words in quotation marks like, "close bracket" "close square bracket" etc. 

 12/15/2022 02:18 PM
User is offline View Users Profile Print this message

Author Icon
monkey8
Top-Tier Member

Posts: 4171
Joined: 01/14/2008

Brooklyn if you were to send this keyboard combination using the keyboard to Asana would you be pressing the Tab key and then pressing the I key or would you be holding down the Tab key when you press the I key.



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

 12/15/2022 02:39 PM
User is offline View Users Profile Print this message

Author Icon
brooklyn cabin
Top-Tier Member

Posts: 375
Joined: 02/01/2013

I would be pressing the two keys at the same time. I've tried it manually and it works. Just can't seem to get it with a speech command in DVC even though it seems very simple.

 12/15/2022 02:21 PM
User is offline View Users Profile Print this message

Author Icon
Lunis Orcutt
Top-Tier Member

Posts: 40716
Joined: 10/01/2006

Try SendKeys "{Tab}i" which is also the same for a standard Dragon Advanced-Scripting VB script. If your command executes a little too quickly, try SendSystemKeys "{Tab}i"



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

Change "No" to "Know" w/KnowBrainer 2022
Trial Downloads
Dragon/Sales@KnowBrainer.com 
(615) 884-4558 ex 1

 12/15/2022 02:46 PM
User is offline View Users Profile Print this message

Author Icon
brooklyn cabin
Top-Tier Member

Posts: 375
Joined: 02/01/2013

neither of these work for me, Lunis.

 12/15/2022 02:53 PM
User is offline View Users Profile Print this message

Author Icon
monkey8
Top-Tier Member

Posts: 4171
Joined: 01/14/2008

Originally posted by: brooklyn cabin I would be pressing the two keys at the same time. I've tried it manually and it works. Just can't seem to get it with a speech command in DVC even though it seems very simple.

 

 

You are unlikely to do it with DVC so you would need to use Advanced Scripting, try the following script, if it doesn't work put a Wait 0.1 before and after the SendKeys line. If Asana uses lots of tab key combinations you can use the same structure with the other commands you might need. If that doesn't work let me know and I will give you something else to try.

 

Declare Function keybd_event Lib "user32.dll" (ByVal vKey As _
Long, bScan As Long, ByVal Flag As Long, ByVal exInfo As Long) As Long

Const VK_TAB = &h09

Sub Main
keybd_event(VK_TAB,0,0,0)
SendKeys"i"
keybd_event(VK_TAB,0,2,0)

End Sub


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



 12/15/2022 04:15 PM
User is offline View Users Profile Print this message

Author Icon
brooklyn cabin
Top-Tier Member

Posts: 375
Joined: 02/01/2013

Thanks, Lindsey. I'm getting a syntax error message when I try to create this command. (Screenshot below). I've never made a command this complicated and don't really understand the script so just let me know if I'm missing something. 

 

 12/15/2022 05:13 PM
User is offline View Users Profile Print this message

Author Icon
monkey8
Top-Tier Member

Posts: 4171
Joined: 01/14/2008

You must have the top line of your script on 2 separate lines exactly like this:


Declare Function keybd_event Lib "user32.dll" (ByVal vKey As _

Long, bScan As Long, ByVal Flag As Long, ByVal exInfo As Long) As Long 

 

The _ at the end of the first line depicts that the function declaration will proceed on the next line.



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

 12/15/2022 08:44 PM
User is offline View Users Profile Print this message

Author Icon
brooklyn cabin
Top-Tier Member

Posts: 375
Joined: 02/01/2013

oh, didn't realize that. But even with that, I'm still getting an error message "(1) Syntax Error" when I try to save the command.

 12/16/2022 03:58 AM
User is offline View Users Profile Print this message

Author Icon
monkey8
Top-Tier Member

Posts: 4171
Joined: 01/14/2008

You are getting a syntax error because you have set the command to a DVC script. You need to set the command to advanced scripting as Alan noted, not DVC. Just say "Add Command" and then choose Advanced Scripting.

 

If



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



 12/15/2022 08:59 PM
User is offline View Users Profile Print this message


Alan Cantor
Top-Tier Member

Posts: 4532
Joined: 12/08/2007

Start from scratch. Make the command Advanced Scripting from the get-go and try again.
 12/16/2022 04:36 PM
User is offline View Users Profile Print this message

Author Icon
brooklyn cabin
Top-Tier Member

Posts: 375
Joined: 02/01/2013

Thank you, Lindsey!! The command is working and it's marvelous.

There are probably 50 or so of these two button commands in Asana. I don't need to use them all but I would like to make a bunch more of these. Moving forward, is the trick to replace each instance of "TAB" and "i"?

Is there something special about the Tab key as opposed to "i" which was only used once with a simple SendKeys?
 12/16/2022 05:04 PM
User is offline View Users Profile Print this message

Author Icon
brooklyn cabin
Top-Tier Member

Posts: 375
Joined: 02/01/2013

For instance,if I was going to create a command that required pressing Control and Enter at the same time, would it look like:

Declare Function keybd_event Lib "user32.dll" (ByVal vKey As _
Long, bScan As Long, ByVal Flag As Long, ByVal exInfo As Long) As Long

Const VK_CTRL = &h09

Sub Main
keybd_event(VK_CTRL,0,0,0)
SendKeys"Enter"
keybd_event(VK_CTRL,0,2,0)

End Sub
 12/16/2022 09:30 PM
User is offline View Users Profile Print this message


Alan Cantor
Top-Tier Member

Posts: 4532
Joined: 12/08/2007

You may be able to get away with simpler code when outputting key combinations that use standard modifier keys (i.e., Shift, Ctrl, or Alt).

For example, this easy-to-understand example is the equivalent of pressing Ctrl + Enter:

Sub Main
SendSystemKeys "{Ctrl+Enter}"
End Sub
 12/17/2022 08:10 AM
User is offline View Users Profile Print this message

Author Icon
monkey8
Top-Tier Member

Posts: 4171
Joined: 01/14/2008

Hi Brooklyn,


it's not so much that there is anything special about the tab key but the reason that you are using the keybd_event function is that you want to use the tab key as a modifier key meaning you need to simulate holding down the tab key when you press i and then releasing it again, that is something you can't really do with SendKeys other than with the usual modifier keys like control, shift, alt and the Windows key. So here is the script below with some comments:


'Declare the keyboard event Windows API function

Declare Function keybd_event Lib "user32.dll" (ByVal vKey As _

Long, bScan As Long, ByVal Flag As Long, ByVal exInfo As Long) As Long

'constant variable for the tab, you can find the constants for other keys here

'https://learn.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes

Const VK_TAB = &h09


Sub Main

'hold down the tab key

keybd_event(VK_TAB,0,0,0)

'press i

SendKeys"i"

'then release the tab key

keybd_event(VK_TAB,0,2,0)

End Sub


In terms of sending "Ctrl+Enter" you have got the idea but the constant value for the control key is &h11 (see the link above) otherwise your script is correct. However as Alan points out there are easier ways of sending the control key with another key e.g.


SendKeys"^~"


The symbols you see above are all depicted in the URL below where you can see a full list of keys that you use with SendKeys:


https://www.winwrap.com/web2/basic/#!/ref/WWB-doc_sendkeys_instr.htm


You could also do:


SendKeys"^{Enter"}


Finally if the above is not enough there is yet another even easier way of sending the control key or the shift key or the alt key as a modifier key with another key and that is using the built in commands e.g.


"press control india" (you can use press or type)

"type shift sierra"

"press alt tango"

"press Windows key left arrow" (positions your window on the left hand side of the screen)


Unfortunately there are no built in commands for using the tab key as a modifier key.

 

Edit: finally meant to say that Alan used the function SendSystemKeys which uses slightly different key names and also used to be necessary when sending system keys like the control key, however with the latest version of Advanced Scripting (WinWrap basic) SendKeys works just fine. SendSystemKeys is also a bit slower than using SendKeys. 

 

 



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



 12/19/2022 01:56 PM
User is offline View Users Profile Print this message

Author Icon
brooklyn cabin
Top-Tier Member

Posts: 375
Joined: 02/01/2013

Thank you so much, Lindsay. I was able to make a bunch of commands over the weekend and I'm making headway on having this program be more hands-free. I so appreciate Alan and your generosity of knowledge.

I'm very grateful for this forum. 

 12/28/2022 12:09 PM
User is offline View Users Profile Print this message

Author Icon
brooklyn cabin
Top-Tier Member

Posts: 375
Joined: 02/01/2013

Okay, now working on creating a command in Asana which would be TAB + Enter. I tried modifying Lindsey's script above but it doesn't seem that I'm able to just substitute the Enter for the "i".

When I try to save the command I get a pop-up that says "Could Not Save This Command: A command with the same name and availability already exists. Please, change the commands name or availability."

Declare Function keybd_event Lib "user32.dll" (ByVal vKey As _
Long, bScan As Long, ByVal Flag As Long, ByVal exInfo As Long) As Long

Const VK_TAB = &h09

Sub Main
keybd_event(VK_TAB,0,0,0)
SendKeys"Enter"
keybd_event(VK_TAB,0,2,0)

End Sub

And I get the following error when I try to implement this advanced scripting command:
'#Language "WWB-COM"

Option Explicit

Sub Main
    SendKeys "{Tab+Enter}"
End Sub

 12/28/2022 05:10 PM
User is offline View Users Profile Print this message

Author Icon
Edgar
Top-Tier Member

Posts: 1375
Joined: 04/03/2009

SendKeys "{ENTER}", 1

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

-Edgar
DPI 15.3, 64-bit Windows 10 Pro, OpenOffice & Office 365, Norton Security, Shure X2U XLR to USB mic adapter with Audio Technica DB135 vocal mic, Asus X299-Deluxe Prime, Intel Core i9-7940X (14 core, 4.3 GHz overclocked to 4.9 GHz), G.SKILL TridentZ Series 64GB (4 x 16GB) DDR4 3333 (PC4 26600) F4-3333C16Q-64GTZ, NVIDIA GIGABYTE GeForce GTX 1060 GV-N1060G1 GAMING-6GD REV 2.0 6GB graphics card with 3 1920x1080 monitors

 12/29/2022 09:41 PM
User is offline View Users Profile Print this message

Author Icon
brooklyn cabin
Top-Tier Member

Posts: 375
Joined: 02/01/2013

Thanks, Edgar. Unfortunately this script does not work in Asana. As I understand it, from Lindsey's quote above, there's something specific about using the tab button in this program. The problem I'm having is that I seemingly can't just substitute Enter for "i" in this format.

 

"it's not so much that there is anything special about the tab key but the reason that you are using the keybd_event function is that you want to use the tab key as a modifier key meaning you need to simulate holding down the tab key when you press i and then releasing it again, that is something you can't really do with SendKeys other than with the usual modifier keys like control, shift, alt and the Windows key. So here is the script below with some comments:" 

 12/30/2022 04:15 AM
User is offline View Users Profile Print this message

Author Icon
monkey8
Top-Tier Member

Posts: 4171
Joined: 01/14/2008

Declare Function keybd_event Lib "user32.dll" (ByVal vKey As _
Long, bScan As Long, ByVal Flag As Long, ByVal exInfo As Long) As Long

Const VK_TAB = &h09

Sub Main
keybd_event(VK_TAB,0,0,0)
SendKeys"~"
keybd_event(VK_TAB,0,2,0)
End Sub

Remember you can find the key definitions here:

https://www.winwrap.com/web2/basic/#!/ref/WWB-doc_sendkeys_instr.htm

If the above doesn't work then put a Wait 0.1 either side of the SendKeys "~", you can also use SendKeys"{Enter}" instead of SendKeys"~" but please note you must include the curly brackets which you did not do above.


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



 01/04/2023 09:25 PM
User is offline View Users Profile Print this message

Author Icon
brooklyn cabin
Top-Tier Member

Posts: 375
Joined: 02/01/2013

Thank you!

Statistics
32528 users are registered to the KnowBrainer Speech Recognition forum.
There are currently 1 users logged in.
The most users ever online was 12124 on 09/09/2020 at 04:59 AM.
There are currently 352 guests browsing this forum, which makes a total of 353 users using this forum.

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