Skip to content
Все записи в категории 'АИСММИ'

АИС ММИ (или АИСММИ) программа, чтобы Вы забодались работать. И только для этого.

АИСММИ или АИС ММИ — есть такая прога! Жуткое детище придуманное талантливыми программистами под управлением туполобых бюрократов. Туда надо вносить все сведения об оборудовании, которое поступило в медучреждения в рамках национального проекта здоровье.  (Я считаю что ето проект национального грабежа. Уж сколько денег заработали на этом …  те кто заработали. Не будем показывать пальцем, все равно не доказать.)

Короче в эту прогу мало того что надо внести всякие серийные номера , даты и прочее, так еще и врачей, которые на ней работают и наработку за каждый день. Вопчем если ты можешь сделать чтото полезное — бросай это полезной и вбивай бесполезное! Ато вот захочет президент узнать сколько ректоскопов закуплено в рамках нацпроекта в городе Мухосранске Задрипанского района — хопа-на вот оно все данные на серваке! А то что оно больше нифиг никому не нужно — это не волнует.

Чтото я отвлекся. Короче, для программистов, кто волокет в VBA и кому приходится иметь дело с аисмми — предлагаю кусок кода под microsoft access, который сам нажимает кнопочки в аис мми (там меняется в основном одна цифра). Но чтоб поставить эту цифру надо раз 10 щелкнуть мышой и 2 раза прыгнуть от мыши к клаве и назад. Ну и по клаве постучать. А тут, приложив голову, делаете форму на акцессе, пишите туда что надо , меняете одну циферку и жмете пуск, прога делает за вас пачку действий, причем ошибаясь гораздо меньше.

Итак пример кода

(Дописываю позже — кому надо пришлю прогу готовую чтоб не мучались — пишите в комменты)

Прога на нажатие кнопки на форме

Public Sub test_Click()

t = 10000000  ‘ задержка между нажатиями и тест ее пониже
‘For a = 1 To t: Next a
‘MsgBox «готово»
‘Exit Sub

‘ найти хвид акса

hwnd3 = FindWindow(vbNullString, «Microsoft Access»)
If hwnd = 0 Then
MsgBox «Окно акцесса не найдено !!!'»

End If

‘найти главное окно аисмми
hwin = FindWindow(«ClaWin0400000H_1», vbNullString)
If hwin = 0 Then
MsgBox «Окно ClaWin0400000H_1 не найдено !!!'»

End If

‘ShowWindow(hWin, SW_SHOWNORMAL);
‘ SetForegroundWindow(hWin);

‘ найти окно «Добавление записи»
hwin = FindWindowEx(hwin, ByVal 0&, «MDIClient», vbNullString)
If hwin = 0 Then
MsgBox «Окно MDIClient не найдено !!!»

End If

‘  аисмми на передний план
zz = apiShowWindow(hwin, SW_SHOWNORMAL)
zz = SetForegroundWindow(hwin)
‘lngReturn = BringWindowToTop(hWin)

‘ перейти на добавить запись и нажать пробел
keybd_event VK_TAB, 0, 0, 0
keybd_event VK_TAB, 0, KEYEVENTF_KEYUP, 0
For a = 1 To t: Next a

keybd_event VK_SPACE, 0, 0, 0
keybd_event VK_SPACE, 0, KEYEVENTF_KEYUP, 0
For a = 1 To t * 8: Next a

If Me.datt > 0 Then ‘ поле скока дней пропустить

For yy = 1 To Me.datt
‘прибавить дату
keybd_event VK_SPACE, 0, 0, 0
keybd_event VK_SPACE, 0, KEYEVENTF_KEYUP, 0
For a = 1 To t: Next a
Next yy

Me.datt = 0
Else

‘прибавить дату 1 раз
keybd_event VK_SPACE, 0, 0, 0
keybd_event VK_SPACE, 0, KEYEVENTF_KEYUP, 0
For a = 1 To t: Next a

End If

‘ переход на колич
keybd_event VK_TAB, 0, 0, 0
keybd_event VK_TAB, 0, KEYEVENTF_KEYUP, 0
For a = 1 To t: Next a
keybd_event VK_TAB, 0, 0, 0
keybd_event VK_TAB, 0, KEYEVENTF_KEYUP, 0
For a = 1 To t: Next a
keybd_event VK_TAB, 0, 0, 0
keybd_event VK_TAB, 0, KEYEVENTF_KEYUP, 0
For a = 1 To t: Next a

‘ ввести колич за 1 смену
kol = Me.smena1

For zz = 1 To Len(kol)
qq = CharKey(Mid(kol, zz, 1))

keybd_event qq, 0, 0, 0
keybd_event qq, 0, KEYEVENTF_KEYUP, 0
For a = 1 To t: Next a
Next zz

‘ переход на колич минут
keybd_event VK_TAB, 0, 0, 0
keybd_event VK_TAB, 0, KEYEVENTF_KEYUP, 0
For a = 1 To t: Next a

‘ ввести колич
kol = Me.minn

For zz = 1 To Len(kol)
qq = CharKey(Mid(kol, zz, 1))

keybd_event qq, 0, 0, 0
keybd_event qq, 0, KEYEVENTF_KEYUP, 0
For a = 1 To t: Next a
Next zz

‘ переход на врача
keybd_event VK_TAB, 0, 0, 0
keybd_event VK_TAB, 0, KEYEVENTF_KEYUP, 0
For a = 1 To t: Next a
keybd_event VK_TAB, 0, 0, 0
keybd_event VK_TAB, 0, KEYEVENTF_KEYUP, 0
For a = 1 To t: Next a
keybd_event VK_TAB, 0, 0, 0
keybd_event VK_TAB, 0, KEYEVENTF_KEYUP, 0
For a = 1 To t: Next a
keybd_event VK_TAB, 0, 0, 0
keybd_event VK_TAB, 0, KEYEVENTF_KEYUP, 0
For a = 1 To t: Next a
keybd_event VK_TAB, 0, 0, 0
keybd_event VK_TAB, 0, KEYEVENTF_KEYUP, 0
For a = 1 To t: Next a

‘ вниз до нужного врача (колич нажатий)
kol = Me.vr1
For zz = 1 To kol
keybd_event VK_DOWN, 0, 0, 0
keybd_event VK_DOWN, 0, KEYEVENTF_KEYUP, 0
For a = 1 To t: Next a
Next zz

‘ ставим врача
keybd_event VK_TAB, 0, 0, 0
keybd_event VK_TAB, 0, KEYEVENTF_KEYUP, 0
For a = 1 To t: Next a

keybd_event VK_SPACE, 0, 0, 0
keybd_event VK_SPACE, 0, KEYEVENTF_KEYUP, 0
For a = 1 To t: Next a

‘ прыг до ок и пробел на нее
keybd_event VK_TAB, 0, 0, 0
keybd_event VK_TAB, 0, KEYEVENTF_KEYUP, 0
For a = 1 To t: Next a

keybd_event VK_TAB, 0, 0, 0
keybd_event VK_TAB, 0, KEYEVENTF_KEYUP, 0
For a = 1 To t: Next a

keybd_event VK_SPACE, 0, 0, 0
keybd_event VK_SPACE, 0, KEYEVENTF_KEYUP, 0
For a = 1 To t * 3: Next a

»»»»»»»»»»»»»»»»»»»»»»»»’ смена 2

‘ перейти на добавить запись и нажать пробел
keybd_event VK_TAB, 0, 0, 0
keybd_event VK_TAB, 0, KEYEVENTF_KEYUP, 0
For a = 1 To t: Next a

keybd_event VK_SPACE, 0, 0, 0
keybd_event VK_SPACE, 0, KEYEVENTF_KEYUP, 0
For a = 1 To t * 3: Next a

‘ переход на колич
keybd_event VK_TAB, 0, 0, 0
keybd_event VK_TAB, 0, KEYEVENTF_KEYUP, 0
For a = 1 To t: Next a
keybd_event VK_TAB, 0, 0, 0
keybd_event VK_TAB, 0, KEYEVENTF_KEYUP, 0
For a = 1 To t: Next a

‘ ставим смену
keybd_event VK_UP, 0, 0, 0
keybd_event VK_UP, 0, KEYEVENTF_KEYUP, 0
For a = 1 To t: Next a

keybd_event VK_TAB, 0, 0, 0
keybd_event VK_TAB, 0, KEYEVENTF_KEYUP, 0
For a = 1 To t: Next a

‘ ввести колич
kol = Me.smena2

For zz = 1 To Len(kol)
qq = CharKey(Mid(kol, zz, 1))

keybd_event qq, 0, 0, 0
keybd_event qq, 0, KEYEVENTF_KEYUP, 0
For a = 1 To t: Next a
Next zz

‘ переход на колич минут
keybd_event VK_TAB, 0, 0, 0
keybd_event VK_TAB, 0, KEYEVENTF_KEYUP, 0
For a = 1 To t: Next a

‘ ввести колич
kol = Me.minn

For zz = 1 To Len(kol)
qq = CharKey(Mid(kol, zz, 1))

keybd_event qq, 0, 0, 0
keybd_event qq, 0, KEYEVENTF_KEYUP, 0
For a = 1 To t: Next a
Next zz

‘ переход на врача
keybd_event VK_TAB, 0, 0, 0
keybd_event VK_TAB, 0, KEYEVENTF_KEYUP, 0
For a = 1 To t: Next a
keybd_event VK_TAB, 0, 0, 0
keybd_event VK_TAB, 0, KEYEVENTF_KEYUP, 0
For a = 1 To t: Next a
keybd_event VK_TAB, 0, 0, 0
keybd_event VK_TAB, 0, KEYEVENTF_KEYUP, 0
For a = 1 To t: Next a
keybd_event VK_TAB, 0, 0, 0
keybd_event VK_TAB, 0, KEYEVENTF_KEYUP, 0
For a = 1 To t: Next a
keybd_event VK_TAB, 0, 0, 0
keybd_event VK_TAB, 0, KEYEVENTF_KEYUP, 0
For a = 1 To t: Next a

‘ вниз до врача
kol = Me.vr2
For zz = 1 To kol
keybd_event VK_DOWN, 0, 0, 0
keybd_event VK_DOWN, 0, KEYEVENTF_KEYUP, 0
For a = 1 To t: Next a
Next zz

‘ ставим врача
keybd_event VK_TAB, 0, 0, 0
keybd_event VK_TAB, 0, KEYEVENTF_KEYUP, 0
For a = 1 To t: Next a

keybd_event VK_SPACE, 0, 0, 0
keybd_event VK_SPACE, 0, KEYEVENTF_KEYUP, 0
For a = 1 To t: Next a

‘ прыг до ок и пробел на нее
keybd_event VK_TAB, 0, 0, 0
keybd_event VK_TAB, 0, KEYEVENTF_KEYUP, 0
For a = 1 To t: Next a

keybd_event VK_TAB, 0, 0, 0
keybd_event VK_TAB, 0, KEYEVENTF_KEYUP, 0
For a = 1 To t: Next a

keybd_event VK_SPACE, 0, 0, 0
keybd_event VK_SPACE, 0, KEYEVENTF_KEYUP, 0
For a = 1 To t: Next a

»»»»»»»»»»»»»»»»»»»»»» конец смены 2

‘ вернемся в акцесс

zz = apiShowWindow(hwnd3, SW_SHOWNORMAL)
SetForegroundWindow (hwnd3)

End Sub

А еще там для этого надо иметь модуль и в нем кучку api функций. Примерно так.

Option Compare Database

‘Key codes
Public Const VK_LBUTTON As Integer = &H1
Public Const VK_RBUTTON As Integer = &H2
Public Const VK_CANCEL As Integer = &H3
Public Const VK_MBUTTON As Integer = &H4
Public Const VK_BACK As Integer = &H8
Public Const VK_TAB As Integer = &H9
Public Const VK_CLEAR As Integer = &HC
Public Const VK_RETURN As Integer = &HD
Public Const VK_SHIFT As Integer = &H10
Public Const VK_CONTROL As Integer = &H11
Public Const VK_MENU As Integer = &H12
Public Const VK_PAUSE As Integer = &H13
Public Const VK_CAPITAL As Integer = &H14
Public Const VK_ESCAPE As Integer = &H1B
Public Const VK_SPACE As Integer = &H20
Public Const VK_PRIOR As Integer = &H21
Public Const VK_NEXT As Integer = &H22
Public Const VK_END As Integer = &H23
Public Const VK_HOME As Integer = &H24
Public Const VK_LEFT As Integer = &H25
Public Const VK_UP As Integer = &H26
Public Const VK_RIGHT As Integer = &H27
Public Const VK_DOWN As Integer = &H28
Public Const VK_SELECT As Integer = &H29
Public Const VK_PRINT As Integer = &H2A
Public Const VK_EXECUTE As Integer = &H2B
Public Const VK_SNAPSHOT As Integer = &H2C
Public Const VK_INSERT As Integer = &H2D
Public Const VK_DELETE As Integer = &H2E
Public Const VK_HELP As Integer = &H2F
Public Const VK_0 As Integer = &H30
Public Const VK_1 As Integer = &H31
Public Const VK_2 As Integer = &H32
Public Const VK_3 As Integer = &H33
Public Const VK_4 As Integer = &H34
Public Const VK_5 As Integer = &H35
Public Const VK_6 As Integer = &H36
Public Const VK_7 As Integer = &H37
Public Const VK_8 As Integer = &H38
Public Const VK_9 As Integer = &H39
Public Const VK_A As Integer = &H41
Public Const VK_B As Integer = &H42
Public Const VK_C As Integer = &H43
Public Const VK_D As Integer = &H44
Public Const VK_E As Integer = &H45
Public Const VK_F As Integer = &H46
Public Const VK_G As Integer = &H47
Public Const VK_H As Integer = &H48
Public Const VK_I As Integer = &H49
Public Const VK_J As Integer = &H4A
Public Const VK_K As Integer = &H4B
Public Const VK_L As Integer = &H4C
Public Const VK_M As Integer = &H4D
Public Const VK_N As Integer = &H4E
Public Const VK_O As Integer = &H4F
Public Const VK_P As Integer = &H50
Public Const VK_Q As Integer = &H51
Public Const VK_R As Integer = &H52
Public Const VK_S As Integer = &H53
Public Const VK_T As Integer = &H54
Public Const VK_U As Integer = &H55
Public Const VK_V As Integer = &H56
Public Const VK_W As Integer = &H57
Public Const VK_X As Integer = &H58
Public Const VK_Y As Integer = &H59
Public Const VK_Z As Integer = &H5A
Public Const VK_STARTKEY As Integer = &H5B
Public Const VK_CONTEXTKEY As Integer = &H5D
Public Const VK_NUMPAD0 As Integer = &H60
Public Const VK_NUMPAD1 As Integer = &H61
Public Const VK_NUMPAD2 As Integer = &H62
Public Const VK_NUMPAD3 As Integer = &H63
Public Const VK_NUMPAD4 As Integer = &H64
Public Const VK_NUMPAD5 As Integer = &H65
Public Const VK_NUMPAD6 As Integer = &H66
Public Const VK_NUMPAD7 As Integer = &H67
Public Const VK_NUMPAD8 As Integer = &H68
Public Const VK_NUMPAD9 As Integer = &H69
Public Const VK_MULTIPLY As Integer = &H6A
Public Const VK_ADD As Integer = &H6B
Public Const VK_SEPARATOR As Integer = &H6C
Public Const VK_SUBTRACT As Integer = &H6D
Public Const VK_DECIMAL As Integer = &H6E
Public Const VK_DIVIDE As Integer = &H6F
Public Const VK_F1 As Integer = &H70
Public Const VK_F2 As Integer = &H71
Public Const VK_F3 As Integer = &H72
Public Const VK_F4 As Integer = &H73
Public Const VK_F5 As Integer = &H74
Public Const VK_F6 As Integer = &H75
Public Const VK_F7 As Integer = &H76
Public Const VK_F8 As Integer = &H77
Public Const VK_F9 As Integer = &H78
Public Const VK_F10 As Integer = &H79
Public Const VK_F11 As Integer = &H7A
Public Const VK_F12 As Integer = &H7B
Public Const VK_F13 As Integer = &H7C
Public Const VK_F14 As Integer = &H7D
Public Const VK_F15 As Integer = &H7E
Public Const VK_F16 As Integer = &H7F
Public Const VK_F17 As Integer = &H80
Public Const VK_F18 As Integer = &H81
Public Const VK_F19 As Integer = &H82
Public Const VK_F20 As Integer = &H83
Public Const VK_F21 As Integer = &H84
Public Const VK_F22 As Integer = &H85
Public Const VK_F23 As Integer = &H86
Public Const VK_F24 As Integer = &H87
Public Const VK_NUMLOCK As Integer = &H90
Public Const VK_OEM_SCROLL As Integer = &H91
Public Const VK_OEM_1 As Integer = &HBA
Public Const VK_OEM_PLUS As Integer = &HBB
Public Const VK_OEM_COMMA As Integer = &HBC
Public Const VK_OEM_MINUS As Integer = &HBD
Public Const VK_OEM_PERIOD As Integer = &HBE
Public Const VK_OEM_2 As Integer = &HBF
Public Const VK_OEM_3 As Integer = &HC0
Public Const VK_OEM_4 As Integer = &HDB
Public Const VK_OEM_5 As Integer = &HDC
Public Const VK_OEM_6 As Integer = &HDD
Public Const VK_OEM_7 As Integer = &HDE
Public Const VK_OEM_8 As Integer = &HDF
Public Const VK_ICO_F17 As Integer = &HE0
Public Const VK_ICO_F18 As Integer = &HE1
Public Const VK_OEM102 As Integer = &HE2
Public Const VK_ICO_HELP As Integer = &HE3
Public Const VK_ICO_00 As Integer = &HE4
Public Const VK_ICO_CLEAR As Integer = &HE6
Public Const VK_OEM_RESET As Integer = &HE9
Public Const VK_OEM_JUMP As Integer = &HEA
Public Const VK_OEM_PA1 As Integer = &HEB
Public Const VK_OEM_PA2 As Integer = &HEC
Public Const VK_OEM_PA3 As Integer = &HED
Public Const VK_OEM_WSCTRL As Integer = &HEE
Public Const VK_OEM_CUSEL As Integer = &HEF
Public Const VK_OEM_ATTN As Integer = &HF0
Public Const VK_OEM_FINNISH As Integer = &HF1
Public Const VK_OEM_COPY As Integer = &HF2
Public Const VK_OEM_AUTO As Integer = &HF3
Public Const VK_OEM_ENLW As Integer = &HF4
Public Const VK_OEM_BACKTAB As Integer = &HF5
Public Const VK_ATTN As Integer = &HF6
Public Const VK_CRSEL As Integer = &HF7
Public Const VK_EXSEL As Integer = &HF8
Public Const VK_EREOF As Integer = &HF9
Public Const VK_PLAY As Integer = &HFA
Public Const VK_ZOOM As Integer = &HFB
Public Const VK_NONAME As Integer = &HFC
Public Const VK_PA1 As Integer = &HFD
Public Const VK_OEM_CLEAR As Integer = &HFE

Public Const KEYEVENTF_EXTENDEDKEY As Long = &H1
Public Const KEYEVENTF_KEYUP As Long = &H2
Public Const INPUT_KEYBOARD As Long = 1

Public Const BM_CLICK = &HF5
Public Const GW_HWNDNEXT = 2
Public Const WM_SETFOCUS = &H7

Public Const SW_HIDE = 0
‘Скрывает это окно и передает активацию к другому окну.
Public Const SW_MINIMIZE = 6
‘Минимизирует окно и активизирует окно верхнего уровня в списке
‘системы.
Public Const SW_RESTORE = 9
‘Активизирует и отображает окно. Если окно минимизировано или максимизировано,
‘Windows восстанавливает его к его первоначальному
‘размеру и позиции.
Public Const SW_SHOW = 5
‘Активизирует окно и отображает его в текущем размере и позиции.
Public Const SW_MAXIMIZE = 3
Public Const SW_SHOWMAXIMIZED = 3
‘Активизирует окно и отображает его как максимизируемое окно.
Public Const SW_SHOWMINIMIZED = 2
‘Активизирует окно и отображает его как значок.
Public Const SW_SHOWMINNOACTIVE = 4
‘Отображает окно как значок. Окно, которое является в настоящее
‘время активным, остается активным.
Public Const SW_SHOWNA = 8
‘Отображает окно в его текущем состоянии. Окно, которое является в
‘настоящее время активным, остается активным.
Public Const SW_SHOWNOACTIVATE = 7
‘Отображает окно в его самом современном размере и позиции. Окно,
‘которое является в настоящее время активным, остается активным.
Public Const SW_SHOWNORMAL = 1
‘Активизирует и отображает окно. Если окно минимизировано или
‘максимизировано, Windows восстанавливает его к первоначальному
‘размеру и позиции.

Public Declare Function apiShowWindow Lib «user32» Alias «ShowWindow» (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long

Public Declare Function GetWindow Lib «user32» (ByVal hwnd As Long, ByVal wCmd As Long) As Long
Public Declare Function FindWindow Lib «user32» Alias «FindWindowA» (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Public Declare Function GetWindowThreadProcessId Lib «user32» (ByVal hwnd As Long, lpdwprocessid As Long) As Long
Public Declare Function GetWindowText Lib «user32» Alias «GetWindowTextA» (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Public Declare Function GetClassName Lib «user32» Alias «GetClassNameA» (ByVal hwnd As Long, ByVal lpClassName As String, ByVal nMaxCount As Long) As Long
Public Declare Function FindWindowEx Lib «user32» Alias «FindWindowExA» (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Public Declare Function IsWindowEnabled Lib «user32» (ByVal hwnd As Long) As Long
Public Declare Function SetFocus Lib «user32» (ByVal hwnd As Long) As Long
Public Declare Function SendMessage Lib «user32» Alias «SendMessageA» (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Public Declare Function CreateThread Lib «kernel32» (ByVal lpThreadAttributes As Any, ByVal dwStackSize As Long, ByVal lpStartAddress As Long, lpParameter As Any, ByVal dwCreationFlags As Long, lpThreadID As Long) As Long
Public Declare Function TerminateThread Lib «kernel32» (ByVal hThread As Long, ByVal dwExitCode As Long) As Long
Public Declare Function CloseHandle Lib «kernel32» (ByVal hObject As Long) As Long
Public Declare Function MessageBox Lib «user32» Alias «MessageBoxA» (ByVal hwnd As Long, ByVal lpText As String, ByVal lpCaption As String, ByVal wType As Long) As Long
Public Declare Function IsWindowVisible Lib «user32» (ByVal hwnd As Long) As Long

Public Declare Function BringWindowToTop Lib «user32» (ByVal hwnd As Long) As Long

Public Declare Function SetForegroundWindow Lib «user32» (ByVal hwnd As Long) As Long
Public Declare Function Sleep Lib «kernel32.dll» (ByVal dwMilliseconds As Long)

Public Declare Sub keybd_event Lib «user32» (ByVal bVk As Byte, _
ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Public Declare Function MapVirtualKey Lib «user32» Alias «MapVirtualKeyA» _
(ByVal uCode As Long, ByVal uMapType As Long) As Long

Public Function VirtualToScan(ByVal uCode As Long) As Long
VirtualToScan = MapVirtualKey(uCode, 0)
End Function
Public Function ScanToVirtual(ByVal uCode As Long) As Long
ScanToVirtual = MapVirtualKey(uCode, 3)
End Function
Public Function VirtualToASCII(ByVal uCode As Long) As Long
VirtualToASCII = MapVirtualKey(uCode, 2)
End Function

Public Sub pressrelease(vk As Integer)
keybd_event vk, 0, 0, 0
keybd_event vk, 0, KEYEVENTF_KEYUP, 0
End Sub
Public Sub TabKey()
pressrelease VK_TAB
End Sub
Public Sub ReturnKey()
pressrelease VK_RETURN
End Sub
Public Sub EscKey()
pressrelease VK_ESCAPE
End Sub
Public Sub ContextMenu()
pressrelease VK_CONTEXTKEY
End Sub
Public Sub FuncKey(ByVal i As Integer)
Dim vk As Integer
If i > 0 And i < 25 Then
vk = VK_F1 — 1 + i
pressrelease vk
End If
End Sub

Public Sub AltPress()
keybd_event VK_MENU, 0, 0, 0
End Sub
Public Sub CtrlPress()
keybd_event VK_CONTROL, 0, 0, 0
End Sub
Public Sub ShiftPress()
keybd_event VK_SHIFT, 0, 0, 0
End Sub
Public Sub WinPress()
keybd_event VK_STARTKEY, 0, 0, 0
End Sub

Public Sub AltRelease()
keybd_event VK_MENU, 0, KEYEVENTF_KEYUP, 0
End Sub
Public Sub CtrlRelease()
keybd_event VK_CONTROL, 0, KEYEVENTF_KEYUP, 0
End Sub
Public Sub WinRelease()
keybd_event VK_STARTKEY, 0, KEYEVENTF_KEYUP, 0
End Sub
Public Sub ShiftRelease()
keybd_event VK_SHIFT, 0, KEYEVENTF_KEYUP, 0
End Sub

Public Function CharKey(c As String) As Integer
Select Case UCase(c)
Case » »
CharKey = VK_SPACE
Case «0»
CharKey = VK_0
Case «1»
CharKey = VK_1
Case «2»
CharKey = VK_2
Case «3»
CharKey = VK_3
Case «4»
CharKey = VK_4
Case «5»
CharKey = VK_5
Case «6»
CharKey = VK_6
Case «7»
CharKey = VK_7
Case «8»
CharKey = VK_8
Case «9»
CharKey = VK_9
Case «A»
CharKey = VK_A
Case «B»
CharKey = VK_B
Case «C»
CharKey = VK_C
Case «D»
CharKey = VK_D
Case «E»
CharKey = VK_E
Case «F»
CharKey = VK_F
Case «G»
CharKey = VK_G
Case «H»
CharKey = VK_H
Case «I»
CharKey = VK_I
Case «J»
CharKey = VK_J
Case «K»
CharKey = VK_K
Case «L»
CharKey = VK_L
Case «M»
CharKey = VK_M
Case «N»
CharKey = VK_N
Case «O»
CharKey = VK_O
Case «P»
CharKey = VK_P
Case «Q»
CharKey = VK_Q
Case «R»
CharKey = VK_R
Case «S»
CharKey = VK_S
Case «T»
CharKey = VK_T
Case «U»
CharKey = VK_U
Case «V»
CharKey = VK_V
Case «W»
CharKey = VK_W
Case «X»
CharKey = VK_X
Case «Y»
CharKey = VK_Y
Case «Z»
CharKey = VK_Z
Case Else
CharKey = 0
End Select
End Function

Public Sub StringKey(s As String)
Dim i As Long, k As Integer
For i = 1 To Len(s)
k = CharKey(Mid(s, i, 1))
If k <> 0 Then pressrelease k
Next i
End Sub

Public Sub Cls()
WinPress
StringKey «d»
WinRelease
End Sub

Public Sub PrintScreen()
pressrelease VK_SNAPSHOT
End Sub
Public Sub AltPrintScreen()
AltPress
pressrelease VK_SNAPSHOT
AltRelease
End Sub

Function GetAppName(Lnghwnd As Long)
Dim LngResult As Long
Dim StrWinText As String * 255
Dim LngCCh As Long
LngResult = GetWindowText(Lnghwnd, StrWinText, 255)
GetAppName = Left(StrWinText, LngResult)
End Function

Function GetCountOfWindows(Lnghwnd, StrAppCaption)
Dim LngResult As Long
Dim LngICount As Long
Dim StrAppName As String

LngResult = GetWindow(Lnghwnd, 0) ‘GW_HWNDFIRST)

Do Until LngResult = 0
If IsWindowVisible(LngResult) Then
StrAppName = GetAppName(LngResult)
‘MsgBox «StrAppName1″ & » » & StrAppName
StrAppName = Left(StrAppName, 10)
‘MsgBox «StrAppName2″ & » » & StrAppName
If InStr(1, StrAppName, StrAppCaption) Then
LngICount = LngICount + 1
End If
End If
LngResult = GetWindow(LngResult, 2) ‘GW_HWNDNEXT)

Loop
GetCountOfWindows = LngICount
End Function

Public Function GetHandleWindow(fNaim As String, fClass As String, Optional fWnd As Long = 0) As Long
Dim hwnd As Long, pWnd As Long, sNaim As String, sClass As String
hwnd = FindWindow(vbNullString, vbNullString)
Do While hwnd <> 0
sNaim = String(255, vbNullChar)
Call GetWindowText(hwnd, sNaim, Len(sNaim))
sClass = String(255, vbNullChar)
Call GetClassName(hwnd, sClass, Len(sClass))
If fWnd = 0 Then pWnd = 0 Else Call GetWindowThreadProcessId(hwnd, pWnd)
If Left(sNaim, InStr(sNaim, vbNullChar) — 1) = fNaim And Left(sClass, InStr(sClass, vbNullChar) — 1) = fClass And pWnd = fWnd Then Exit Do
hwnd = GetWindow(hwnd, GW_HWNDNEXT)
Loop
GetHandleWindow = hwnd
End Function

Sub SendFile(Whom As String, Path As String, Note As String)
Dim Outlook As Object, Message As Object, lHandle As Long, lThreadId As Long
Set Outlook = CreateObject(«Outlook.Application»)
Set Message = Outlook.CreateItem(olMailItem)
Message.To = Whom
Message.Attachments.Add Path
Message.Subject = Note
lHandle = CreateThread(ByVal 0&, ByVal 0&, AddressOf Execute, ByVal 0&, ByVal 0&, lThreadId)
Message.Send
Call TerminateThread(lHandle, ByVal 0&)
Call CloseHandle(lHandle)
Set Message = Nothing
Outlook.Quit
Set Outlook = Nothing
End Sub

Даешь автоматизацию через одно место! Трепещите бюрократы!