Jump to content

[Closed] Move Taskbar


IanN1990
 Share

Recommended Posts

Heya,

I had a really good idea i would like to try out, I already have written some code that shows and hides the taskbar depending in the mouse moves over the top right screen but now i want to have the task-bar in both left and right screen **Not at the same time as i dont think that is possible"" but i thought if i could move it. So if the mouse hovers over leftscreen, it moves the taskbar to leftscreen and then shows it etc :D

Would anyone have any idea how i could move it, WinMove doesn't work

My current Soluation

Edited by IanN1990
Link to comment
Share on other sites

Have a look at this >>

Edit: I wish it was that simple as using WinMove but alas we have to look at using the API SHAppBarMessage. I think I've found a new project!

Edited by guinness

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

Aye i saw that post before, but reading though the content it seamed out of my level :oops: Though i am pleased to hear u found a new coding project :D i always find them really fun to do

Edit** though re-reading though that post, mousedrag is prob someone i could pull off XD but it would be very unprofessional and prob unreliable :rip:

Edited by IanN1990
Link to comment
Share on other sites

There is nothing wrong with using MouseClickDrag (if it works) because who's going to see it? As I've said to you before (not in these words) overtime what you class as 'complex code' will just make more & more sense. When I first saw DllStructGetData/DllStructSetData or any of the DLL functions as a matter of fact, I felt there was no way I would ever understand that aspect of coding or AutoIt. Finally the jigsaw is starting to look like the picture that came on the box (though 1 piece is probably missing.)

Edit: By the way I'm far from over learning this wonderful language & I appreciate that most of my fellow MVP's & Dev's have a greater knowledge of coding than I've gained since joining this forum.

Edited by guinness

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

;Show Taskbar
$size = WinGetPos("[Class:Shell_TrayWnd]")
$pos = MouseGetPos()
if $pos[0] <= 0 then
    if $pos[0] >= -60 then
        if $pos[1] >=60 Then
            sleep(100)
            if $pos[0] <= 0 and $pos[0] >= -60 and $pos[1] >=60 and $TaskbarHover=0 Then
                $TaskbarHover=1
                Find_Taskbar()
                if $task=1 Then
                WinSetState("[Class:AutoIt v3 GUI]", "", @SW_HIDE)
                ControlShow('','', WinGetHandle("[CLASS:Button]"))
                WinSetTrans("[Class:Shell_TrayWnd]", "", 255)
                WinSetOnTop("[Class:MozillaWindowClass]", "", 1)    
            Else
                WinSetTrans("[Class:Shell_TrayWnd]", "", 1)
                $pos1 = MouseGetPos()
                MouseClickDrag("left", 1925, 875,-5, 875, 0)
                MouseMove($Pos1[0], $Pos1[1], 0)
                WinSetState("[Class:AutoIt v3 GUI]", "", @SW_HIDE)
                ControlShow('','', WinGetHandle("[CLASS:Button]"))
                WinSetTrans("[Class:Shell_TrayWnd]", "", 255)
                WinSetOnTop("[Class:MozillaWindowClass]", "", 1)
                EndIf
            EndIf
        EndIf
    EndIf
EndIf

If $pos[0] >= 1920 then
    if $pos[0] <= 1980 then
        if $pos[1] >=60 Then
            sleep(100)
            $pos = MouseGetPos()
            if $pos[0] >= 1920 and $pos[0] <= 1980 and $pos[1] >=60 and $TaskbarHover=0 Then
            $TaskbarHover=1
            Find_Taskbar()
                if $task=0 Then
                WinSetState("[Class:AutoIt v3 GUI]", "", @SW_HIDE)
                ControlShow('','', WinGetHandle("[CLASS:Button]"))
                WinSetTrans("[Class:Shell_TrayWnd]", "", 255)
                WinSetOnTop("[Class:MozillaWindowClass]", "", 1)    
            Else
                WinSetTrans("[Class:Shell_TrayWnd]", "", 1)
                $pos1 = MouseGetPos()
                MouseClickDrag("left", -5, 875, 1925, 875, 0)
                MouseMove($Pos1[0], $Pos1[1], 0)
                WinSetState("[Class:AutoIt v3 GUI]", "", @SW_HIDE)
                ControlShow('','', WinGetHandle("[CLASS:Button]"))
                WinSetTrans("[Class:Shell_TrayWnd]", "", 255)
                WinSetOnTop("[Class:MozillaWindowClass]", "", 1)
                EndIf
            EndIf
        EndIf
    EndIf
EndIf

    $Thumbnail = WinGetState("[Class:TaskListThumbnailWnd]", "")
    $Nofication = WinGetState("[Class:NotifyIconOverflowWindow]", "")
Find_Taskbar()

if $task=0 Then
        if $TaskbarHover=1 and WinActive("Start menu") or WinActive("[Class:TaskListThumbnailWnd]") or BitAnd($Thumbnail, 2) or BitAnd($Nofication, 2) Then
        elseIf $pos[0] >=1985 or $pos[0]<=1920 and $TaskbarHover=1 Then
        $TaskbarHover=0
        WinSetTrans("[Class:Shell_TrayWnd]", "", 0)
        ControlHide('','', WinGetHandle("[CLASS:Button]"))
        WinSetState("[Class:AutoIt v3 GUI]", "", @SW_SHOW)
        winflash("[Class:AutoIt v3 GUI]", "", 2, 0)
    EndIf
    EndIf
        
If $task=1 Then
        if $TaskbarHover=1 and WinActive("Start menu") or WinActive("[Class:TaskListThumbnailWnd]") or BitAnd($Thumbnail, 2) or BitAnd($Nofication, 2) Then
        elseIf $pos[0] <=-65 or $pos[0]>=0 and $TaskbarHover=1 Then
        $TaskbarHover=0
        WinSetTrans("[Class:Shell_TrayWnd]", "", 0)
        ControlHide('','', WinGetHandle("[CLASS:Button]"))
        WinSetState("[Class:AutoIt v3 GUI]", "", @SW_SHOW)
        winflash("[Class:AutoIt v3 GUI]", "", 2, 0)
        EndIf
    EndIf

Func Find_Taskbar()
    ; Find taskbar
    Local $iPrevMode = AutoItSetOption("WinTitleMatchMode", 4)
    Local $aTaskBar_Pos = WinGetPos("classname=Shell_TrayWnd")
    AutoItSetOption("WinTitleMatchMode", $iPrevMode)
    ; Determine position of taskbar
    If $aTaskBar_Pos[0] > 0 Then
        ; TaskBar at RIGHT
        If $aTaskBar_Pos[0] > @DesktopWidth - $aTaskBar_Pos[2] Then
            $task=0
        Else
           $task=0
        EndIf
    ElseIf $aTaskBar_Pos[3] = @DesktopHeight Then
        ; TaskBar at LEFT
        If $aTaskBar_Pos[0] < 0 Then
            $task=1
        Else
            $task=1
        EndIf
    EndIf
EndFunc

Well it works but the click+drag is rather slow and sluggish :) Gives more the impression there is 2 taskbar being moved rather then 2 taskbars appearing when hovered over

**Edited A fully working model with little bugs, will work for Windows 7 32 Bit, 3 Screens 1920x1080 each, Mainscreen = Center

***Edited again for improved taskbar detection, i will go though it later to see if i can remove any ifs or improve the code :D

***Edited the code again, spent 2 hours completely re-writing the script. Improved performance, before it was 1 cpu its now 0 cpu :oops: as well as less ram, lines of code and more functions as well. Enjoy :rip:

#NoTrayIcon
local $taskbarhovered=1
$hGUI = GUICreate("", 0, 0)
GUISetState()
WinSetState("[Class:AutoIt v3 GUI]", "", @SW_MINIMIZE)

While 1
sleep(250)
$size = WinGetPos("[Class:Shell_TrayWnd]")
$pos = MouseGetPos()
if $pos[0] < 0 Then
   if $pos[0] > -60 Then
    sleep(150)
     $pos = MouseGetPos()
     if $pos[0] < 0 and $pos[0] > -60 and $TaskbarHovered=0 Then
      if $size[0] < 0 then
      $TaskbarHovered=1
      Show()
      Else
      $TaskbarHovered=1
      WinSetTrans("[Class:Shell_TrayWnd]", "", 1)
      $pos1 = MouseGetPos()
      MouseClickDrag("left", 1925, 875,-5, 875, 0)
      MouseMove($Pos1[0], $Pos1[1], 0)
      Show()
      EndIf
     EndIf
    Elseif $pos[1] < 30 then
   MsgBox(4096, "Test", "This is for IE not yet programmed", 10)
  Else
   $Thumbnail = WinGetState("[Class:TaskListThumbnailWnd]", "")
   $Nofication = WinGetState("[Class:NotifyIconOverflowWindow]", "")
   if $TaskbarHovered=1 and WinActive("Start menu") or WinActive("[Class:TaskListThumbnailWnd]") or BitAnd($Thumbnail, 2) or BitAnd($Nofication, 2)  Then
   Else
   If $TaskbarHovered = 1 and $pos[0] <-400 and $size[0] < 0 Then
    $TaskbarHovered = 0
    Hide()
   EndIf
   EndIf
  EndIf
Else
   If $TaskbarHovered = 1 and $size[0] < 0 Then
    $TaskbarHovered = 0
    Hide()
   EndIf
  EndIf
if $pos[0] > 1920 Then
   if $pos[0] < 1980 Then
    sleep(150)
     $pos = MouseGetPos()
     if $pos[0] > 1920 and $pos[0] < 1980 and $TaskbarHovered=0 Then
      if $size[0] > 0 Then
      $TaskbarHovered=1
      Show()
      Else
      $TaskbarHovered=1
      WinSetTrans("[Class:Shell_TrayWnd]", "", 1)
      $pos1 = MouseGetPos()
      MouseClickDrag("left", -5, 875, 1925, 875, 0)
      MouseMove($Pos1[0], $Pos1[1], 0)
      Show()     
      EndIf
     EndIf
    Elseif $pos[1] < 30 and $size[0] > 0  then
   MsgBox(4096, "Test", "This is for Firefox not yet programmed", 10)
  Else
   $Thumbnail = WinGetState("[Class:TaskListThumbnailWnd]", "")
   $Nofication = WinGetState("[Class:NotifyIconOverflowWindow]", "")
   if $TaskbarHovered=1 and WinActive("Start menu") or WinActive("[Class:TaskListThumbnailWnd]") or BitAnd($Thumbnail, 2) or BitAnd($Nofication, 2)  Then
   Else
   If $TaskbarHovered = 1 and $pos[0] < 2320 and $size[0] > 0  Then
    $TaskbarHovered = 0
    Hide()
   EndIf
   EndIf
  EndIf
Else
   If $TaskbarHovered = 1 and $size[0] > 0  Then
    $TaskbarHovered = 0
    Hide()
   EndIf
  EndIf
WEnd
 
 
 
Func Hide ()
WinSetTrans("[Class:Shell_TrayWnd]", "", 0)
ControlHide('','', WinGetHandle("[CLASS:Button]"))
WinSetState("[Class:AutoIt v3 GUI]", "", @SW_SHOW)
Winflash("[Class:AutoIt v3 GUI]", "", 2, 0)
EndFunc
func Show ()
WinSetState("[Class:AutoIt v3 GUI]", "", @SW_HIDE)
ControlShow('','', WinGetHandle("[CLASS:Button]"))
WinSetTrans("[Class:Shell_TrayWnd]", "", 255)
WinSetOnTop("[Class:MozillaWindowClass]", "", 1)
EndFunc
Edited by IanN1990
Link to comment
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
 Share

  • Recently Browsing   0 members

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