I'm aware of the probably most common form:
set wShell = createObject("wscript.shell")
wShell.sendKeys ":){ENTER}"
this uncommon and limited way:
Set ShellApp = CreateObject("Shell.Application")
ShellApp.WindowSwitcher
we can hackishly use sleep if we want a sequence of keys which depends on other events:
WScript.sleep 987
wShell.sendKeys "foo{!}~"
WScript.sleep 789
wShell.sendKeys "^a^c"
and we can't really keep a key pressed but we can repeat it many times:
wShell.sendKeys "{LEFT 42}"
now... am I missing something?
yeah, I'm probably missing something.
meanwhile I figured this useful tabled reference might still be useful if shamelessly adapted here:
Most ASCII characters can be represented simply by the character itself.
E.g, the key sequence FRED can be represented by "FRED".
Special keys such as the control keys, function keys etc are encoded with {braces}
................................................................................................................
: Key/Character : SendKey : Description :
:.......................:.......................................:..............................................:
: ~ : {~} : Send a tilde (~) :
: ! : {!} : Send an exclamation point (!) :
: ^ : {^} : Send a caret (^) :
: + : {+} : Send a plus sign (+) :
: Backspace : {BACKSPACE} or {BKSP} or {BS} : Send a Backspace keystroke :
: Break : {BREAK} : Send a Break keystroke :
: Caps Lock : {CAPSLOCK} : Press the Caps Lock Key (toggle on or off) :
: Clear : {CLEAR} : Clear the field :
: Delete : {DELETE} or {DEL} : Send a Delete keystroke :
: Insert : {INSERT} or {INS} : Send an Insert keystroke :
: Cursor control arrows : {LEFT} / {RIGHT} / {UP} / {DOWN} : Send a Left/Right/Up/Down Arrow :
: End : {END} : Send an End keystroke :
: Enter : {ENTER} or ~ : Send an Enter keystroke :
: Escape : {ESCAPE} : Send an Esc keystroke :
: F1 through F16 : {F1} through {F16} : Send a Function keystroke :
: Help : {HELP} : Send a Help keystroke :
: Home : {HOME} : Send a Home keystroke :
: Page Down : {PGDN} : Send a Page Down keystroke :
: Page Up : {PGUP} : Send a Page Up keystroke :
: Numlock : {NUMLOCK} : Send a Num Lock keystroke :
: Scroll lock : {SCROLLLOCK} : Press the Scroll lock Key (toggle on or off) :
: Print Screen : {PRTSC} : Send a Print Screen keystroke :
:.......................:.......................................:..............................................:
To specify keys with any combination of SHIFT, CTRL and ALT keys, precede them as following:
For SHIFT prefix with +
For CTRL prefix with ^
For ALT prefix with %
Related
How can I find the value of "is connected" for a Bluetooth device? I've tried Get-WMIObject cmdlets and a few others but none of the values changed when I connect/disconnect. The only place I have found the value to change is in the attached image. I found it in the Device Properties for the Bluetooth Headset I am trying to use.
I'm trying to write a toggle script for AutoHotKey to send btcom commands, but I would like to write an if statement with that. The piece I'm missing here is finding the value of "is connected" on my Bluetooth device.
Example of output from Get-WMIObject:
PS H:\> Get-WmiObject -Query "select * from win32_PnPEntity where Caption='Jordan's AirPods Pro'"
__GENUS : 2
__CLASS : Win32_PnPEntity
__SUPERCLASS : CIM_LogicalDevice
__DYNASTY : CIM_ManagedSystemElement
__RELPATH : Win32_PnPEntity.DeviceID="BTHENUM\\DEV_14C88BC438FE\\7&2D1C6A81&0&BLUETOOTHDEVICE_14C88BC438FE"
__PROPERTY_COUNT : 26
__DERIVATION : {CIM_LogicalDevice, CIM_LogicalElement, CIM_ManagedSystemElement}
__SERVER : OL-2TK93103QK
__NAMESPACE : root\cimv2
__PATH : \\OL-2TK93103QK\root\cimv2:Win32_PnPEntity.DeviceID="BTHENUM\\DEV_14C88BC438FE\\7&2D1C6A81&0&BLUETOOTHDEVICE_14C88BC438FE"
Availability :
Caption : Jordan’s AirPods Pro
ClassGuid : {e0cbf06c-cd8b-4647-bb8a-263b43f0f974}
CompatibleID : {BTHENUM\GENERIC_DEVICE}
ConfigManagerErrorCode : 0
ConfigManagerUserConfig : False
CreationClassName : Win32_PnPEntity
Description : Bluetooth Device
DeviceID : BTHENUM\DEV_14C88BC438FE\7&2D1C6A81&0&BLUETOOTHDEVICE_14C88BC438FE
ErrorCleared :
ErrorDescription :
HardwareID : {BTHENUM\Dev_14C88BC438FE}
InstallDate :
LastErrorCode :
Manufacturer : Microsoft
Name : Jordan’s AirPods Pro
PNPClass : Bluetooth
PNPDeviceID : BTHENUM\DEV_14C88BC438FE\7&2D1C6A81&0&BLUETOOTHDEVICE_14C88BC438FE
PowerManagementCapabilities :
PowerManagementSupported :
Present : True
Service :
Status : OK
StatusInfo :
SystemCreationClassName : Win32_ComputerSystem
SystemName : OL-2TK93103QK
PSComputerName : OL-2TK93103QK
PS H:\>
I have a \\.\SCSI#: handle created via CreateFile(). I know it points to a specific HBA or (in my case) NVMe Controller. It must have a Bus/Device/Function associated with it's enumeration.
So far I've tried to figure this out via wmi, though I'm more than open to a C solution via WinApi. (actually would prefer a solution in C).
By getting an object using:
gwmi -namespace root\cimv2 -class Win32_SCSIController | format-list *
It yields my NVMe device like so:
PSComputerName : DESK
Status : OK
Name : Standard NVM Express Controller
StatusInfo : 3
__GENUS : 2
__CLASS : Win32_SCSIController
__SUPERCLASS : CIM_SCSIController
__DYNASTY : CIM_ManagedSystemElement
__RELPATH : Win32_SCSIController.DeviceID="PCI\\VEN_1987&DEV_5008&SUBSYS_50081987&REV_01\\4&CB74546&0&00E8"
__PROPERTY_COUNT : 31
__DERIVATION : {CIM_SCSIController, CIM_Controller, CIM_LogicalDevice, CIM_LogicalElement...}
__SERVER : DESK
__NAMESPACE : root\cimv2
__PATH : \\DESK\root\cimv2:Win32_SCSIController.DeviceID="PCI\\VEN_1987&DEV_5008&SUBSYS_50081987&REV_01\\4&CB74546&0&00E8"
Availability : 3
Caption : Standard NVM Express Controller
ConfigManagerErrorCode : 0
ConfigManagerUserConfig : False
ControllerTimeouts :
CreationClassName : Win32_SCSIController
Description : Standard NVM Express Controller
DeviceID : PCI\VEN_1987&DEV_5008&SUBSYS_50081987&REV_01\4&CB74546&0&00E8
DeviceMap :
DriverName : stornvme
ErrorCleared :
ErrorDescription :
HardwareVersion :
Index :
InstallDate :
LastErrorCode :
Manufacturer : Standard NVM Express Controller
MaxDataWidth :
MaxNumberControlled :
MaxTransferRate :
PNPDeviceID : PCI\VEN_1987&DEV_5008&SUBSYS_50081987&REV_01\4&CB74546&0&00E8
PowerManagementCapabilities :
PowerManagementSupported :
ProtectionManagement :
ProtocolSupported : 2
SystemCreationClassName : Win32_ComputerSystem
SystemName : DESK
TimeOfLastReset :
Scope : System.Management.ManagementScope
Path : \\DESK\root\cimv2:Win32_SCSIController.DeviceID="PCI\\VEN_1987&DEV_5008&SUBSYS_50081987&REV_01\\4&CB74546&0&00E8"
Options : System.Management.ObjectGetOptions
ClassPath : \\DESK\root\cimv2:Win32_SCSIController
Properties : {Availability, Caption, ConfigManagerErrorCode, ConfigManagerUserConfig...}
SystemProperties : {__GENUS, __CLASS, __SUPERCLASS, __DYNASTY...}
Qualifiers : {dynamic, Locale, provider, UUID}
Site : :
Notice how the Index is blank... I figured that this would have been the number in \.\SCSI#:
Playing a little more, I can get the Bus/Device/Function from this:
$a = gwmi -namespace root\cimv2 -class Win32_PnPEntity -filter "DeviceId='PCI\\VEN_1987&DEV_5008&SUBSYS_50081987&REV_01\\4&CB74546&0&00E8'"
$a.GetDeviceProperties('DEVPKEY_Device_LocationInfo').deviceProperties.Data
PCI bus 5, device 0, function 0
I also thought about calling IOCTL_SCSI_GET_ADDRESS on the \\.\SCSI#: handle, though that doesn't work (which sort of makes sense since it isn't a lun-handle, but rather a controller one)
How do I associate a PCIe Bus/Device/Function info with the \\.\SCSI#: handle?
I have this type of data :
--Line1 : val1=10; val2=20; val3=30
--Line2 : val1=11; val2=21; val3=31
--Line3 : val1=12; val2=22; val3=32
--Line4 : val1=13; val2=23; val3=33
--Line5 : val1=14; val2=24; val3=34
--Line6 : val1=15; val2=25; val3=35
--Line7 : val1=16; val2=26; val3=30
Now, i am trying to write a script to get any particular value (say val1 for Line4) on the basis of string "Line1", Line2, etc.
Any hint? Working in linux.
I have two servers running Windows DSC that should both be running every 15 min but one is running correctly and the other is running ever 5 hours for some reason yet to be discovered. Here are the two LCM configurations:
The one that works:
PS C:\WINDOWS\system32> Get-DSCLocalConfigurationManager
ActionAfterReboot : ContinueConfiguration
AgentId : 420E62A0-FE64-11F5-9732-003ADC065DC3
AllowModuleOverWrite : False
CertificateID :
ConfigurationDownloadManagers : {}
ConfigurationID : 82xx1e91-4bz8-4fe4-b8dc-o73bc77c8756
ConfigurationMode : ApplyAndAutoCorrect
ConfigurationModeFrequencyMins : 15
Credential :
DebugMode : {NONE}
DownloadManagerCustomData : {MSFT_KeyValuePair (key = "ServerUrl"), MSFT_KeyValuePair (key =
"AllowUnsecureConnection")}
DownloadManagerName : WebDownloadManager
LCMCompatibleVersions : {1.0, 2.0}
LCMState : Idle
LCMStateDetail :
LCMVersion : 2.0
StatusRetentionTimeInDays : 10
PartialConfigurations :
RebootNodeIfNeeded : False
RefreshFrequencyMins : 30
RefreshMode : Pull
ReportManagers : {}
ResourceModuleManagers : {}
PSComputerName :
The one that is not:
PS C:\WINDOWS\system32> Get-DSCLocalConfigurationManager
ActionAfterReboot : ContinueConfiguration
AllowModuleOverWrite : False
CertificateID :
ConfigurationDownloadManagers : {}
ConfigurationID : 814b8ec2-7c1b-2359-8342-4ec23a4e576b
ConfigurationMode : ApplyAndAutoCorrect
ConfigurationModeFrequencyMins : 15
Credential :
DebugMode : {NONE}
DownloadManagerCustomData : {MSFT_KeyValuePair (key = "ServerUrl"), MSFT_KeyValuePair (key =
"AllowUnsecureConnection")}
DownloadManagerName : WebDownloadManager
LCMCompatibleVersions : {1.0, 2.0}
LCMState : Idle
LCMStateDetail :
LCMVersion : 2.0
StatusRetentionTimeInDays : 10
PartialConfigurations :
RebootNodeIfNeeded : False
RefreshFrequencyMins : 30
RefreshMode : Pull
ReportManagers : {}
ResourceModuleManagers : {}
PSComputerName :
Not sure why the second one is running ever 5 hours as it looks to be configured for every 15 min.... any ideas?
If it is WMF 5.0 RTM, you can check the configuration frequency settings as seen by the timers itself using:
get-winevent -LogName Microsoft-Windows-DSC/Operational | where {$_.Id -eq 4309}
This event contains information about the frequency of the timer as seen by the timer that triggers the consistency.
If the value is not 15 min, perform Set-DscLocalConfigurationManager again on the affected node and check the event again.
If the value is 15 min, look for 2 more events indicating a consistency run( you want the one with flag 1 for consistency check):
get-winevent -LogName Microsoft-Windows-DSC/Operational | where {($_.Id -eq 4343)-or ($_.Id -eq 4312)}
How can I write in italic font the words between ** ** for the first slide in slidify?
---
title : Yield loss of target spot (**Corynespora casiicola**) in soybean
subtitle :
author :
job :
logo : logo1.png
biglogo : logo2.png
framework : io2012 # {io2012, html5slides, shower, dzslides, ...}
widgets : [] # {mathjax, bootstrap, quiz}
mode : selfcontained
hitheme : tomorrow # {tomorrow, tomorrow_night, solarized_dark, solarized_light}
highlighter : highlight.js # {highlight.js, prettify, highlight}