Configurable AutoIt applets...

Other notes--> Looking for short term contract beginning July 1st...

Here's a sample for something I've been wanting
to do for sometime- make my autoit applets 'configurable'.
I thought there must be a way -- there is! Use '_IsPressed':

alt_tab.au3

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_icon=\\Mde2kfs01\share\Common\_CMD\_ICO\mail-send-receive.ico
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <Misc.au3>
Dim _
$sendkeys, _
$switch_cnt, _
$topmost_cnt, _
$ctrl_key, _
$z_alt_tab
;-
; Init
;-
; 'ctrl' pressed with .exe is indication
; that you want to configure the applet...
$dll = DllOpen("user32.dll")
If _IsPressed("11", $dll) Then $ctrl_key = 'Y'
DllClose($dll)
$topmost_cnt = ''
$topmost_cnt = RegRead('HKCU\SOFTWARE\alt_tab', '$topmost_cnt')
;-
; If necessary ~ requested -- prompt for
; values then exit...
If $topmost_cnt = '' Or $ctrl_key = 'Y' Then
$topmost_cnt = _
InputBox( _
@ScriptName, _
'$topmost_cnt?', _
$topmost_cnt _
)
If $topmost_cnt = '' Then Exit
RegWrite( _
'HKCU\Software\alt_tab', _
'$topmost_cnt', _
'REG_SZ', _
$topmost_cnt _
)
Exit
EndIf
;-
; Main
$switch_cnt = $topmost_cnt + 2
$sendkeys = '{AltDown}{Tab}{AltUp}'
;-
For $i = 1 To $switch_cnt
TrayTip( _
@ScriptName, _
$sendkeys & '(x $switch_cnt=' & $switch_cnt & ')', _
.25, _
1 _
)
Sleep(250)
Send($sendkeys)
Sleep(250)
Next
;-
Exit

No comments:

Favorite Tweets