Sign in to follow this  
Followers 0
Malkey

Shortcuts

3 posts in this topic

A few days ago, I wildly click on a similar looking program to this and lost all my links. Instead of re-entering the lost links, this Autoit script will be used. I intend to add a few more personal links, compile it, then add it to my startup.

This shows desktop before click and after second click:-

Desktop with links:-

;================= Shortcuts ==========================
;There is no data in $m[4][2] Used as a format for on screen - shows a 4 row by 2 column display. 
;Change $m[4][2] to $m[8][1] to get a 8 row by 1 colum display. Rows x columns must be less than 100.
;
;$DatArray[number][0] contains Control handles (Script enters handles).
;$DatArray[number][1] contains displayed data
;$DatArray[number][2] contains the jump to data.
;
;Change browser at line 57
;
; ****** Right click on GUI's will exit *******
;
;======================================================

#include 
Global $DatArray[100][3], $m[4][2],$dis = 0, $w, $h, $r = UBound($m), $c = UBound($m, 2)

$DatArray[0][1] = "Program Files"
$DatArray[0][2] = "C:\Program Files\"
$DatArray[1][1] = "Autoit Forums"
$DatArray[1][2] = "http://www.autoitscript.com/forum/index.php"
$DatArray[2][1] = "Autoit3 on Computer"
$DatArray[2][2] = "C:\Program Files\AutoIt3\"
$DatArray[3][1] = "Today's Active Topics"
$DatArray[3][2] = "http://www.autoitscript.com/forum/index.php?act=Search&nav=at&CODE=show&searchid=814fb7957fd0d48305c1cce2d6d5b697&search_in=topics&result_type=topics&lastdate=0"
$DatArray[4][1] = ""
$DatArray[4][2] = ""
$DatArray[5][1] = "Autoit Forum Search"
$DatArray[5][2] = "http://www.autoitscript.com/forum/index.php?act=Search"
$DatArray[6][1] = ""
$DatArray[6][2] = ""
$DatArray[7][1] = "Google"
$DatArray[7][2] = "http://www.google.com.au/"

$Form1 = GUICreate("Form1", 80, 18, @DesktopWidth *0.3, 5, BitOR($WS_POPUP,$WS_BORDER), $WS_EX_TRANSPARENT)
GUISetCursor(9)
$Label1 = GUICtrlCreateLabel("Shortcuts", 8, 0, 66, 15, $SS_CENTER, $GUI_WS_EX_PARENTDRAG)
$var = PixelGetColor( 1 , 2)
GUICtrlSetBkColor($Label1 , "0x" & Hex($var, 6)) ;$GUI_BKCOLOR_TRANSPARENT)
GUISetBkColor("0x" & Hex($var, 6))
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFFFFFF)
Global Const $WM_LBUTTONDOWN = 0x0201  ; Drag Window 1 of 3 addin
GUISetState(@SW_SHOW)
GuiRegisterMsg($WM_LBUTTONDOWN, "_WinMove")    ; Drag Window 2 of 3 addin
$disp1 = GUICreate("disp1", 80, 18, 193, 115, BitOR($WS_POPUP,$WS_BORDER), $WS_EX_TRANSPARENT)
DispShortcuts() 

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE  
            Exit
            
        Case $DatArray[0][0] to $DatArray[$r*$c-1][0] 
            $no = $nMsg - $DatArray[0][0]
            If $DatArray[$no][2] <> "" Then
                If StringMid($DatArray[$no][2],1,4) = "http" Then
                    ;Run("C:\Program Files\Internet Explorer\iexplore.exe " & $DatArray[$no][2])   ; Link to internet via iexplore
                    Run("C:\Program Files\Mozilla Firefox\firefox.exe " & $DatArray[$no][2] , "")  ; Link to internet via Firefox
                ElseIf StringMid($DatArray[$no][2],StringLen($DatArray[$no][2])-3,3) = "exe" Then
                    Run($DatArray[$no][2])                                              ; Run exe file
                Else
                    Run("Explorer.exe /e," & $DatArray[$no][2], "")                               ; Link to computer
                EndIf
            EndIf
        Case $GUI_EVENT_SECONDARYUP
            Exit
            
        Case $Label1
            if $dis = 0 Then                    
                DispShortcuts()
                GUISetState(@SW_SHOW,$disp1) 
                $dis = 1
            Else
                GUISetState(@SW_HIDE,$disp1) 
                ;GUISetState(@SW_SHOW,$Form1) 
                $dis = 0
            EndIf
            
    EndSwitch
WEnd


 ; Left mouse drag on any part of GUI   Drag Window 1 of 3 addin   (found AutoIt Forum)
Func _WinMove($HWnd, $Command, $wParam, $lParam)
     If BitAND(WinGetState($HWnd), 32) Then Return $GUI_RUNDEFMSG
    ;DllCall("user32.dll", "long", "SendMessage", "hwnd", $HWnd, "int", $WM_SYSCOMMAND, "int", 0xF009, "int", 0)
    dllcall("user32.dll","int","SendMessage","hWnd", $HWnd, "int",$WM_NCLBUTTONDOWN,"int", $HTCAPTION,"int", 0)
    GUISetState(@SW_HIDE,$disp1)
    $WinPos = WinGetPos($Form1)   
    WinMove ( $disp1, "", $WinPos[0],  $WinPos[1] + $WinPos[3] )
    if $dis = 1 Then GUISetState(@SW_SHOW,$disp1)   
    ;if @DesktopHeight - $pos[3] < 0   Then WinMove ( $HWnd, "", $pos[0],  $pos[1] + (-50 * (((@DesktopHeight - $pos[1] - $pos[3]-50) <= 0) And ($pos[1] <= 0))))
EndFunc
 
Func DispShortcuts($cellwdth = 170) 
    Dim $Counter = 0, $WidthPos1 = -$cellwdth, $HeightPos1 = 0
    $WinPos = WinGetPos($Form1) 
    $w = $WinPos[0]
    $h = $WinPos[1] + $WinPos[3]    
    $xx = 0
    while $DatArray[$xx][0] > 0 
        GUICtrlDelete($DatArray[$xx][0])
        $xx += 1
    WEnd            
    GUISetFont(9, 400, 0, "Tahoma") 
    for $x = 0 to $r -1
        for $y = 0 to $c -1
            $WidthPos1 += $cellwdth  
            ;$DatArray[$Counter][0] = GUICtrlCreateInput($DatArray[$Counter][1], $WidthPos1 , $HeightPos1, $cellwdth, 20, BitOR($SS_CENTER,$WS_BORDER),  $GUI_WS_EX_PARENTDRAG)  
            
            $DatArray[$Counter][0] = GUICtrlCreateLabel($DatArray[$Counter][1], $WidthPos1 , $HeightPos1, $cellwdth, 20, BitOR($SS_CENTER,$WS_BORDER),  $GUI_WS_EX_PARENTDRAG)  
            GUICtrlSetTip($DatArray[$Counter][0], $DatArray[$Counter][2], $DatArray[$Counter][1]) 
            GUICtrlSetBkColor(-1 , "0x" & Hex($var, 6))    
            GUICtrlSetFont(-1, 9, 800, 0, "Tahoma") 
            GUICtrlSetColor(-1, 0xFFFFFF)      
            $Counter += 1   
            If Mod($Counter, $c) = 0 Then
                $WidthPos1 -= $cellwdth * $c
                $HeightPos1 += 20            
            EndIf
        Next            
    Next        
    ;MsgBox(0,"",$WinPos[0] & "  "& $WinPos[1] & "  "&  $WinPos[2] & "  "&  $WinPos[3])
    WinMove($disp1, "", $w, $h, $cellwdth*($c)+2, $HeightPos1+2)
EndFunc

Enjoy, put it apart, delete it. Do with it what you will.

Share this post


Link to post
Share on other sites



I have not run or looked at your script but the pictures looks pretty cool, but does this have an option to add links to save or is that needed to be done through the code.

Share this post


Link to post
Share on other sites

......., but does this have an option to add links to save or is that needed to be done through the code.

The links are added in the code.

I was thinking of adding bells and whistles, like instead of right click exit, it would be right click - open another gui to configure eveything. Add a bit of color. But, I just want to use it.

Personally, I like the idea of the links being hard wired into the code. I will not lose them again.

Its easy to add links to the code. Especially, when you have the source code.

$DatArray[number][1] = "##########" contains displayed data, and,

$DatArray[number][2] = "##########" contains the jump to data.

"number" being the next $DatArray number up as in the script.

Then recompile. Start using again. That's the theory.

I like using Firefox, thus the code. That can be easily changed in the code as well.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0