Jump to content
Sign in to follow this  
BananaMaster

Taskbar location

Recommended Posts

BananaMaster

Hello, this is my first post here so excuse me if I'm in the wrong subforum.

I have this script:
 

#Region
#AutoIt3Wrapper_UseUpx=n
#EndRegion
GLOBAL $SUPERBARPOS
$SUPERBARPOS=WINGETPOS("[CLASS:Shell_TrayWnd]")
MSGBOX(0,"Testing...","Taskbar's attributes: x:"&$SUPERBARPOS[0]&" y:"&$SUPERBARPOS[1]&" w:"&$SUPERBARPOS[2]&" h:"&$SUPERBARPOS[3]&@CRLF&"Superbar condition: "&_TASKBARHIDDEN())
FUNC _TASKBARHIDDEN()
LOCAL CONST $ABM_GETSTATE=4,$ABS_AUTOHIDE=1,$ABS_ONTOP=2
LOCAL $ARETURN
$ARETURN=DLLCALL("shell32.dll","uint","SHAppBarMessage","dword",$ABM_GETSTATE,"ptr*",0)
IF @ERROR THEN
RETURN SETERROR(1,0,0)
ENDIF
IF BITAND($ARETURN[0],$ABS_AUTOHIDE)THEN
RETURN "Auto hide is enabled"
ELSE
RETURN "Auto hide is disabled"
ENDIF
ENDFUNC
FUNC _GETSUPERBARPOS2()
LOCAL CONST $ABM_GETTASKBARPOS=5
LOCAL CONST $ABE_LEFT=0
LOCAL CONST $ABE_TOP=1
LOCAL CONST $ABE_RIGHT=2
LOCAL CONST $ABE_BOTTOM=3
LOCAL $ARETURN
GLOBAL $_POSITIONS[4]=["Left","Top","Right","Bottom"]
GLOBAL $TAG_APPBARDATA="LONG;HWND;INT;INT;STRUCT;INT;INT;INT;INT;ENDSTRUCT"
LOCAL $PDATA=DLLSTRUCTCREATE($TAG_APPBARDATA)
DLLSTRUCTSETDATA($PDATA,1,DLLSTRUCTGETSIZE($PDATA))
DLLSTRUCTSETDATA($PDATA,2,WINGETHANDLE("[CLASS:Shell_TrayWnd]",""))
LOCAL $ARESULT=DLLCALL("Shell32.dll","BOOL","SHAppBarMessage","DWORD",$ABM_GETTASKBARPOS,"ptr",DLLSTRUCTGETPTR($PDATA))
IF @ERROR THEN RETURN SETERROR(@ERROR,0,-1)
IF NOT $ARESULT[0]THEN RETURN SETERROR($ARESULT[0],0,-2)
RETURN $_POSITIONS[DLLSTRUCTGETDATA($PDATA,4)]
ENDFUNC

I am very new to AutoIT and I would like to simplify this so when I run I get just a box saying 
Y=....
Which would be the taskbar's current Y.
-Thanks in advance!

Share this post


Link to post
Share on other sites
BananaMaster
1 hour ago, mikell said:

Simplified ...  :)

Msgbox(0,"", "Y = " & WinGetPos("[CLASS:Shell_TrayWnd]")[1])

 

Damn... that was simple... Now I want to call that from a powershell and make the outcome print in powershell. Is that as simple? Thanks by the way!

Share this post


Link to post
Share on other sites
BananaMaster

Anyone please?

Share this post


Link to post
Share on other sites
mikell
17 hours ago, BananaMaster said:

Now I want to  (... etc)

Just try to do it. If you run into trouble, then post your code (required) and you will get help  ;)

Share this post


Link to post
Share on other sites
BananaMaster
1 hour ago, mikell said:

Just try to do it. If you run into trouble, then post your code (required) and you will get help  ;)

My problem is that I don't know how to call the script from the powershell and output the Y in the powershell. Pretty much how to use this command in powershell. I did some research but I only found the opposite, which is calling powershell command through AutoIT script. (the script is the line of code above)

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  

×