मुझे इस कार्य के साथ ऑटोहॉटकी स्क्रिप्ट में कुछ भाग्य मिला है, बस अगर आपको इस्तेमाल की जाने वाली भाषा की परवाह नहीं है। यह आपके टास्कबार को स्थानांतरित करने के लिए सिम्युलेटेड कीस्ट्रोक और माउस मूवमेंट का उपयोग करता है। मैंने टास्कबार को स्वचालित रूप से अनलॉक/लॉक करने से रोक दिया।
कठिन हिस्सा इसे विश्वसनीय रूप से काम करने के लिए प्राप्त कर रहा था। बहुत सारे कोड यह सुनिश्चित करने के लिए समर्पित हैं कि टास्कबार चले गए। यह अभी भी 100% काम नहीं करता है ... यह मैंने जो देखा है उससे 10% समय की तरह विफल रहता है। हालांकि, यह शुरू करने के लिए पर्याप्त होना चाहिए!
यदि मैं कभी भी पूरी तरह से काम करने के लिए इस स्क्रिप्ट पर वापस आ जाता हूं, तो मैं यहां दोबारा पोस्ट करूंगा।
यहाँ उदाहरण स्क्रिप्ट है (हाइलाइटिंग यहाँ थोड़ा अजीब है, के रूप में भाषा Ahk है):
F3::
reload
return
F5::
MoveTaskbar(2,"bottom")
return
F6::
MoveTaskbar(2,"left")
return
F7::
MoveTaskbar(1,"top")
return
; Move the taskbar
; dspNumber: number. device number (primary display is 1, secondary display is 2...)
; edge: string. Top, Right, Bottom, or Left
MoveTaskbar(dspNumber, edge)
{
Critical
OutputDebug MoveTaskbar - called to move taskbar to display #%dspNumber% ("%edge%" edge)
; absolute coordinate system
CoordMode, Mouse, Screen
; error checking for dspNumber
SysGet, numMonitors, MonitorCount
if (numMonitors<dspNumber)
{
OutputDebug MoveTaskbar - [ERROR] target monitor does not exist (dspNumber = "%dspNumber%")
return
}
; get screen position for target monitor
SysGet, target, Monitor, %dspNumber%
oX := 7
oY := 7
; get coordinates for where to move the taskbar
if (edge = "Top")
{
oX := (targetRight-targetLeft)/2
trgX := oX+targetLeft
trgY := targetTop+15
}
else if (edge = "Right")
{
oY := -(targetBottom-targetTop)/2
trgX := targetRight-15
trgY := -oY + targetTop
}
else if (edge = "Bottom")
{
oX := -(targetRight-targetLeft)/2
trgX := -oX+targetLeft
trgY := targetBottom-15
}
else if (edge = "Left")
{
oY := (targetBottom-targetTop)/2
trgX := targetLeft+15
trgY := oY+targetTop
}
else
{
OutputDebug MoveTaskbar - [ERROR] target edge was improperly specified (edge = "%edge%")
return
}
trgX := round(trgX)
trgY := round(trgY)
oX := round(oX)
oY := round(oY)
OutputDebug MoveTaskbar - target location is (%trgX%,%trgY%)
MouseGetPos, startX, startY
OutputDebug MoveTaskbar - mouse is currently at (%startX%,%startY%)
; request the move mode (via context menu)
SendInput #b
SendInput !+{Space}
SendInput m
; wait for the move mode to be ready
Loop
{
if A_Cursor = SizeAll
break
}
OutputDebug MoveTaskbar - move mode is ready
; start the move mode
SendInput {Right}
; wait for the move mode to become active for mouse control
Loop
{
if A_Cursor = Arrow
break
}
OutputDebug MoveTaskbar - move mode is active for mouse control
; move taskbar (and making sure it actually does move)
offset := 7
count := 0
Loop
{
; move the taskbar to the desired location
OutputDebug MoveTaskbar - attempting to move mouse to (%trgX%,%trgY%)
MouseMove, %trgX%, %trgY%, 0
MouseGetPos, mX, mY, win_id
WinGetClass, win_class, ahk_id %win_id%
count += 1
; if the mouse didn't get where it was supposed to, try again
If ((mX != trgX) or (mY != trgY))
{
OutputDebug MoveTaskbar - mouse didn't get to its destination (currently at (%mX%,%mY%)). Trying the move again...
continue
}
; if the taskbar hasn't followed yet, wiggle the mouse!
if (win_class != "Shell_TrayWnd")
{
OutputDebug MoveTaskbar - window with class "%win_class%" is under the mouse... wiggling the mouse until the taskbar gets over here
;offset := - offset
trgX -= round(oX/2)
trgY -= round(oY/2)
oX := -oX
oY := -oY
if count = 50
{
OutputDebug, MoveTaskbar - wiggling isn't working, so I'm giving up.
return
}
}
else
break
}
OutputDebug MoveTaskbar - taskbar successfully moved
SendInput {Enter}
}
डाउनवोट क्यों? यह एक पूरी तरह से तैयार सूत्र है। संदिग्ध इरादे के रूप में, मैंने यहां और भी बदतर उत्तर दिया है ... – Thomas
खैर, थॉमस, तर्क दिया जा सकता है कि सवाल उपयोगी नहीं है क्योंकि यह एक ऐसा कार्य नहीं है जिसे कार्यक्रम करना चाहिए। हालांकि, हम वास्तव में मिंजांग के कार्यक्रम के इरादे को नहीं जानते हैं, तो चलो सभी संदेह का लाभ देते हैं, क्या हम? –
"कोई काम नहीं है कि कार्यक्रम करना चाहिए" - वास्तव में? आप उस निष्कर्ष रोब पर कैसे पहुंचते हैं? यदि आपने कभी भी बहु-मॉनिटर वातावरण में काम किया है तो आपको पता चलेगा कि इस प्रकार के ऐप्स (जैसे अल्ट्रामॉन - http://www.realtimesoft.com/ultramon/) लगभग आवश्यक हैं। किसने आपको नियुक्त किया कि किस कार्यक्रम को करना चाहिए? यह एक बिल्कुल अच्छा सवाल है; मुझसे +1 – Gerard