Jump to content

Recommended Posts

Posted

Hello all, I'm new to AutoIt and I'm trying to create a hotkey that automatically pops out a chrome tab into a new window and then shifts it to my second monitor. This works as intended, however it opens Office 365 as well and I have no idea why. Any help would be appreciated.

HotKeySet("^!x", "split_tab")
Func split_tab()
    Send("{F6}^c^w^n^v{Enter}")
    Sleep(50)
    Send("{LWINDOWN}{SHIFTDOWN}{LEFT}{LWINUP}{SHIFTUP}")    
EndFunc

While 1
    Sleep(100)
WEnd

  • Moderators
Posted

Moved to the appropriate AutoIt General Help and Support forum, as the Developer General Discussion forum very clearly states:

Quote

General development and scripting discussions.


Do not create AutoIt-related topics here, use the AutoIt General Help and Support or AutoIt Technical Discussion forums.

Moderation Team

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

  • 2 weeks later...
Posted (edited)

Hello,

if it's an LNK file putting the hotkey in place, you should be able to locate it with this script as a start:

$SearchHotkey = "ALT+CTRL+B"
$HotkeyINI = "C:\temp\Hotkeys.ini"

$StrHotkeyMatch = $SearchHotkey


$LoopDepth=0
$CurDir=""

AdlibRegister("ToolUpdate",2000)



Abgrasen("C:\") ; one more " to fix syntax formatting here


Func Abgrasen($_Dir) ; Trailing BACKSLASH !!!
    $CurDir=$_Dir
    ConsoleWrite($_Dir & @CRLF)
    $LoopDepth+=1
    Local $s
    $s = FileFindFirstFile($_Dir & "*.*")
    If $s = -1 Then
        FileClose($s)
        $LoopDepth-=1
        Return
    Else
        While 1
            $NF = FileFindNextFile($s)
            If @error Then
                FileClose($s)
                $LoopDepth-=1
                FileClose($s)
                Return
            Else ; gibt was zu finden
                If @extended Then ; verzeichnis
                    If ($NF = ".") Or ($NF = "..") Then
                        ContinueLoop
                    Else
                        Abgrasen($_Dir  & $NF& "\") ; " Trailing BACKSLASH !!!
                    EndIf
                Else ; kein Verzeichnis
                    If StringRight($NF, 4) = ".lnk" Then
                        $hotkey = GetHotkey($_Dir & $NF)
                        If $hotkey Then
                            IniWrite($HotkeyINI, $hotkey, $NF, $_Dir & $NF)
                            If $hotkey = $SearchHotkey Then
                                $StrHotkeyMatch &= @CRLF & $_Dir & $NF
                            EndIf
                        EndIf
                    EndIf
                EndIf
            EndIf
        WEnd
    EndIf
EndFunc   ;==>Abgrasen

ConsoleWrite($StrHotkeyMatch & @CRLF)
AdlibUnRegister("ToolUpdate")

MsgBox(0,"Suche nach Hotkey",$StrHotkeyMatch)
ShellExecute($HotkeyINI)


func ToolUpdate()
    ToolTip($StrHotkeyMatch,600,200,"Loop Depth = " & $LoopDepth & ", " & $CurDir)
EndFunc






Func GetHotkey($_LNK)

    $ShellObj = ObjCreate("WScript.Shell")
    $objShortcut = $ShellObj.CreateShortCut($_LNK)
    Local $hotkey = $objShortcut.Hotkey
    If $hotkey <> "" Then
        Return $hotkey
    Else
        Return False
    EndIf
EndFunc   ;==>GetHotkey

 

Edited by rudi
added to " to the code, syntax formatting

Earth is flat, pigs can fly, and Nuclear Power is SAFE!

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...