Hello for everyone,
I need a simple macro (not simple for me) to toggle the normal arrow cursor to the crosshair cursor. (I want to asign a shortcut key for that!)
Thanks for the help, have a nice day!!!
Hello,
This code is not perfect, but it works with CorelDRAW X5
Sub cross()'CorelDRAW X5Set WshShell = CreateObject("WScript.Shell")WshShell.SendKeys "^j" & "+{TAB}" & "vtt" & "+{RIGHT}" & "p" & "%c" & "{ENTER}"End Sub
Greetings! Today is 24 January of 2023The code above must be improved.
A little later I will write code with more details and explanations so that it will work stably on any version of CorelDRAW with minor changes.
This code does nothing for me. Only the smart fill tool is selected.
Regards!!!
this code works on 2019
Sub cross()
'CorelDRAW 2019
Set WshShell = CreateObject("WScript.Shell")WshShell.SendKeys "%o" & "%o" & "{ENTER}" & "{TAB}" & "{TAB}" & "{ENTER}" & "%c" & "{ENTER}"End Sub
code replaces keystrokesALT+O (Tools)ALT+O (Options)TABTAB (select tools)ALT + C (cross hair cursor)Enter
My improved code is here:
Purpose of the code below:
We'll make pressing F10 toggle the crosshair cursor on/off
Sub CROSS_CURSOR_ON_OFF()
'CorelDRAW X3, X5
Dim WshShell As Object
Set WshShell = CreateObject("WScript.Shell")
WshShell.SendKeys "%oz" & "{TAB}" & "tt" & "{RIGHT}" & "p" & "%c" & "{ENTER}"
End Sub
OR - Iff Alt-z hot key combination is assigned to other program
WshShell.SendKeys "%o{DOWN}{ENTER}" & "{TAB}" & "tt" & "{RIGHT}" & "p" & "%c" & "{ENTER}"
OR – Iff Alt-z hot key combination is assigned to other program
WshShell.SendKeys "%o{DOWN}{ENTER}{TAB}tt{RIGHT}p%c{ENTER}"
Some Explanations:
To be successful, we need to open a page in the Options that has no controls. Such is Customization
WshShell.SendKeys "%oz"
Alt + o + z
Open Customization page from Option
To be successful, we need to open a page in the options that has no controls. Such is Customization
Then it's guaranteed that consecutively pressing the keys in exactly that order will turn the crosshair cursor on/off
За да имаме успех, трябва да отворим страница в опциите, която няма контроли. Такава е Customization
Тогава гарантирано последователното натискане на клавишите точно в този ред ще доведе до включване/изключване на crosshair cursor
{TAB}tt{RIGHT}p%c{ENTER}
{TAB}tt{RIGHT}p<ALT>c{ENTER}
Кодът по-горе ще работи добре, само ако клавиатурата е на английски – EN
Ако е на BG няма да работи, защото тогава Alt-o е Alt-д
Кодът по-горе работи добре само ако клавиатурата е на английски. Ако превключим на кирилица – няма да работи според очакванията.
За да избегнем проблемът с кирилицата, променяме програмния код така, че кодът да не съдържа клавишни комбинации, съдържащи букви
The code above work fine only if the keyboard is English - EN
If it's on BG it won't work because then Alt-o is Alt-д
The code above works fine only if the keyboard is in English. If we switch to Cyrillic - it will not work as expected.
To avoid the Cyrillic problem, we change the program code so that the code does not contain keyboard shortcuts containing letters
Avoid use SendKeys “{ENTER}”, because results may be bad, or use with caution and only if there is no other option.
This is the master BhBp.bg code
'MsgBox "F10 IS PRESSED"
'application.activate ' not work
'Dim appwin_mir As AppWindow
'With AppWindow
'.Activate
'.WindowState = cdrWindowMaximized
'End With
'WshShell.SendKeys "%oz" & "{TAB}" & "tt" & "{RIGHT}" & "p" & "%C" & "{ENTER}"
'WshShell.SendKeys "%oz{TAB}tt{RIGHT}p%c{ENTER}"
'WshShell.SendKeys "%{TAB}tt{RIGHT}p%c"
'WshShell.SendKeys "%{TAB}{RIGHT}%" 'ACTIVATE MENU FILE
'WshShell.SendKeys "%{TAB}%{ENTER}" 'ACTIVATE OBJECT PROPERTIES
'WshShell.SendKeys "%{TAB}%" 'ACTIVATE MENU FILE NO METTER EN OR BG
'WshShell.SendKeys "%{TAB}%" & "f" 'ACTIVATE FILE MENU
'WshShell.SendKeys "%{TAB}%" & "e" 'ACTIVATE EDIT MENU
''''THIS WORK WELL START
'Application.VBE.MainWindow.Visible = False
WshShell.SendKeys "%{TAB}%" 'MUST BE ACTIVE ROW TO WORK THE COMMAND ROWS BELOW
'WshShell.SendKeys "{TAB}"
''''THIS WORK WELL END
Application.VBE.MainWindow.Visible = False
'WshShell.SendKeys "%{TAB}%"
'WshShell.SendKeys "{TAB 2}" 'SHOW VIEW MENU
'WshShell.SendKeys "{TAB 9}" 'SHOW WINDOW MENU
'WshShell.SendKeys "{TAB 8}" 'SHOW TOOLS MENU
'WshShell.SendKeys "%{TAB}%{TAB 8}" 'MINIMIZE COREL WINDOW
'WshShell.SendKeys "{TAB 8}{DOWN}" 'SHOW TOOLS DROP DOWN MENU
'WshShell.SendKeys "{TAB 8}{DOWN 2}" 'tools customization row select
'WshShell.SendKeys "{TAB 8}{DOWN 2}" & " " 'SHOW CUSTOMIZE MENU
'WshShell.SendKeys "{TAB 8}{DOWN 2}" & " " & "{TAB}{up}{right}{DOWN 10}" 'PICK TOOL MENU SHOW
WshShell.SendKeys "{TAB 8}{DOWN 2}" & " " & "{TAB}{up}{right}{DOWN 10}{TAB}" & " " & "{ENTER}" 'CROSS HAIR CURSOR
Last step is to link F10 to run CROSS_CURSOR_ON_OFF()