Moderators SmOke_N Posted March 8, 2005 Moderators Share Posted March 8, 2005 Hi, just a couple of questions. 1st off I've been up and down the help menu, trying to soak in the new language for me, and to be honest, scripting is quite enjoyable (probably more so if I knew what i was doing ) 2nd, I'd like to thank most of you for your support and knowledge when newbies like myself ask intermediate, sometimes down right silly questions. I've created a few scripts, and what a joy to actually see them work. However I am stumped on a few things that either isn't explained in enough detail in the help menu, I can't find the answers to in "search", or I'm a boneafied idiot. I'm trying to build a GUI to make life a bit easier in using my scripts, instead of pulling my script up in autoit and using {F5} always. So: 1. Is there a good website or book I could get to help me to understand how to integrate my scripts into GUI's, ie... several buttons on one GUI, pulling up all different scripts when pressed. Oh, just using GUI's in general. 2. I'm using a script that looks for a window, I have to manually type in the window title everytime because it changes often also I believe that the Class changes often also. Is there a script example that you can show me that I could use in the GUI "Combo", that could pull up all active window titles, and I chose which title to use. Having said that, is there an example of what to put in the actual script, to read the GUI choice? 3. Those of you that have spouses or significant others, this stuff is more addicting then Drugs, how do you keep the home life happy?...LMAO---j/k Sorry for the book Ron 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...
CyberSlug Posted March 8, 2005 Share Posted March 8, 2005 If you used the installer for AutoIt, look at: C:\Program Files\AutoIt3\Examples\GUI (There should also be a link to the Examples folder if you look at the Start Menu > Programs > AutoIt v3) Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig! Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 8, 2005 Author Moderators Share Posted March 8, 2005 (edited) Thaks guys, cyberslug, I did look in the examples, I have a an idea now of how to put the data GuiCtrlSetData($1, "how do i get the data"). I need to put ALL the active windows in that spot) $2 = "need all active windows"?? As an example. Windows XP pro: Ctrl+Alt+Delet, Applications shows all active windows. Thanks again Edited March 8, 2005 by ronsrules 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...
Moderators SmOke_N Posted March 8, 2005 Author Moderators Share Posted March 8, 2005 Bueller, Bueller, Bueller --------- Anyone 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...
CyberSlug Posted March 8, 2005 Share Posted March 8, 2005 Bueller, Bueller, Bueller --------- Anyone <{POST_SNAPBACK}>http://www.autoitscript.com/forum/index.php?showtopic=8842 Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig! Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 9, 2005 Author Moderators Share Posted March 9, 2005 http://www.autoitscript.com/forum/index.php?showtopic=8842 Very cool, Thanks a bunch. Now for this question, I've implemented this into my GUI: expandcollapse popup$var = WinList() $list = GUICtrlCreateCombo("",10,10,350,350) Dim $x = -1 For $i = 1 to $var[0][0] If $var[$i][0] = "" Then ContinueLoop If IsVisible($var[$i][1]) Then $x = $x + 1 GUICtrlSetData($list,$var[$i][0] & "|") ;GUIctrlCreatelabel($var[$i][0], 10, ($x * 15) + 25, 400, 20) ;MsgBox(0,"test",$var[$i][0]) EndIf Next GUISetState(@SW_SHOW) While 1 sleep(25) $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then Exitloop Endif WEnd Func IsVisible($handle) If BitAnd( WinGetState($handle), 2 ) Then Return 1 Else Return 0 EndIf EndFunc Now here's my next question, I have several buttons on my GUI, that all call different scripts. Each of those scripts needs to use the window that is picked in the combo box of the GUI. I thought I could change the scripts to: $window = ControlGetText("GUI", "", "Edit1") But all the text is visible in that combo box, I only want to grab the window that is chosen and set that as my $window. Any suggestions? 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...
CyberSlug Posted March 9, 2005 Share Posted March 9, 2005 (edited) So you want other scripts to use the value in the combo box. EnvSet and EnvGet appear to work Edit: You could also pass the value as a command line paramter. I've updated my examples to show both methods. MainScript.au3 ; Script generated by AutoBuilder 0.5 Prototype #include <GuiConstants.au3> $GUI = GuiCreate("MyGUI", 392, 323,(@DesktopWidth-392)/2, (@DesktopHeight-323)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS) $Button_1 = GuiCtrlCreateButton("Button1", 20, 40, 110, 50) $Button_2 = GuiCtrlCreateButton("Button2", 20, 120, 110, 50) $Button_3 = GuiCtrlCreateButton("Button3", 20, 210, 110, 50) $Combo_4 = GuiCtrlCreateCombo("", 200, 40, 170, 21) GuiCtrlSetData(-1, "One|Two|Three|Four", "one") GuiSetState() While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Button_1 or $msg = $Button_2 or $msg = $Button_3 EnvSet("foo", GuiCtrlRead($Combo_4)) Run(@AutoItExe & " " & "SecondScript.au3" & " " & GuiCtrlRead($Combo_4)) EndSelect WEnd Exit SecondScript.au3#include <GuiConstants.au3> GuiCreate("Child Script", 200, 100) GuiCtrlCreateLabel("You chose " & EnvGet("foo"), 10, 10, 200, 50) If $CmdLine[0] > 0 Then GuiCtrlCreateLabel("CmdLine was " & $CmdLine[1], 10, 50, 200, 50) GuiSetState() While GuiGetMsg() <> $GUI_EVENT_CLOSE WEnd Edited March 9, 2005 by CyberSlug Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig! Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 9, 2005 Author Moderators Share Posted March 9, 2005 WOW, you are so over my head it isn't even funny! I looked at the script, .... Hell I even uderstood what it was doing ( ). But in now way, can I see how to implement that with the script that I got from the link you sent me . I think your too smart for my good!! (that's a compliment by the way ) Maybe I'm just in way over my head I would love to send someone the script, and my attempt at the GUI to see if they know what I'm thinking, cuz obviously I don't know how to put this in to intelligent terms (sorry). 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...
Moderators SmOke_N Posted March 9, 2005 Author Moderators Share Posted March 9, 2005 Larry, thought you would be with your significant other, and you know it scares me to think that the only 2 responses I've gotten are from the "GURUS". Quick question: If I put that in my scripts (they are not gui's), I get an error, if I compile them to .exe will that read the GUI $window, if i have Global $window as you put it (without the error)? 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...
CyberSlug Posted March 9, 2005 Share Posted March 9, 2005 WOW, you are so over my head it isn't even funny!Right before you call your other script upon the button click:EnvSet("someNameGoesHere", GuiCtrlRead($list))Then in your other scripts say$window = EnvGet("someNameGoesHere")someNameGoesHere is arbitrary but must be the same in both scripts Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig! Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 9, 2005 Author Moderators Share Posted March 9, 2005 Don't mean to sound so stupid: Envset("SomeNameGoesHere", --- do I just leave it "" or do I put something between the quotations? 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...
CyberSlug Posted March 9, 2005 Share Posted March 9, 2005 Don't mean to sound so stupid:Envset("SomeNameGoesHere", --- do I just leave it "" or do I put something between the quotations?<{POST_SNAPBACK}>Try the code exactly as written (keep the stuff in the quotes) without any changes. Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig! Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 9, 2005 Author Moderators Share Posted March 9, 2005 (edited) Ok Cyberslug, I didn't give up (sorry... lol). I've tried to integrate the 2 scripts like so: expandcollapse popup#include <GUIConstants.au3> Global $Paused GUICreate("PPDB", 400, 400) $P1 = HotKeySet("{PAUSE}", "TogglePause") $var = WinList() ; BUTTON $Button1 = GUICtrlCreateButton("1-OK", 10, 135, 120, 30) $Button2 = GUICtrlCreateButton("25-OK", 140, 135, 120, 30) $Button3 = GUICtrlCreateButton("50-OK", 270, 135, 120, 30) $Button4 = GUICtrlCreateButton("G-M", 10, 170, 120, 30) $Button5 = GUICtrlCreateButton("Q-K", 140, 170, 120, 30) $Button6 = GUICtrlCreateButton("510-O", 270, 170, 120, 30) $Button7 = GUICtrlCreateButton("100-200-O", 140, 205, 120, 30) $list = GUICtrlCreateCombo("", 5, 101, 390, 30) Dim $x = -1 For $i = 1 To $var[0][0] If $var[$i][0] = "" Then ContinueLoop If IsVisible($var[$i][1]) Then $x = $x + 1 GUICtrlSetData($list, $var[$i][0] & "|") ;GUIctrlCreatelabel($var[$i][0], 10, ($x * 15) + 25, 400, 20) ;MsgBox(0,"test",$var[$i][0]) EndIf Next ;Input $PauseButton = GUICtrlCreateButton("Pause", 200, 55, 60, 30, $P1) $Notice = GUICtrlCreateLabel("(***Notice -- This Program Is For Education Use Only***, )", 73, 245, 391, 20) ;Date $Date = GUICtrlCreateDate("", 145, 10, 200, 20) $DateLabel = GUICtrlCreateLabel("(Date control expands into a calendar)", 155, 30, 200, 20) ; Icon $n1 = GUICtrlCreateIcon(@WindowsDir & "\cursors\horse.ani", -1, 20, 255, 32, 32) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Button1 Or $msg = $Button2 Or $msg = $Button3 Or $msg = $Button4 Or $msg = $Button5 Or $msg = $Button6 Or $msg = $Button7 EnvSet("foo", GUICtrlRead($list)) Run(@AutoItExe & " " & "SecondScript.au3" & " " & GUICtrlRead($list)) EndSelect WEnd Func IsVisible($handle) If BitAND( WinGetState($handle), 2) Then Return 1 Else Return 0 EndIf EndFunc ;==>IsVisible Func TogglePause() $Paused = Not $Paused While $Paused Sleep(100) ToolTip('Script is "Paused"', 0, 0) WEnd ToolTip("") EndFunc ;==>TogglePause It pulls up the GUI, when I click a button, it gives me a windows error: This script is very similar to all the scripts that each of the buttons are to call, not in .exe form yet, because I need to get $t1 to recognize the window chosen. expandcollapse popup;Set Name of Window Global $t1 = EnvGet("foo");;;;;((((((((IS THIS WHERE I WOULD PUT THIS IN THE ACTUAL SCRIPT))))) ;;;;;;;;;;;(((((((((AM I TO MAKE MY SCRIPT TO RUN A GUI TO MAKE IT EnvGet???))))))))) WinActivate("Untitled """ & $t1); ; Main Loop While WinExists($t1) Sleep(300); $Blah1 = ControlGetText("Untitled", "Blah1", 1012) If $Blah1 = "Blah1" Then ; Mouse clicking from text found blah1 WinWait($t1) If Not WinActive($t1) Then WinActivate($t1) WinWaitActive($t1) MouseMove(Random(429, 512), Random(532, 556)) MouseDown("left") MouseUp("left") Sleep(Random(0, 3000)) EndIf $Blah2 = ControlGetText("Connected to", "Blah2", 1012) If $Blah2 = "Blah2" Then ; Mouse clicking from text found blah2 WinWait($t1) If Not WinActive($t1) Then WinActivate($t1) WinWaitActive($t1) MouseMove(Random(554, 641), Random(528, 559)) MouseDown("left") MouseUp("left") Sleep(Random(0, 3000)) EndIf $Blah3 = ControlGetText("Connected to", "Blah3", 1012) If $Blah3 = "Blah3" Then ; Mouse clicking from text found blah3 WinWait($t1) If Not WinActive($t1) Then WinActivate($t1) WinWaitActive($t1) MouseMove(Random(554, 641), Random(528, 559)) MouseDown("left") MouseUp("left") MouseMove(Random(701, 717), Random(534, 542)) MouseDown("left") MouseUp("left") Sleep(Random(0, 3000)) EndIf $Blah4 = ControlGetText("Connected to", "Blah4", 1012) If $Blah4 = "Blah4" Then ; Mouse Clicking from text found blah4 WinWait($t1) If Not WinActive($t1) Then WinActivate($t1) WinWaitActive($t1) MouseMove(637,483) MouseDown("left") MouseMove(675,486) MouseUp("left") Sleep(Random(3000, 6000)) Send(Random(150, 250, 1) & "{ENTER}") MouseMove(Random(681, 767), Random(529, 557)) MouseDown("left") MouseUp("left") Sleep(Random(0, 3000)) EndIf $Blah5 = ControlGetText("Connected to", "Blah5", 1012) If $Blah5 = "Blah5" Then ; Mouse clicking from text found blah5 WinWait($t1) If Not WinActive($t1) Then WinActivate($t1) WinWaitActive($t1) MouseMove(637,483) MouseDown("left") MouseMove(675,486) MouseUp("left") Sleep(Random(3000, 6000)) Send(Random(400, 800, 1) & "{ENTER}") MouseMove(Random(681, 767), Random(529, 557)) MouseDown("left") MouseUp("left") Sleep(Random(0, 3000)) EndIf WEnd The Mousemoves are neccessary because the mouseclick doesn't do it's function in the window, the script works fine, just the window must be manually typed every time, so I'm trying to pull from the GUI. Thanks Ron Edited March 9, 2005 by ronsrules 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...
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