James Posted February 21, 2007 Share Posted February 21, 2007 Hey,Some of you may of seen my other post "GUI Questions". I have so far made a script which will create an input box on your screen. You can then type in commands and it will do something, currently on a MsgBox for some random tests. But I have one problem with moving the GUI so that its always in the same place:Here is the current script that will work only on 1024x768 or higher (if higher it wont be in the right place)#include <GuiConstants.au3> #NoTrayIcon $sGUI = GuiCreate("WinBar App", 100, 20, @DesktopWidth / 2 + 320, @DesktopHeight / 170, BitOR($WS_POPUP, $WS_EX_TOPMOST),$WS_EX_TOOLWINDOW) $sInput = GUICtrlCreateInput("", -1, -1, 102, 22) GuiSetState() WinSetOnTop($sGUI, "", 1) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $sInput $sRead = GuiCtrlRead($sInput) ToDo() EndSwitch Wend Func ToDo() If $sRead = "help" Then MsgBox(0, "Help", "You need help?") If $sRead = "lol" Then MsgBox(0, "Lol?", "Why are you laughing") EndFuncThanks,Secure Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted February 21, 2007 Moderators Share Posted February 21, 2007 You'll need to run a seperate script if it's an actual InputBox or MsgBox, your script pauses waiting for the input of those 2 functions. You could look at AutoIt3ExecuteScript or AutoIt3ExecuteLine for this.I've (as well as others) have given some examples of how to implement similar things.Here's one example:http://www.autoitscript.com/forum/index.ph...st&p=187268And this may help as well (same thread):http://www.autoitscript.com/forum/index.ph...st&p=187372 Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
James Posted February 21, 2007 Author Share Posted February 21, 2007 Thanks Smoke. I will look through and see if I can work it out. Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
James Posted February 21, 2007 Author Share Posted February 21, 2007 Smoke, I cant seem to work it out... I did however try before you showed me that to do it like: #include <GuiConstants.au3> #NoTrayIcon $sGUI = GuiCreate("WinBar App", 100, 20, @DesktopWidth / 2 + 320, @DesktopHeight / 170, BitOR($WS_POPUP, $WS_EX_TOPMOST),$WS_EX_TOOLWINDOW) $sInput = GUICtrlCreateInput("", -1, -1, 102, 22) GUICtrlSetLimit($sInput, 20) GuiSetState() WinSetOnTop($sGUI, "", 1) _WinMove() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $sInput $sRead = GuiCtrlRead($sInput) ToDo() EndSwitch Wend Func ToDo() If $sRead = "help" Then MsgBox(0, "Help", "You need help?") If $sRead = "lol" Then MsgBox(0, "Lol?", "Why are you laughing") EndFunc Func _WinMove() If @DesktopHeight = 1024 Then WinMove($sGUI, "", @DesktopHeight / 2 + 320, @DesktopWidth / 170) If @DesktopHeight = 800 Then WinMove($sGUI, "", @DesktopHeight / 2 + 170, @DesktopWidth / 85) EndFunc But that didn't work. It makes perfect sense how I did it, to me. Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted February 21, 2007 Moderators Share Posted February 21, 2007 Can you tell me exactly what you want to do (I think I understand but don't want to waste my time writing the wrong option), and where in the script should what you want be executed (not just where, but under what circumstance)?P.S.... the snippet above doesn't show where you tried in the 8 minutes (between replying to what I said, replying to Jon's remark in the 300k post thread) where you actually tried to implement /AutoIt3ExecuteScript. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
James Posted February 21, 2007 Author Share Posted February 21, 2007 (edited) I want the program to basically sit next to the buttons on the top right of any window. It doesn't have to sit on a titlebar but it can sit on the desktop in the same place.I have looked at that post before. While I was searching for WinMove help, but I couldn't get it working.Edit: Yeah, the snippet doesn't have any code in because I couldn't figure out which bit goes where. Edited February 21, 2007 by Secure_ICT Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted February 21, 2007 Moderators Share Posted February 21, 2007 I want the program to basically sit next to the buttons on the top right of any window. It doesn't have to sit on a titlebar but it can sit on the desktop in the same place.I have looked at that post before. While I was searching for WinMove help, but I couldn't get it working.Edit: Yeah, the snippet doesn't have any code in because I couldn't figure out which bit goes where.What program?I understand why you're having issues if you can't explain it. Pretend I'm 5 and I understand nothing (last part may not be far from the truth). You leave bits and pieces out and add new ones every post.Now the above description you gave, makes absolutely no sense from the first post you have asking the original question. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
James Posted February 21, 2007 Author Share Posted February 21, 2007 Yeah, thats because I forgot to add it... My bad. Right lets start again. Basically, I want to make my script auto move to around about the same distance from the buttons on the top right of a window. Its always in the top right even if its a small window. Its always in the same place. Now when you minimize all of your windows and you see your desktop, its still in the same place. But, I am having problems making the script move to the right place if the screen resolution is different to 1024x768. Better? Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
Shevilie Posted February 21, 2007 Share Posted February 21, 2007 @DesktopHeight @DesktopWidth Those two might help you Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit Link to comment Share on other sites More sharing options...
James Posted February 21, 2007 Author Share Posted February 21, 2007 Yes, I know those Macro's and I have tried using them, but it doesn't set it all correctly. Notice? Func _WinMove() If @DesktopHeight = 1024 Then WinMove($sGUI, "", @DesktopHeight / 2 + 320, @DesktopWidth / 170) If @DesktopHeight = 800 Then WinMove($sGUI, "", @DesktopHeight / 2 + 170, @DesktopWidth / 85) EndFunc Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
Shevilie Posted February 21, 2007 Share Posted February 21, 2007 Well depends how you want it... you want it in the middle ??? Cant really see the meaning og the way you calculate the DesktopWidth... Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit Link to comment Share on other sites More sharing options...
James Posted February 21, 2007 Author Share Posted February 21, 2007 No, I have said it lots of times before :S I need it in the top right of the screen, and it stays there all the time. It goes just next to the minimize button. Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted February 21, 2007 Moderators Share Posted February 21, 2007 WinGetPos() x ([0]) and y ([1]) WinMove(gui, '', x, y) If I'm understanding you right, should be all you need. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
James Posted February 21, 2007 Author Share Posted February 21, 2007 Hmm.. So this goes in my function. And then.. Nope.. I don't get it. Sorry Smoke. I bet it is really easy, but I dont do things like this normally. Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted February 21, 2007 Moderators Share Posted February 21, 2007 Hmm.. So this goes in my function. And then.. Nope.. I don't get it. Sorry Smoke. I bet it is really easy, but I dont do things like this normally.This is where my "attempting" to help stops completely for this and any project.You spent less than 2 minutes even trying to figure it out.... you have 800+ posts wtf! Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Shevilie Posted February 21, 2007 Share Posted February 21, 2007 WinMove($sGUI, "", @DesktopHeight - 20, @DesktopWidth - 100) Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit Link to comment Share on other sites More sharing options...
James Posted February 21, 2007 Author Share Posted February 21, 2007 I'm a n00b.. Sorry Smoke. I will try and try even if I cant do it. I will get it done. Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ 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