computergroove Posted January 12, 2011 Share Posted January 12, 2011 (edited) I have this program that works really well but some users are going to need to put the hovering button in a new location on their screen and I want them to have the ability to change it without my intervention. I am thinking 2 seperate programs and an external ini file but I have not used an external ini to store and use data in an Autoit script. 1 Program to control the actual hovering button (code below) and 1 program to modify the location in a clean gui for the end user. Here is what is working now to put the hovering button in the upper right hand corner and function the way I want it to: #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Opt("GUIOnEventMode", 1) Local $Button1, $b1label, $height, $width, $hPosition, $vPosition $height = 75 $width = 80 $hPosition = $width $vPosition = 1 GUICreate("Hovering Button", $width, $height, @DesktopWidth - $hPosition, $vPosition, $WS_POPUP, $WS_EX_TOPMOST) GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") $Button1 = GUICtrlCreatePic("MacBackground.jpg", -1, -1) GUICtrlSetState(-1, $GUI_DISABLE) Opt("GUICoordMode", 2) $b1label = GUICtrlCreateLabel("", 1, 1, $width, $height, 0x201) GUICtrlSetBkColor($b1label, $GUI_BKCOLOR_TRANSPARENT) GUICtrlSetOnEvent($b1label, "Change") GUISetState() While 1 Sleep(11) WEnd Func Change() If WinExists("My Program") Then; check to see if the program is already running WinActivate("My Program"); makes program active Else Run('My Program.exe') ; Starts program EndIf EndFunc Func _Exit() Exit EndFunc ;==>_Exit I want to control the: $hPosition = $width $vPosition = 1 from an external ini file and create a gui for the user to change the position. Does anyone have any good design ideas that can be called stupid proof? If not Ill wing it but I want minimal problems / tech support calls on this. Lastly I am making the MACBackground.jpg the same dimensions as $width and $ height but A large portion of the picture is getting cropped when I run the program. Is the width and height parameters in GUICreate measured in pixels or something else? Edited January 12, 2011 by computergroove Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now