topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Thursday November 13, 2025, 3:09 pm
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Recent Posts

Pages: prev1 ... 181 182 183 184 185 [186] 187 188 189 190 191 ... 309next
4626
General Software Discussion / Re: RunInTrayMod 1.2
« Last post by MilesAhead on December 11, 2011, 11:19 AM »
RunInTrayMod 1.2  Source cleaned up a bit more.

; RunInTrayMod - modified version of RunInTray utility found here:
; http://www.cellsworth.com/news/computer-related/35-uncategorizied/96-runintray.html
;
; The main modification to RunInTray is on detection of the window.
; A handle is obtained and used in Hide Show and Close operations.
; This way the client may change window caption and still respond
; to Hide, Show, and Close commands.
;
; Also Close is used instead of Kill to close the client app.
;
Global Const $TRAY_EVENT_PRIMARYUP = -8
Global Const $tagPOINT = "long X;long Y"
Global Const $tagGUID = "dword Data1;word Data2;word Data3;byte Data4[8]"
Global Const $HGDI_ERROR = Ptr(-1)
Global Const $INVALID_HANDLE_VALUE = Ptr(-1)
Global Const $KF_EXTENDED = 0x0100
Global Const $KF_ALTDOWN = 0x2000
Global Const $KF_UP = 0x8000
Global Const $LLKHF_EXTENDED = BitShift($KF_EXTENDED, 8)
Global Const $LLKHF_ALTDOWN = BitShift($KF_ALTDOWN, 8)
Global Const $LLKHF_UP = BitShift($KF_UP, 8)

AutoItSetOption("WinTitleMatchMode", -3)
AutoItSetOption("TrayOnEventMode", 1) ; Use event trapping for tray menu
AutoItSetOption("TrayMenuMode", 3) ; Default tray menu items will not be shown.

Const $delayMin = 1, $delayMax = 60
; call EmptyWorkingSet once a minute
Const $MemCountMax = 60

Global $Dir = "", $App = "", $handle = 0, $title = "", $memCount = 0, $delay = 0, $hasDelay = False

$iMsg = "Usage: " & @CRLF & @CRLF & "RunInTrayMod [ -d=n ] ProgramPath WorkingDir [ WindowTitle ]" & @CRLF
$iMsg &= "    (  -d=n is seconds delay : Valid range for n is " & $delayMin & " to " & $delayMax & "  )" & @CRLF & @CRLF
$iMsg &= "If any params contain space(s) wrap them in double quotes" & @CRLF & @CRLF
$iMsg &= "If App will not go to Tray specify exact Window Title as last param" & @CRLF & @CRLF
$iMsg &= "( If App leaves Icon in Taskbar when Trayed, it is not compatible )"

Switch $CmdLine[0]

Case 4
If Not StringInStr($CmdLine[1], "-d=") Then _ShowUsage($iMsg)
$delay = Number(StringMid($CmdLine[1], 4))
If $delay < $delayMin Or $delay > $delayMax Then $delay = 0
$App = $CmdLine[2]
$Dir = $CmdLine[3]
$title = $CmdLine[4]

Case 3
If StringInStr($CmdLine[1], "-d=") Then
$delay = Number(StringMid($CmdLine[1], 4))
If $delay < $delayMin Or $delay > $delayMax Then $delay = 0
$App = $CmdLine[2]
$Dir = $CmdLine[3]
Else
$App = $CmdLine[1]
$Dir = $CmdLine[2]
$title = $CmdLine[3]
EndIf

Case 2
If StringInStr($CmdLine[1], "-d=") Then _ShowUsage($iMsg)
$App = $CmdLine[1]
$Dir = $CmdLine[2]

Case Else
_ShowUsage($iMsg)

EndSwitch

$proc_Name = _FileNoPath($App)
$do_Kill = True

While $delay
TraySetToolTip(String($delay) & " Sec. to Launch " & _FileBaseName($App))
Sleep(1000)
$delay -= 1
WEnd

ShellExecute($App, "", $Dir)
Sleep(1000)
If $title <> "" Then
$handle = WinWait($title, "", 4)
If $handle = 0 Then
_ShowError("Could not get Handle for Window:" & @CRLF & @CRLF & $title)
EndIf
EndIf
If $handle = 0 Then
$handle = WinGetHandle(_WinGetByPID($proc_Name))
If $handle = "" Then
$iMsg = "Could Not Get Handle To: " & $proc_Name & @CRLF & @CRLF
$iMsg &= "Try adding Window Title to Command Line or Shortcut Target line"
_ShowError($iMsg)
EndIf
EndIf

TraySetIcon($App)
TraySetClick(8)
$hTray_Show_Item = TrayCreateItem("Hide")
$hTray_Donate_Item = TrayCreateItem("Donate")
TrayCreateItem("")
TrayCreateItem("Exit")
TrayItemSetOnEvent(-1, "On_Exit")
TrayItemSetOnEvent($hTray_Show_Item, "To_Tray")
TrayItemSetOnEvent($hTray_Donate_Item, "Donate")
TraySetOnEvent($TRAY_EVENT_PRIMARYUP, "To_Tray")
TraySetToolTip(_FileBaseName($App))
To_Tray()

While 1
Sleep(1000)
If Not ProcessExists($proc_Name) Then
$do_Kill = False
Exit
EndIf
$memCount += 1
If $memCount >= $MemCountMax Then
_EmptyWorkingSet()
$memCount = 0
EndIf
WEnd

Func On_Exit()
If $do_Kill Then WinClose(_WinAPI_GetWindowText($handle))
Exit
EndFunc   ;==>On_Exit

Func To_Tray()

If TrayItemGetText($hTray_Show_Item) = "Hide" Then
_WinAPI_ShowWindow($handle, @SW_HIDE)
TrayItemSetText($hTray_Show_Item, "Show")
Else
_WinAPI_ShowWindow($handle, @SW_SHOW)
TrayItemSetText($hTray_Show_Item, "Hide")
EndIf

EndFunc   ;==>To_Tray

Func Donate()
ShellExecute("http://www.favessoft.com/donate.html")
EndFunc   ;==>Donate

;--------------  Helper Functions Stripped from Includes  ------------

Func _WinAPI_GetWindowText($hWnd)
Local $aResult = DllCall("user32.dll", "int", "GetWindowTextW", "hwnd", $hWnd, "wstr", "", "int", 4096)
If @error Then Return SetError(@error, @extended, "")
Return SetExtended($aResult[0], $aResult[2])
EndFunc   ;==>_WinAPI_GetWindowText

Func _WinAPI_ShowWindow($hWnd, $iCmdShow = 5)
Local $aResult = DllCall("user32.dll", "bool", "ShowWindow", "hwnd", $hWnd, "int", $iCmdShow)
If @error Then Return SetError(@error, @extended, False)
Return $aResult[0]
EndFunc   ;==>_WinAPI_ShowWindow

Func _EmptyWorkingSet()
Local $result = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'long', -1)
Return $result[1]
EndFunc   ;==>_EmptyWorkingSet

Func _FileBaseName($path)
If $path = "" Then Return ""
If StringLen($path) < 3 Then Return ""
Local $pos = StringInStr($path, "\", 0, -1)
$pos += 1
Local $tmp = StringMid($path, $pos)
Return StringLeft($tmp, StringInStr($tmp, ".", 0, -1) - 1)
EndFunc   ;==>_FileBaseName

Func _FileNoPath($path)
Return StringMid($path, StringInStr($path, "\", 0, -1) + 1)
EndFunc   ;==>_FileNoPath

Func _ScriptBaseName()
Return StringLeft(@ScriptName, (StringInStr(@ScriptName, ".") - 1))
EndFunc   ;==>_ScriptBaseName

Func _ShowError($errorMsg, $title = "", $quit = True, $timeOut = 0)
If $title = "" Then $title = _ScriptBaseName()
MsgBox(0x1010, $title, $errorMsg, $timeOut)
If $quit Then Exit
EndFunc   ;==>_ShowError

Func _ShowUsage($usageMsg, $title = "", $quit = True, $timeOut = 0)
If $title = "" Then $title = _ScriptBaseName()
MsgBox(0x1040, $title, $usageMsg, $timeOut)
If $quit Then Exit
EndFunc   ;==>_ShowUsage

Func _WinGetByPID($iPID, $nArray = 1)
If IsString($iPID) Then $iPID = ProcessExists($iPID)
Local $aWList = WinList(), $sHold
For $iCC = 1 To $aWList[0][0]
If WinGetProcess($aWList[$iCC][1]) = $iPID And _
BitAND(WinGetState($aWList[$iCC][1]), 2) Then
If $nArray Then Return $aWList[$iCC][0]
$sHold &= $aWList[$iCC][0] & Chr(1)
EndIf
Next
If $sHold Then Return StringSplit(StringTrimRight($sHold, 1), Chr(1))
Return SetError(1, 0, 0)
EndFunc   ;==>_WinGetByPID
4627
General Software Discussion / Re: RunInTrayMod 1.1
« Last post by MilesAhead on December 10, 2011, 02:37 PM »
Here's the source to RunInTrayMod condensed to a single file. I used Obfuscator to eliminate the include files:

RunInTrayMod.au3

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_UseUpx=n
#AutoIt3Wrapper_Res_Fileversion=1.2.0.0
#AutoIt3Wrapper_Res_Language=1033
#AutoIt3Wrapper_Res_Field=Productname|RunInTrayMod
#AutoIt3Wrapper_Res_Field=Productversion|1.2
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****


; RunInTrayMod - modified version of RunInTray utility found here:
; http://www.cellsworth.com/news/computer-related/35-uncategorizied/96-runintray.html
;
; The main modification to RunInTray is on detection of the window.
; A handle is obtained and used in Hide Show and Close operations.
; This way the client may change window caption and still respond
; to Hide, Show, and Close commands.
;
; Also Close is used instead of Kill to close the client app.
;
Global Const $__WINVER = __Ver()
Global Const $TRAY_EVENT_PRIMARYUP = -8
Global Const $tagPOINT = "long X;long Y"
Global Const $tagGUID = "dword Data1;word Data2;word Data3;byte Data4[8]"
Global Const $HGDI_ERROR = Ptr(-1)
Global Const $INVALID_HANDLE_VALUE = Ptr(-1)
Global Const $KF_EXTENDED = 0x0100
Global Const $KF_ALTDOWN = 0x2000
Global Const $KF_UP = 0x8000
Global Const $LLKHF_EXTENDED = BitShift($KF_EXTENDED, 8)
Global Const $LLKHF_ALTDOWN = BitShift($KF_ALTDOWN, 8)
Global Const $LLKHF_UP = BitShift($KF_UP, 8)
Global Const $tagNOTIFYICONDATA = 'dword Size;hwnd hWnd;uint ID;uint Flags;uint CallbackMessage;ptr hIcon;wchar Tip[128];dword State;dword StateMask;wchar Info[256];uint Version;wchar InfoTitle[64];dword InfoFlags;'
Global Const $tagPRINTDLG = 'align 2;dword_ptr Size;hwnd hOwner;ptr hDevMode;ptr hDevNames;hwnd hDC;dword Flags;ushort FromPage;ushort ToPage;ushort MinPage;ushort MaxPage;' & __Iif(@AutoItX64, 'uint', 'ushort') & ' Copies;ptr hInstance;lparam lParam;ptr PrintHook;ptr SetupHook;ptr PrintTemplateName;ptr SetupTemplateName;ptr hPrintTemplate;ptr hSetupTemplate;'

AutoItSetOption("WinTitleMatchMode", -3)
AutoItSetOption("TrayOnEventMode", 1) ; Use event trapping for tray menu
AutoItSetOption("TrayMenuMode", 3) ; Default tray menu items will not be shown.

Const $delayMin = 1, $delayMax = 60
; call EmptyWorkingSet once a minute
Const $MemCountMax = 60

Global $Dir = "", $App = "", $handle = 0, $title = "", $memCount = 0, $delay = 0, $hasDelay = False

$iMsg = "Usage: " & @CRLF & @CRLF & "RunInTrayMod [ -d=n ] ProgramPath WorkingDir [ WindowTitle ]" & @CRLF
$iMsg &= "    (  -d=n is seconds delay : Valid range for n is " & $delayMin & " to " & $delayMax & "  )" & @CRLF & @CRLF
$iMsg &= "If any params contain space(s) wrap them in double quotes" & @CRLF & @CRLF
$iMsg &= "If App will not go to Tray specify exact Window Title as last param" & @CRLF & @CRLF
$iMsg &= "( If App leaves Icon in Taskbar when Trayed, it is not compatible )"

Switch $CmdLine[0]

Case 4
If Not StringInStr($CmdLine[1], "-d=") Then _ShowUsage($iMsg)
$delay = Number(StringMid($CmdLine[1], 4))
If $delay < $delayMin Or $delay > $delayMax Then $delay = 0
$App = $CmdLine[2]
$Dir = $CmdLine[3]
$title = $CmdLine[4]

Case 3
If StringInStr($CmdLine[1], "-d=") Then
$delay = Number(StringMid($CmdLine[1], 4))
If $delay < $delayMin Or $delay > $delayMax Then $delay = 0
$App = $CmdLine[2]
$Dir = $CmdLine[3]
Else
$App = $CmdLine[1]
$Dir = $CmdLine[2]
$title = $CmdLine[3]
EndIf

Case 2
If StringInStr($CmdLine[1], "-d=") Then _ShowUsage($iMsg)
$App = $CmdLine[1]
$Dir = $CmdLine[2]

Case Else
_ShowUsage($iMsg)

EndSwitch

$proc_Name = _FileNoPath($App)
$do_Kill = True

While $delay
TraySetToolTip(String($delay) & " Sec. to Launch " & _FileBaseName($App))
Sleep(1000)
$delay -= 1
WEnd

ShellExecute($App, "", $Dir)
Sleep(1000)
If $title <> "" Then
$handle = WinWait($title, "", 4)
If $handle = 0 Then
_ShowError("Could not get Handle for Window:" & @CRLF & @CRLF & $title)
EndIf
EndIf
If $handle = 0 Then
$handle = WinGetHandle(_WinGetByPID($proc_Name))
If $handle = "" Then
$iMsg = "Could Not Get Handle To: " & $proc_Name & @CRLF & @CRLF
$iMsg &= "Try adding Window Title to Command Line or Shortcut Target line"
_ShowError($iMsg)
EndIf
EndIf

TraySetIcon($App)
TraySetClick(8)
$hTray_Show_Item = TrayCreateItem("Hide")
$hTray_Donate_Item = TrayCreateItem("Donate")
TrayCreateItem("")
TrayCreateItem("Exit")
TrayItemSetOnEvent(-1, "On_Exit")
TrayItemSetOnEvent($hTray_Show_Item, "To_Tray")
TrayItemSetOnEvent($hTray_Donate_Item, "Donate")
TraySetOnEvent($TRAY_EVENT_PRIMARYUP, "To_Tray")
TraySetToolTip(_FileBaseName($App))
To_Tray()

While 1
Sleep(1000)
If Not ProcessExists($proc_Name) Then
$do_Kill = False
Exit
EndIf
$memCount += 1
If $memCount >= $MemCountMax Then
_ReduceMemory()
$memCount = 0
EndIf
WEnd

Func On_Exit()
If $do_Kill Then WinClose(_WinAPI_GetWindowText($handle))
Exit
EndFunc   ;==>On_Exit

Func To_Tray()

If TrayItemGetText($hTray_Show_Item) = "Hide" Then
_WinAPI_ShowWindow($handle, @SW_HIDE)
TrayItemSetText($hTray_Show_Item, "Show")
Else
_WinAPI_ShowWindow($handle, @SW_SHOW)
TrayItemSetText($hTray_Show_Item, "Hide")
EndIf

EndFunc   ;==>To_Tray

Func Donate()
ShellExecute("http://www.favessoft.com/donate.html")
EndFunc   ;==>Donate

;--------------  Helper Functions Stripped from Includes  ------------

Func _WinAPI_GetWindowText($hWnd)
Local $aResult = DllCall("user32.dll", "int", "GetWindowTextW", "hwnd", $hWnd, "wstr", "", "int", 4096)
If @error Then Return SetError(@error, @extended, "")
Return SetExtended($aResult[0], $aResult[2])
EndFunc   ;==>_WinAPI_GetWindowText

Func _WinAPI_ShowWindow($hWnd, $iCmdShow = 5)
Local $aResult = DllCall("user32.dll", "bool", "ShowWindow", "hwnd", $hWnd, "int", $iCmdShow)
If @error Then Return SetError(@error, @extended, False)
Return $aResult[0]
EndFunc   ;==>_WinAPI_ShowWindow

Func __Iif($fTest, $iTrue, $iFalse)
If $fTest Then
Return $iTrue
Else
Return $iFalse
EndIf
EndFunc   ;==>__Iif

Func __Ver()
Local $tOSVI, $Ret
$tOSVI = DllStructCreate('dword Size;dword MajorVersion;dword MinorVersion;dword BuildNumber;dword PlatformId;wchar CSDVersion[128]')
DllStructSetData($tOSVI, 'Size', DllStructGetSize($tOSVI))
$Ret = DllCall('kernel32.dll', 'int', 'GetVersionExW', 'ptr', DllStructGetPtr($tOSVI))
If (@error) Or (Not $Ret[0]) Then
Return SetError(1, 0, 0)
EndIf
Return BitOR(BitShift(DllStructGetData($tOSVI, 'MajorVersion'), -8), DllStructGetData($tOSVI, 'MinorVersion'))
EndFunc   ;==>__Ver

Func _WinVersion($retAsString = 0)
Local $dwVersion = DllCall("kernel32.dll", "dword", "GetVersion")
Local $versionStr = String(BitAND($dwVersion[0], 0x00FF))
$versionStr &= "." & String(BitShift(BitAND($dwVersion[0], 0xFF00), 8))
If $retAsString Then Return $versionStr
Return Number($versionStr)
EndFunc   ;==>_WinVersion

Func _ReduceMemory($i_PID = -1)
If _WinVersion() < 5 Then Return False
If $i_PID <> -1 Then
Local $ai_Handle = DllCall("kernel32.dll", 'int', 'OpenProcess', 'int', 0x1f0fff, 'int', False, 'int', $i_PID)
Local $ai_Return = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'long', $ai_Handle[0])
DllCall('kernel32.dll', 'int', 'CloseHandle', 'int', $ai_Handle[0])
Else
Local $ai_Return = DllCall("psapi.dll", 'int', 'EmptyWorkingSet', 'long', -1)
EndIf
Return $ai_Return[0]
EndFunc   ;==>_ReduceMemory

Func _FileBaseName($path)
If $path = "" Then Return ""
If StringLen($path) < 3 Then Return ""
Local $pos = StringInStr($path, "\", 0, -1)
$pos += 1
Local $tmp = StringMid($path, $pos)
Return StringLeft($tmp, StringInStr($tmp, ".", 0, -1) - 1)
EndFunc   ;==>_FileBaseName

Func _FileNoPath($path)
Return StringMid($path, StringInStr($path, "\", 0, -1) + 1)
EndFunc   ;==>_FileNoPath

Func _ScriptBaseName()
Return StringLeft(@ScriptName, (StringInStr(@ScriptName, ".") - 1))
EndFunc   ;==>_ScriptBaseName

Func _ShowError($errorMsg, $title = "", $quit = True, $timeOut = 0)
If $title = "" Then $title = _ScriptBaseName()
MsgBox(0x1010, $title, $errorMsg, $timeOut)
If $quit Then Exit
EndFunc   ;==>_ShowError

Func _ShowUsage($usageMsg, $title = "", $quit = True, $timeOut = 0)
If $title = "" Then $title = _ScriptBaseName()
MsgBox(0x1040, $title, $usageMsg, $timeOut)
If $quit Then Exit
EndFunc   ;==>_ShowUsage

Func _WinGetByPID($iPID, $nArray = 1)
If IsString($iPID) Then $iPID = ProcessExists($iPID)
Local $aWList = WinList(), $sHold
For $iCC = 1 To $aWList[0][0]
If WinGetProcess($aWList[$iCC][1]) = $iPID And _
BitAND(WinGetState($aWList[$iCC][1]), 2) Then
If $nArray Then Return $aWList[$iCC][0]
$sHold &= $aWList[$iCC][0] & Chr(1)
EndIf
Next
If $sHold Then Return StringSplit(StringTrimRight($sHold, 1), Chr(1))
Return SetError(1, 0, 0)
EndFunc   ;==>_WinGetByPID

Here's the source for the shortcut generator stripped of includes.  See zip attachment for custom icon.

StartMinShortcut.au3

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_icon=lightning.ico
#AutoIt3Wrapper_UseUpx=n
#AutoIt3Wrapper_Res_Fileversion=1.1.0.0
#AutoIt3Wrapper_Res_Language=1033
#AutoIt3Wrapper_Res_Field=Productname|StartMinShortcut
#AutoIt3Wrapper_Res_Field=Productversion|1.1
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

Global Const $tagPOINT = "long X;long Y"
Global Const $tagGUID = "dword Data1;word Data2;word Data3;byte Data4[8]"
Global Const $HGDI_ERROR = Ptr(-1)
Global Const $INVALID_HANDLE_VALUE = Ptr(-1)
Global Const $KF_EXTENDED = 0x0100
Global Const $KF_ALTDOWN = 0x2000
Global Const $KF_UP = 0x8000
Global Const $LLKHF_EXTENDED = BitShift($KF_EXTENDED, 8)
Global Const $LLKHF_ALTDOWN = BitShift($KF_ALTDOWN, 8)
Global Const $LLKHF_UP = BitShift($KF_UP, 8)
Global Const $__WINVER = __Ver()
Global Const $tagNOTIFYICONDATA = 'dword Size;hwnd hWnd;uint ID;uint Flags;uint CallbackMessage;ptr hIcon;wchar Tip[128];dword State;dword StateMask;wchar Info[256];uint Version;wchar InfoTitle[64];dword InfoFlags;'
Global Const $tagPRINTDLG = 'align 2;dword_ptr Size;hwnd hOwner;ptr hDevMode;ptr hDevNames;hwnd hDC;dword Flags;ushort FromPage;ushort ToPage;ushort MinPage;ushort MaxPage;' & __Iif(@AutoItX64, 'uint', 'ushort') & ' Copies;ptr hInstance;lparam lParam;ptr PrintHook;ptr SetupHook;ptr PrintTemplateName;ptr SetupTemplateName;ptr hPrintTemplate;ptr hSetupTemplate;'


$delayStr = "0"
$delay = 0
$exe = ""
$work = ""
$target = ""
$title = ""
$shortname = ""
$shortcut = ""
$startfolder = @AppDataCommonDir & "\Microsoft\Windows\Start Menu"

If $CmdLine[0] Then
If FileExists($CmdLine[1]) And StringInStr($CmdLine[1], ".lnk") Then
$shortcut = $CmdLine[1]
EndIf
Else
$shortcut = FileOpenDialog("Select a Shortcut to Start Minimized in Tray", $startfolder, "Shortcuts (*.lnk)", 3, $startfolder & "\*.lnk")
If @error Then _ShowUsage("No Shortcut Chosen")
EndIf

$details = FileGetShortcut($shortcut)
If IsArray($details) Then
$exe = _QuoteStr($details[0])
$work = _QuoteStr($details[1])
If $work = "" Then
$work = _QuoteStr(_FileDirNoSlash($details[0]))
EndIf
$shortname = @DesktopDir & "\" & _FileBaseName($details[0]) & "_Trayed.lnk"
$delayStr = InputBox(_FileBaseName(@ScriptName), "    Enter Start Delay in Seconds" _
& @CRLF & @CRLF & "    (  Range 1 to 60 : 0 for No Delay  )", $delayStr)

If $delayStr <> "" Then
$delay = Int($delayStr)
If $delay Then
$delayStr = "-d=" & String($delay)
Else
$delayStr = ""
EndIf
EndIf

If MsgBox(0x1024, _FileBaseName(@ScriptName), "Run Program to add Window Title ?") = 6 Then
ShellExecute($shortcut)
Sleep(4000)
$title = WinGetTitle("[Active]")
$title = InputBox(_FileBaseName(@ScriptName), "Enter Exact Window Title", $title)
EndIf
$target = $delayStr & " " & $exe & " " & $work
If $title <> "" Then $target &= " " & _QuoteStr($title)
FileCreateShortcut("RunInTrayMod.exe", $shortname, "", $target)
ShellExecute(@StartupDir)
EndIf

;--------------  Helper Functions  ---------------

Func __Iif($fTest, $iTrue, $iFalse)
If $fTest Then
Return $iTrue
Else
Return $iFalse
EndIf
EndFunc   ;==>__Iif

Func __Ver()
Local $tOSVI, $Ret
$tOSVI = DllStructCreate('dword Size;dword MajorVersion;dword MinorVersion;dword BuildNumber;dword PlatformId;wchar CSDVersion[128]')
DllStructSetData($tOSVI, 'Size', DllStructGetSize($tOSVI))
$Ret = DllCall('kernel32.dll', 'int', 'GetVersionExW', 'ptr', DllStructGetPtr($tOSVI))
If (@error) Or (Not $Ret[0]) Then
Return SetError(1, 0, 0)
EndIf
Return BitOR(BitShift(DllStructGetData($tOSVI, 'MajorVersion'), -8), DllStructGetData($tOSVI, 'MinorVersion'))
EndFunc   ;==>__Ver

Func _QuoteStr($str)
If StringInStr($str, " ") Then
Return '"' & $str & '"'
EndIf
Return $str
EndFunc   ;==>_QuoteStr

;show usage msg and optionally quit with optional timeout
Func _ShowUsage($usageMsg, $title = "", $quit = True, $timeOut = 0)
If $title = "" Then $title = _ScriptBaseName()
MsgBox(0x1040, $title, $usageMsg, $timeOut)
If $quit Then Exit
EndFunc   ;==>_ShowUsage

; Return Directory part of path without trailing slash
Func _FileDirNoSlash($path)
Return StringLeft($path, StringInStr($path, "\", 0, -1) - 1)
EndFunc   ;==>_FileDirNoSlash

; return the basename part of a file path
; works only for files with extension
; e.g. returns "test" for c:\folder\test.exe path
;
Func _FileBaseName($path)
If $path = "" Then Return ""
If StringLen($path) < 3 Then Return ""

Local $pos = StringInStr($path, "\", 0, -1)
$pos += 1
Local $tmp = StringMid($path, $pos)
Return StringLeft($tmp, StringInStr($tmp, ".", 0, -1) - 1)
EndFunc   ;==>_FileBaseName

;return @ScriptName without extension
;useful for MsgBox titles or path
;building
;
Func _ScriptBaseName()
Return StringLeft(@ScriptName, (StringInStr(@ScriptName, ".") - 1))
EndFunc   ;==>_ScriptBaseName

4628
Post New Requests Here / Re: IDEA: Selected Text Count
« Last post by MilesAhead on December 09, 2011, 07:54 PM »
This version should be a bit smoother.  Instead of having to hold the mouse key down, select text or folders in Explorer, whatever.  Then hold down both Control keys, and release, to get the count. The ToolTip will display near the mouse cursor. The ToolTip will disappear on next mouse click.

#SingleInstance force
#NoEnv
SendMode Input
SetWorkingDir %A_ScriptDir%
if (A_IsCompiled)
  Menu Tray,Icon,%A_ScriptFullPath%,1

count := 0
Selected := ""
SaveClipboard := ""
Return

~LButton::
  ToolTip
Return

~LControl & ~RControl::
  SaveClipboard := Clipboard
  Clipboard =
  Send ^c
  ClipWait,1
  Selected = %Clipboard%
  if not Selected
    Return
  gosub,doToolTip
  Clipboard := SaveClipboard
Return

doToolTip:
  Loop, parse, clipboard, `n, `r
  {
    count := A_Index
  }
  ToolTip,%count%
Return

4629
Post New Requests Here / Re: IDEA: Selected Text Count
« Last post by MilesAhead on December 09, 2011, 11:54 AM »
You can experiment with this AHK script. I'm using AutoHotKey_L as sometimes that makes a difference.

For it to show the ToolTip you need to have the left mouse button down, then press and release the Left Control key. If you prefer right control key change LControl to RControl.

Should work for situations where you can select with the mouse, then keep the
mouse button down. The ToolTip clears the next time you click the mouse.

The reason for that is if it's active regardless of the mouse button state, it will be churning stuff to the clipboard to get the count.  Also it would likely interfere with using the clipboard normally. As it is, in the script I save clipboard text and restore it.  Saving everything, such as large graphics, would likely slow it down quite a bit.

If you get it to work to your liking you can compile with AHK_L and even add a custom icon to show in the tray. To get it to display the icon compiled into the exe, use these lines near the top:
if (A_IsCompiled)
  Menu Tray,Icon,%A_ScriptFullPath%,1

Selected Count Script

#SingleInstance force
#NoEnv
SendMode Input
SetWorkingDir %A_ScriptDir%

count := 0
Selected := ""
SaveClipboard := ""
Return

~LButton::
  ToolTip
Return

~LControl::
  if not GetKeyState("LButton")
    Return
  SaveClipboard := Clipboard
  Clipboard =
  Send ^c
  ClipWait,1
  Selected = %Clipboard%
  if not Selected
    Return
  gosub,doToolTip
  Clipboard := SaveClipboard
Return

doToolTip:
  Loop, parse, clipboard, `n, `r
  {
    count := A_Index
  }
  ToolTip,%count%
Return
4630
General Software Discussion / Re: DuckDuckGo - new search engine
« Last post by MilesAhead on December 08, 2011, 03:14 PM »
I've been using it in my browser address bar search. I just noticed the "bang syntax" feature.  Much more convenient that using "site:domain.com" and they seem to have accumulated quite a list of domains to work with it.

I like being able to look up a WinAPI call just by doing
!msdn FindFirstFile
4631
General Software Discussion / Re: Url Pack 1.3.0.6
« Last post by MilesAhead on December 07, 2011, 03:45 PM »
Url Pack 1.3.0.6

v. 1.3.0.6  Fixed url file parsing to accommodate IE format.

v. 1.3.0.5  Added MaxThon 2 browser support.

Note: In IE 8 the "drag addresbar to desktop" technique does not work.  But you can do the same thing using File Menu, Send => Shortcut to Desktop.

MaxThon may have something similar.

I installed MaxThon 2 and 3 just to get the window class names and try out some basic functions. But, to be honest, these browsers are in such an unusable state after install that I really don't want to configure each one. I don't like to run Browsers that use IE engine since I got burned by a BHO some years ago.

The main issue now with IE is there seems to be a bug with settings to open new urls in tabs. It just doesn't work.  At least it doesn't work right on IE 8.

I tried opening the pack with MaxThon 2, then MaxThom 3 the active window.  New tabs were opened as expected.

4632
General Software Discussion / Re: Url Pack 1.3.0.4
« Last post by MilesAhead on December 07, 2011, 02:38 PM »
will it work if the desktop is set to not display any icons?

I would expect the .url files would still be detected and moved. If it doesn't work let me know. I'll have to come up with a capture from the address bar to make url shortcuts directly in the URLS folder.
4633
General Software Discussion / Re: software/script/code/macro repositories
« Last post by MilesAhead on December 06, 2011, 06:29 PM »
Here's a couple of useful forums:

http://www.autohotke...56a61f80a89406c65b50

http://www.autoitscr...m/9-example-scripts/

Although it's scripting, many of the user libraries and contributed functions use WinAPI calls.  In fact AutoIt has a couple of UDF libraries of WinAPI functions with AutoIt wrappers.

Same with AHK. Many of the small useful functions use DllCall to call a WinAPI. There's so many API calls it's easy to overlook items.
4634
General Software Discussion / Re: Url Pack 1.3.0.4
« Last post by MilesAhead on December 06, 2011, 05:53 PM »
Url Pack 1.3.0.4 Added MaxThon 3 to supported browser list.
4635
General Software Discussion / Re: Transpose 2.3.0.1
« Last post by MilesAhead on December 06, 2011, 05:04 PM »
Transpose 2.3.0.1 Now AutoCopy using Shift/Release while Left Mouse Button down no longer sends a Click to deselect the text.  AutoCopy sounds a tone to verify something was copied to clipboard. Deselecting the text is no longer needed as an indicator. Also it interfered with timing letting off the mouse button.  Now it's not so touchy.  Select text and keep mouse button down.  Press and release Shift key. You should hear the tone as text is now in clipboard.

If you want to clear the selection just click the mouse yourself.  The text will still be in the clipboard.
4636
General Software Discussion / Re: Transpose 2.3.0.0
« Last post by MilesAhead on December 06, 2011, 01:15 PM »
Transpose 2.3.0.0 IE Browser is no longer supported.  Also listed editors and browsers that support Control-t Transpose function in About Dialog.
4637
Find And Run Robot / Re: Latest FARR Release v2.107.04 beta - Sep 23, 2012
« Last post by MilesAhead on December 05, 2011, 11:58 PM »
Just a note. The help file still says to check the option in General Tab to copy selected text on open. You actually have to edit the start hotkey pause/break entry.  Took me a while to find it. Makes it handy for looking stuff up in dictionary from any app. :)

4638
General Software Discussion / Re: Transpose 2.2.7.3
« Last post by MilesAhead on December 05, 2011, 08:51 PM »
Transpose 2.2.7.3 Removed a couple of redundant text copy to clipboard keys. I think I've come up with a smooth AutoCopy selected text to clipboard.  Select text but hold left mouse button down until you press and release Shift.  If selected text is copied to clipboard you should hear a tone.

See the about dialog for current sets of hotkeys.
4639
General Software Discussion / Re: Url Pack 1.3.0.3
« Last post by MilesAhead on December 04, 2011, 06:52 PM »
Url Pack 1.3.0.3 Some minor fixes. Now pressing Esc key closes the Gui.

Rewrote the Readme.txt file.
4640
Nice! It doesn't really work with my way of browsing, but I'm sure it'll find its audience.  :up:

Thanks. Yeah, it's more for the "blank page" or "speed dial" crowd. One thing about Chromium, if you bring it up blank, even if the disk is quite busy it loads in snappy fashion.

I tend to play around too much with the snap shots though. After diddling around with a bunch of the 17.x versions I've gone back to trusty rusty Oct. 4 16.0.900.0. Just seems very solid and I haven't seen anything I want in 17.x

A bit off topic but have you noticed the Disable Hyperlink Auditing flag in about:flags ?? Apparently the next scheme for html5 is every time you click a link, a notice is sent to the tracking site.  Doesn't need tracking cookies anymore. It goes over in real time.

When I first noticed it I thought it was a ping to make sure the site existed before trying to load the page. Uh, not quite!!
4641
My kludge is in a usable form. It's more for those who work the opposite of multi-tab.  If you normally bring up your browser to a blank page this utility can open a collection of pages with adjustable delays:

https://www.donation...ex.php?topic=29029.0

Instead of wandering the wilderness looking for ways to drag deskCuts onto a Gui I took advantage of the fact most browsers let you drag the address bar icon from the start of the address onto the desktop to make a shortcut.

You hit the hotkey to gather all the deskCuts.  There's 2 modes of operation to launch.  See the thread in the link and the included Readme for details.

But as example, I just booted up.  No browser running.  I hit Alt-F10 then Enter and Chromium opened with DonationCoder Hotmail Vista Forums Windows Seven Forums open in tabs.
4642
General Software Discussion / Re: Url Pack 1.3.0.0
« Last post by MilesAhead on December 03, 2011, 11:16 PM »
Url Pack 1.3.0.0 There may still be a bug or 2 but this is getting less clunky now.  Removed ini file DefaultBrowser option.  The program only has one hotkey. It can be set via command line or ini file.

There are 2 modes.

1) You hit the hotkey and a supported browser is not the active window:
The Gui comes up like before.

2) You hit the hotkey with a supported browser as the active window:
It gets the path of the browser's exe and uses it to open the Url Pack
if it's the default browser or not.  No need to change settings to use
the pack with any browser.

Looks like the major functions are in place. Now just hunting down minor bugs.
4643
General Software Discussion / Re: Transpose 2.2.7.2
« Last post by MilesAhead on December 03, 2011, 08:18 PM »
Transpose 2.2.7.2 Added Hotkey Alt Click in supported browser windows.

Purpose: You are on a page that has a url in text that's not enabled as a link. Ordinarily you would select text, open new tab, paste, or use a tab extension to enable automating that action. With this Transpose update, select the text and Alt Click the mouse on a neutral spot. It's done for you. (The reason to click on a neutral spot is a Click is sent to the page to clear the text selection.)

This hotkey is only enabled while a supported browser window is active. It gets the exe path of the browser from the active window and runs it.  The selection is only added as a command line param.
Therefore it should be safe. If you select "del *.*" and do Alt Click the result would be(assuming firefox browser)  running this command "c:\program files\mozilla firefox\firefox.exe del *.*" which will just produce a 404 error.  Not delete files. :)
4644
General Software Discussion / Re: Url Pack 1.2.2.0
« Last post by MilesAhead on December 03, 2011, 06:41 PM »
Url Pack 1.2.2.0 Minor fixes. Mostly the delay input boxes. Making them modal.  Also they keep opening until dismissed or a valid value is entered.
4645
Found Deals and Discounts / Newsbin Pro 6.2 Final is out
« Last post by MilesAhead on December 03, 2011, 05:15 PM »
6.2 has gone Final

http://www.newsbin.com/beta.php

Looks like they are going with 2 tier pricing.  With and without search. Not sure if they still have the special GigaNews edition at a discount.

4646
General Software Discussion / Re: software directories
« Last post by MilesAhead on December 03, 2011, 03:36 PM »
Now and then I hit a gem on this site:
http://www.techsupportalert.com/

Often the reviews are for utilities with names you know. But the user comments sometimes mention a nice program flying under the radar.

Sometimes this site is handy:
http://alternativeto.net/

Also I do like Softpedia:
http://win.softpedia.com/

I often search Softpedia. If I find an app that looks interesting then I try to find the home page.  Softpedia can be several versions behind. Once I know the exact app name I can usually dig out the latest version.
4647
General Software Discussion / Re: Url Pack 1.2.0.0
« Last post by MilesAhead on December 03, 2011, 03:31 PM »
Url Pack 1.2.0.0 If Gui gets under other application windows, now hitting the hotkey again will bring it to the top.  Added DefaultBrowser option to ini file.  See Readme Tip section for usage.  Added Edit IniFile command to Tray Menu.

Edit IniFile adds comments to the start of the ini file with info on hotkey modifiers. But the main convenience is being able to edit while UrlPack.exe is running.  The script reloads to refresh settings from the ini file when the edit is complete.
4648
It's been so long since I did the favicon for my site that I'm not sure what I used to make the icon from the jpg. But it's a single 16x16.

Glad it worked for you.

4649
General Software Discussion / Re: Url Pack 1.1.0.0
« Last post by MilesAhead on December 03, 2011, 03:06 AM »
Url Pack 1.1.0.0 Gui button fixes.
4650
General Software Discussion / Url Pack 1.7.0.0
« Last post by MilesAhead on December 03, 2011, 01:46 AM »
Url Pack 1.0 is yet another tray hotkey. Most browsers now have the built in facility to drag the icon on the left end of the Address Bar to the desktop, creating a url shortcut. I designed Url Pack to take advantage of this.

UrlPackShot.png

You may download the program from this page:

http://www.favessoft.com/hotkeys.html

I usually start my browsers with a blank page.  But I thought it may be useful to have an easy means of launching a group of Urls in one shot.  This hotkey app pops up a Gui with 4 buttons.

Gather Urls Button moves any Url shortcuts from the Desktop to the URLS folder that's created in the folder where UrlPack.exe lives. Duplicates are silently overwritten.

Open Urls Button launches all the Urls in said folder.

The other 2 buttons are for setting the delays.
Long delay to give the browser time to load up off the disk.
Short delay is the delay between subsequent Url launches.

By fiddling with the delays you should be able to get the default browser to come up and load tabs for each shortcut.

Utterly useless for those who load a bunch of tabs on startup.  But for people like me who usually fire up an empty page, this makes it simpler to create a working set of sites.

Also the Tray Menu has a command to open the URLS folder.
The default hotkey is Alt-F10 but it's adjustable via .ini file.

Note that the delay buttons will not close after the entry is made. No sense making you hit the hotkey again to set both delays.  The Gather and Open Buttons show disabled if there are no shortcuts for them to work on.  They check for shortcuts on every pop up. But if you leave the window open and make shortcuts on the desktop, the buttons won't know it until the Gui closes and pops up again.

Once you're set up it's a matter of hit the hotkey, Press the Open Urls Button.
Pages: prev1 ... 181 182 183 184 185 [186] 187 188 189 190 191 ... 309next