Cha0sBG Posted August 2, 2008 Share Posted August 2, 2008 (edited) Here is my code i want if the checkbox "Functionality" is checked to execute the function but it gives error :S expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <Process.au3> #include <Array.au3> $exe_name = "sro_client.exe" $winlist = ProcessList ($exe_name) GUICreate("Ultimate Buffer", 300, 300) $combo = GUICtrlCreateCombo ("", 4,4,192,20) $Cleric = GUICtrlCreateRadio("Cleric", 15, 45) $Bard = GUICtrlCreateRadio("Bard", 70, 45) GUICtrlCreateGroup("Select Class", 2, 30, 125, 40) $1Weapon = GUICtrlCreateCombo("1st Weapon", 4, 80, 100, 20) GUICtrlSetData(-1, "F1") GUICtrlSetData(-1, "F2") GUICtrlSetData(-1, "F3") GUICtrlSetData(-1, "F4") $2Weapon = GUICtrlCreateCombo("2nd Weapon", 110, 80, 100, 20) GUICtrlSetData(-1, "F1") GUICtrlSetData(-1, "F2") GUICtrlSetData(-1, "F3") GUICtrlSetData(-1, "F4") $BuffsF = GUICtrlCreateCombo("Select The" & " " & "(F)" & " " & "of the buffs", 5, 110, 205, 20) GUICtrlSetData(-1, "F1") GUICtrlSetData(-1, "F2") GUICtrlSetData(-1, "F3") GUICtrlSetData(-1, "F4") $Buff1 = GUICtrlCreateCombo("1st Buff", 5, 140, 120, 20) $Buff2 = GUICtrlCreateCombo("2nd Buff", 5, 170, 120, 20) $Buff3 = GUICtrlCreateCombo("3rd Buff", 5, 200, 120, 20) $Buff1Slot = GUICtrlCreateCombo("Select Slot", 130, 140, 100, 20) GUICtrlSetData(-1, "1") GUICtrlSetData(-1, "2") GUICtrlSetData(-1, "3") GUICtrlSetData(-1, "4") GUICtrlSetData(-1, "5") GUICtrlSetData(-1, "6") GUICtrlSetData(-1, "7") GUICtrlSetData(-1, "8") GUICtrlSetData(-1, "9") $Buff2Slot = GUICtrlCreateCombo("Select Slot", 130, 170, 100, 20) GUICtrlSetData(-1, "1") GUICtrlSetData(-1, "2") GUICtrlSetData(-1, "3") GUICtrlSetData(-1, "4") GUICtrlSetData(-1, "5") GUICtrlSetData(-1, "6") GUICtrlSetData(-1, "7") GUICtrlSetData(-1, "8") GUICtrlSetData(-1, "9") $Buff3Slot = GUICtrlCreateCombo("Select Slot", 130, 200, 100, 20) GUICtrlSetData(-1, "1") GUICtrlSetData(-1, "2") GUICtrlSetData(-1, "3") GUICtrlSetData(-1, "4") GUICtrlSetData(-1, "5") GUICtrlSetData(-1, "6") GUICtrlSetData(-1, "7") GUICtrlSetData(-1, "8") GUICtrlSetData(-1, "9") $Functionality = GUICtrlCreateCheckbox("Enable Program Functionality", 130, 45) GUISetState(@SW_SHOW) Global $Buffs = Buffs() For $i = 1 To $winlist[0][0] GUICtrlSetData ($combo, WinGetTitle(_ProcessGetWinEx($winlist[$i][0],"","","",True))) Next GUISetState () While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then Exit EndIf If Guictrlread($Functionality) $GUI_Checked) = $GUI_Checked Then $Buffs EndIf WEnd Func Buffs() While 1 If BitAND(GuiCtrlRead($Cleric), $GUI_Checked) = $GUI_Checked Then GUICtrlSetData($Buff1, "Bless Of Spell") GUICtrlSetData($Buff2, "Recovery Division") GUICtrlSetData($Buff3, "Holy Word") ExitLoop ElseIf BitAND(GuiCtrlRead($Bard), $GUI_Checked) = $GUI_Checked Then GUICtrlSetData($Buff1, "Moving March") GUICtrlSetData($Buff2, "Noice") GUICtrlSetData($Buff3, "Nothing...") ExitLoop EndIf WEnd EndFunc Func _ProcessGetWinEx($ivPid, $svClass = "", $svTitle = "", $svText = "", $ivReturnOnlyFirstMatch = False) $ivPid = ProcessExists($ivPid) If Not $ivPid Then Return(SetError(1, 0, 0)) Local $avwArray = WinList() Local $avRet[1] = [0] For $i = 1 To $avwArray[0][0] $avClass = DllCall("User32.dll", "int", "GetClassName", "hwnd", $avwArray[$i][1], "str", "", "int", 4096) If WinGetProcess($avwArray[$i][1]) = $ivPid Then If $svClass = "" Or (IsArray($avClass) And $avClass[2] = $svClass) Then If ($svTitle = "" Or StringInStr($avwArray[$i][0], $svTitle)) And ($svText = "" Or StringInStr(WinGetText($avwArray[$i][1]), $svText)) Then $avRet[0] += 1 ReDim $avRet[$avRet[0]+1] $avRet[$avRet[0]] = $avwArray[$i][1] If $ivReturnOnlyFirstMatch Then $avRet = $avret[1] ExitLoop EndIf EndIf EndIf EndIf Next Return $avRet EndFunc Can SOmeone help pls ? i'm making a verry complicated program and this is just a verry small party of the code othere like 1000 lines haven't been added oO Edited August 2, 2008 by Cha0sBG Have Questions About GUI (Graphical User Interface) ? Post Them Here :GUI Help And Support ForumHave Questions About General AutoIt ? Post Them Here : General Help And Support ForumNew To AutoIt ? Be Shure To Check Out The FaQ's (Frequently Asked Questions) Or FaQ ยน There You May Find Great Help That Will Guide You True The Wonderful Programming Language AutoItOthere Good Place To Get Some Knolage Of AutoIt Is The Example Script ForumNotice A Bug ? Please Go And Report it At Bug Report Section And Help The Devolepers Of AutoIt Update And Fix The Programming LanguageWant To Thank The People For This Great Forum And Programming Language ? Then DonateWhen You Found The Answer Your Looking For Please Add [Resolved] To The Thread's Name That Will Show Otheres That You Have Found What Your Looking For And They Whount Have To Enter The Thread. Link to comment Share on other sites More sharing options...
Achilles Posted August 2, 2008 Share Posted August 2, 2008 I haven't tried your code but try changing this: If Guictrlread($Functionality) $GUI_Checked) = $GUI_Checked Then to If Guictrlread($Functionality) = $GUI_CHECKED Then My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list] Link to comment Share on other sites More sharing options...
Cha0sBG Posted August 2, 2008 Author Share Posted August 2, 2008 (edited) yeah i just saw that >.< and i was verry mad cuz i was trying to figure out for 30 mins :@ . ok now i'v replaced it and when i check the checkbox and select a radio gives that error : >"C:\Program Files\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "C:\Documents and Settings\USER\Desktop\Project.au3" C:\Documents and Settings\USER\Desktop\Project.au3 (79) : ==> Expected a "=" operator in assignment statement.: $Buffs $Buffs^ ERROR >Exit code: 1 Time: 2.687 Edited August 2, 2008 by Cha0sBG Have Questions About GUI (Graphical User Interface) ? Post Them Here :GUI Help And Support ForumHave Questions About General AutoIt ? Post Them Here : General Help And Support ForumNew To AutoIt ? Be Shure To Check Out The FaQ's (Frequently Asked Questions) Or FaQ ยน There You May Find Great Help That Will Guide You True The Wonderful Programming Language AutoItOthere Good Place To Get Some Knolage Of AutoIt Is The Example Script ForumNotice A Bug ? Please Go And Report it At Bug Report Section And Help The Devolepers Of AutoIt Update And Fix The Programming LanguageWant To Thank The People For This Great Forum And Programming Language ? Then DonateWhen You Found The Answer Your Looking For Please Add [Resolved] To The Thread's Name That Will Show Otheres That You Have Found What Your Looking For And They Whount Have To Enter The Thread. Link to comment Share on other sites More sharing options...
Achilles Posted August 2, 2008 Share Posted August 2, 2008 You wrote $BUFFS in your code.. you can't just put a variable on a line all by itself... I think you meant _Buffs() My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list] Link to comment Share on other sites More sharing options...
Cha0sBG Posted August 2, 2008 Author Share Posted August 2, 2008 (edited) the reason i created the checkbox is because when i put Buffs() to execute directly after While1 or any othere place in While statement the exit button didn't work untill i check one of the radio boxes and me and the ppl for who i make this program off am/will be pissed off... Edited August 2, 2008 by Cha0sBG Have Questions About GUI (Graphical User Interface) ? Post Them Here :GUI Help And Support ForumHave Questions About General AutoIt ? Post Them Here : General Help And Support ForumNew To AutoIt ? Be Shure To Check Out The FaQ's (Frequently Asked Questions) Or FaQ ยน There You May Find Great Help That Will Guide You True The Wonderful Programming Language AutoItOthere Good Place To Get Some Knolage Of AutoIt Is The Example Script ForumNotice A Bug ? Please Go And Report it At Bug Report Section And Help The Devolepers Of AutoIt Update And Fix The Programming LanguageWant To Thank The People For This Great Forum And Programming Language ? Then DonateWhen You Found The Answer Your Looking For Please Add [Resolved] To The Thread's Name That Will Show Otheres That You Have Found What Your Looking For And They Whount Have To Enter The Thread. Link to comment Share on other sites More sharing options...
Achilles Posted August 2, 2008 Share Posted August 2, 2008 the reason i created the checkbox is because when i put Buffs() to execute directly after While1 or any othere place in While statement the exit button didn't work untill i check one of the radio boxes and me and the ppl for who i make this program off am/will be pissed off...I don't get what you're trying to say... However, having this line: $BuffsIs definitely going to be causing you a problem. Just because you assigned $Buffs to equals _Buffs() doesn't mean that writing $Buffs on a line will call the function _Buffs. In fact the variable $Buffs is actually blank because the function _Buffs() doesn't return anything. My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list] Link to comment Share on other sites More sharing options...
Cha0sBG Posted August 2, 2008 Author Share Posted August 2, 2008 when i make it like this While 1 $msg = GuiGetMsg() if $msg = $GUI_EVENT_CLose Then exit endif buffs() wend the close button just dousnt work ... Have Questions About GUI (Graphical User Interface) ? Post Them Here :GUI Help And Support ForumHave Questions About General AutoIt ? Post Them Here : General Help And Support ForumNew To AutoIt ? Be Shure To Check Out The FaQ's (Frequently Asked Questions) Or FaQ ยน There You May Find Great Help That Will Guide You True The Wonderful Programming Language AutoItOthere Good Place To Get Some Knolage Of AutoIt Is The Example Script ForumNotice A Bug ? Please Go And Report it At Bug Report Section And Help The Devolepers Of AutoIt Update And Fix The Programming LanguageWant To Thank The People For This Great Forum And Programming Language ? Then DonateWhen You Found The Answer Your Looking For Please Add [Resolved] To The Thread's Name That Will Show Otheres That You Have Found What Your Looking For And They Whount Have To Enter The Thread. Link to comment Share on other sites More sharing options...
Achilles Posted August 2, 2008 Share Posted August 2, 2008 when i make it like this While 1 $msg = GuiGetMsg() if $msg = $GUI_EVENT_CLose Then exit endif buffs() wend the close button just dousnt work ...That's probably because it's getting caught in the Buffs() function: Func Buffs() While 1 If BitAND(GuiCtrlRead($Cleric), $GUI_Checked) = $GUI_Checked Then GUICtrlSetData($Buff1, "Bless Of Spell") GUICtrlSetData($Buff2, "Recovery Division") GUICtrlSetData($Buff3, "Holy Word") ExitLoop ElseIf BitAND(GuiCtrlRead($Bard), $GUI_Checked) = $GUI_Checked Then GUICtrlSetData($Buff1, "Moving March") GUICtrlSetData($Buff2, "Noice") GUICtrlSetData($Buff3, "Nothing...") ExitLoop EndIf WEnd EndFuncThis won't exit until $Cleric is checked or $Bard is checked... So, basically your GUI won't close unless one of those two are checked... Is that what you want? My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list] Link to comment Share on other sites More sharing options...
Cha0sBG Posted August 2, 2008 Author Share Posted August 2, 2008 (edited) no listen i will try to explain as clear as i can. This will basicly be a keypresser . the keys that will be pressed will depend on the user's choise from the comboboxes but that's not important. i want the program to be able to: exit before the cleric or bard are checked and after that's all >.< hope it's not too hard EDIT: Found a way expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <Process.au3> #include <Array.au3> $exe_name = "sro_client.exe" $winlist = ProcessList ($exe_name) GUICreate("Ultimate Euro Buffer", 300, 300) $combo = GUICtrlCreateCombo ("", 4,4,192,20) $Cleric = GUICtrlCreateRadio("Cleric", 15, 45) $Bard = GUICtrlCreateRadio("Bard", 70, 45) GUICtrlCreateGroup("Select Class", 2, 30, 125, 40) $1Weapon = GUICtrlCreateCombo("1st Weapon", 4, 80, 100, 20) GUICtrlSetData(-1, "F1") GUICtrlSetData(-1, "F2") GUICtrlSetData(-1, "F3") GUICtrlSetData(-1, "F4") $2Weapon = GUICtrlCreateCombo("2nd Weapon", 110, 80, 100, 20) GUICtrlSetData(-1, "F1") GUICtrlSetData(-1, "F2") GUICtrlSetData(-1, "F3") GUICtrlSetData(-1, "F4") $BuffsF = GUICtrlCreateCombo("Select The" & " " & "(F)" & " " & "of the buffs", 5, 110, 205, 20) GUICtrlSetData(-1, "F1") GUICtrlSetData(-1, "F2") GUICtrlSetData(-1, "F3") GUICtrlSetData(-1, "F4") $Buff1 = GUICtrlCreateCombo("1st Buff", 5, 140, 120, 20) $Buff2 = GUICtrlCreateCombo("2nd Buff", 5, 170, 120, 20) $Buff3 = GUICtrlCreateCombo("3rd Buff", 5, 200, 120, 20) $Buff1Slot = GUICtrlCreateCombo("Select Slot", 130, 140, 100, 20) GUICtrlSetData(-1, "1") GUICtrlSetData(-1, "2") GUICtrlSetData(-1, "3") GUICtrlSetData(-1, "4") GUICtrlSetData(-1, "5") GUICtrlSetData(-1, "6") GUICtrlSetData(-1, "7") GUICtrlSetData(-1, "8") GUICtrlSetData(-1, "9") $Buff2Slot = GUICtrlCreateCombo("Select Slot", 130, 170, 100, 20) GUICtrlSetData(-1, "1") GUICtrlSetData(-1, "2") GUICtrlSetData(-1, "3") GUICtrlSetData(-1, "4") GUICtrlSetData(-1, "5") GUICtrlSetData(-1, "6") GUICtrlSetData(-1, "7") GUICtrlSetData(-1, "8") GUICtrlSetData(-1, "9") $Buff3Slot = GUICtrlCreateCombo("Select Slot", 130, 200, 100, 20) GUICtrlSetData(-1, "1") GUICtrlSetData(-1, "2") GUICtrlSetData(-1, "3") GUICtrlSetData(-1, "4") GUICtrlSetData(-1, "5") GUICtrlSetData(-1, "6") GUICtrlSetData(-1, "7") GUICtrlSetData(-1, "8") GUICtrlSetData(-1, "9") GUISetState(@SW_SHOW) For $i = 1 To $winlist[0][0] GUICtrlSetData ($combo, WinGetTitle(_ProcessGetWinEx($winlist[$i][0],"","","",True))) Next GUISetState () While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_Close Then Exit EndIf buffs() WEnd Func Buffs() While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_Close Then Exit EndIf If BitAND(GuiCtrlRead($Cleric), $GUI_Checked) = $GUI_Checked Then GUICtrlSetData($Buff1, "Bless Of Spell") GUICtrlSetData($Buff2, "Recovery Division") GUICtrlSetData($Buff3, "Holy Word") ExitLoop ElseIf BitAND(GuiCtrlRead($Bard), $GUI_Checked) = $GUI_Checked Then GUICtrlSetData($Buff1, "Moving March") GUICtrlSetData($Buff2, "Noice") GUICtrlSetData($Buff3, "Nothing...") ExitLoop EndIf WEnd EndFunc Func _ProcessGetWinEx($ivPid, $svClass = "", $svTitle = "", $svText = "", $ivReturnOnlyFirstMatch = False) $ivPid = ProcessExists($ivPid) If Not $ivPid Then Return(SetError(1, 0, 0)) Local $avwArray = WinList() Local $avRet[1] = [0] For $i = 1 To $avwArray[0][0] $avClass = DllCall("User32.dll", "int", "GetClassName", "hwnd", $avwArray[$i][1], "str", "", "int", 4096) If WinGetProcess($avwArray[$i][1]) = $ivPid Then If $svClass = "" Or (IsArray($avClass) And $avClass[2] = $svClass) Then If ($svTitle = "" Or StringInStr($avwArray[$i][0], $svTitle)) And ($svText = "" Or StringInStr(WinGetText($avwArray[$i][1]), $svText)) Then $avRet[0] += 1 ReDim $avRet[$avRet[0]+1] $avRet[$avRet[0]] = $avwArray[$i][1] If $ivReturnOnlyFirstMatch Then $avRet = $avret[1] ExitLoop EndIf EndIf EndIf EndIf Next Return $avRet EndFunc Edited August 2, 2008 by Cha0sBG Have Questions About GUI (Graphical User Interface) ? Post Them Here :GUI Help And Support ForumHave Questions About General AutoIt ? Post Them Here : General Help And Support ForumNew To AutoIt ? Be Shure To Check Out The FaQ's (Frequently Asked Questions) Or FaQ ยน There You May Find Great Help That Will Guide You True The Wonderful Programming Language AutoItOthere Good Place To Get Some Knolage Of AutoIt Is The Example Script ForumNotice A Bug ? Please Go And Report it At Bug Report Section And Help The Devolepers Of AutoIt Update And Fix The Programming LanguageWant To Thank The People For This Great Forum And Programming Language ? Then DonateWhen You Found The Answer Your Looking For Please Add [Resolved] To The Thread's Name That Will Show Otheres That You Have Found What Your Looking For And They Whount Have To Enter The Thread. Link to comment Share on other sites More sharing options...
Achilles Posted August 2, 2008 Share Posted August 2, 2008 no listen i will try to explain as clear as i can.This will basicly be a keypresser .the keys that will be pressed will depend on the user's choise from the comboboxes but that's not important.i want the program to be able to:exit before the cleric or bard are checked and after that's all >.< hope it's not too hard In that case I don't really get the Buffs() function. Try taking the While 1 and the WEnd out of your Buffs() function and see if that solves your problem. My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list] Link to comment Share on other sites More sharing options...
Cha0sBG Posted August 2, 2008 Author Share Posted August 2, 2008 umm i allredy found a way i just included the if gui event close in the loop Have Questions About GUI (Graphical User Interface) ? Post Them Here :GUI Help And Support ForumHave Questions About General AutoIt ? Post Them Here : General Help And Support ForumNew To AutoIt ? Be Shure To Check Out The FaQ's (Frequently Asked Questions) Or FaQ ยน There You May Find Great Help That Will Guide You True The Wonderful Programming Language AutoItOthere Good Place To Get Some Knolage Of AutoIt Is The Example Script ForumNotice A Bug ? Please Go And Report it At Bug Report Section And Help The Devolepers Of AutoIt Update And Fix The Programming LanguageWant To Thank The People For This Great Forum And Programming Language ? Then DonateWhen You Found The Answer Your Looking For Please Add [Resolved] To The Thread's Name That Will Show Otheres That You Have Found What Your Looking For And They Whount Have To Enter The Thread. Link to comment Share on other sites More sharing options...
Achilles Posted August 2, 2008 Share Posted August 2, 2008 umm i allredy found a way i just included the if gui event close in the loop Why don't you just get read of your Buffs() function and put all of it into your main loop? That would be the exact same and it would be shorter code... My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list] 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