PieMan Posted June 23, 2009 Posted June 23, 2009 This is really wierd.... After getting a report back from my testing group for my script, they said that the GUI Closes/Hides when ever they enter SHIFT+N. There is no reference in my code for SHIFT+N to hide/close the GUI i dont think plus the script is still running.... Any ideas? Here is my code expandcollapse popup#Region;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_icon=F:\Affinity\Affinity Script Resources\icon.ico #EndRegion;**** Directives created by AutoIt3Wrapper_GUI **** #cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.0.0 Author: Hilmy Abdic Script Function: Automate matter creation in Affinity #ce ---------------------------------------------------------------------------- ; Script Start - Add your code below here WinWaitActive("Matter Creation") $destination = "F:\Affinity\Affinity Script Resources\affinityB.JPG" SplashImageOn("Matter Creation Form", $destination,288,236) WinSetOnTop("Splash Screen", "", 1) Sleep(3000) SplashOff() Global $Date, $DTM_SETFORMAT_, $style, $validation, $Alpha, $Sinput, $Linput, $Value, $InputDisb1 #include <ButtonConstants.au3> #include <DateTimeConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $MatterCreationForm_1 = GUICreate("New Matter Creation Form", 485, 555, 192, 114) $MenuFile = GUICtrlCreateMenu("&File") $MenuClear = GUICtrlCreateMenuItem("Clear Fields", $MenuFile) $MenuExit = GUICtrlCreateMenuItem("Exit", $MenuFile) $MenuHelp = GUICtrlCreateMenu("&Help") $MenuAbout = GUICtrlCreateMenuItem("About", $MenuHelp) $Label1 = GUICtrlCreateLabel("*Instructed:", 8, 32, 54, 17) $Label2 = GUICtrlCreateLabel("Matter Creation", 168, 8, 79, 17) $Date = GUICtrlCreateDate("", 112, 32, 186, 21) $InputAlpha = GUICtrlCreateInput("", 112, 64, 121, 21) $InputSDescrition = GUICtrlCreateEdit("", 112, 96, 289, 57, $ES_AUTOVSCROLL + $WS_VSCROLL) GUICtrlSetLimit($InputSDescrition, 85) GUICtrlSetData(-1, "") $InputLDescrition = GUICtrlCreateEdit("", 112, 168, 289, 81, $ES_AUTOVSCROLL + $WS_VSCROLL) GUICtrlSetLimit($InputLDescrition, 400) GUICtrlSetData(-1, "") $InputRef = GUICtrlCreateInput("", 112, 272, 121, 21) $Label4 = GUICtrlCreateLabel("*Short Description:", 8, 88, 88, 17) $Label5 = GUICtrlCreateLabel("*Long Description:", 8, 168, 87, 17) $Group1 = GUICtrlCreateGroup("Financial", 17, 305, 255, 151) $Label7 = GUICtrlCreateLabel("Expected Value:", 24, 320, 85, 17) $Label8 = GUICtrlCreateLabel("Credit Limits:", 72, 352, 63, 17) $Label9 = GUICtrlCreateLabel("*Fees:", 24, 376, 30, 17) $Label10 = GUICtrlCreateLabel("*Disbursements:", 24, 400, 76, 17) $Label11 = GUICtrlCreateLabel("Overall Limit:", 24, 424, 64, 17) $InputEValue = GUICtrlCreateInput("", 112, 320, 73, 21) GUICtrlSetState(-1, $GUI_DISABLE) $InputFees = GUICtrlCreateInput("", 109, 373, 73, 21) $InputDisb = GUICtrlCreateInput("", 109, 397, 73, 21) $Label13 = GUICtrlCreateLabel("(Optional)", 208, 392, 49, 17) $InputOverLimit = GUICtrlCreateInput("", 109, 421, 73, 21) GUICtrlSetState(-1, $GUI_DISABLE) $ChkAuth = GUICtrlCreateCheckbox("Authority", 192, 376, 65, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) $Billing = GUICtrlCreateGroup("Billing", 280, 304, 169, 153) $RadioTaxBill = GUICtrlCreateRadio("Taxable Bill", 288, 352, 113, 17) $Label3 = GUICtrlCreateLabel("Tax Status for New Bills:", 288, 328, 122, 17) $RadioExportBill = GUICtrlCreateRadio("Export Bill", 288, 385, 113, 17) $RadioOther = GUICtrlCreateRadio("Other Tax-free Bill", 288, 416, 113, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) $ButtonPopulate = GUICtrlCreateButton("Populate Fields", 184, 480, 123, 33, $WS_GROUP) $Label6 = GUICtrlCreateLabel("Alpha (Optional):", 8, 64, 96, 17) $Label12 = GUICtrlCreateLabel("Your Ref. (Optional):", 8, 272, 100, 17) ;$BtnSLcopy = GUICtrlCreateButton("Copy", 408, 136, 67, 41, $WS_GROUP) GUISetState(@SW_SHOW) Dim $MatterCreationForm_1_AccelTable[1][2] = [["{NUM 5}", $MenuExit]] GUISetAccelerators($MatterCreationForm_1_AccelTable) #EndRegion ### END Koda GUI section ### ; Catch focus passing to $InputLDescrition GUIRegisterMsg($WM_COMMAND, "ED_WM_COMMAND") ; to select a specific default format $DTM_SETFORMAT_ = 0x1032 $style = "dd/MM/yyyy" GUICtrlSendMsg($Date, $DTM_SETFORMAT_, 0, $style) ;Sets radio button to be checked at load GuiCtrlSetState($RadioTaxBill, $GUI_CHECKED) WinSetOnTop ("New Matter Creation Form", "", 1) While 1 $nMsg = GUIGetMsg() If Not WinActive($MatterCreationForm_1) Then WinActivate($MatterCreationForm_1) Switch $nMsg ;Case $BtnSLcopy ;$CopySL = GUICtrlRead($InputSDescrition) ;ControlClick("New Matter Creation Form", "", "Edit3") ;Send($CopySL) Case $GUI_EVENT_CLOSE Sleep(300) Run("F:\Affinity\Affinity Script Resources\New Affinity Scripts\Matter Creation reset.exe") Exit Case $ButtonPopulate Validation() If $validation = 0 Then BlockInput(1) WinSetState("New Matter Creation Form", "", @SW_MINIMIZE) WinActivate("Matter Creation") Sleep(200) Opt("SendKeyDelay", 10) MatterDetails() Fdate() Sdescription() Ldescription() Financial() Billing() Contacts() Sleep(300) Run("F:\Affinity\Affinity Script Resources\New Affinity Scripts\Matter Creation reset.exe") Exit ElseIf $Validation = 1 Then WinSetOnTop ("New Matter Creation Form", "", 0) MsgBox(16, "STOP", "Not all the required fields have been entered, please fill out the required fields (*) and try again.") WinSetOnTop ("New Matter Creation Form", "", 1) ElseIf $validation = 2 Then WinSetOnTop ("New Matter Creation Form", "", 0) MsgBox(16, "STOP", "You can only enter in numbers in the Financial section. Please amend and try again") WinSetOnTop ("New Matter Creation Form", "", 1) EndIf Case $MenuAbout WinSetOnTop ("New Matter Creation Form", "", 0) MsgBox(0, "About", "Written By: Hilmy Abdic V1.0") WinSetOnTop ("New Matter Creation Form", "", 1) Case $MenuExit Sleep(300) Run("F:\Affinity\Affinity Script Resources\New Affinity Scripts\Matter Creation reset.exe") Exit EndSwitch WEnd func Validation() $validation = 0 If GUICtrlRead($InputSDescrition) = "" Then $validation = 1 ElseIf GUICtrlRead($InputLDescrition) = "" Then $validation = 1 ElseIf Not StringIsDigit(GUICtrlRead($InputFees)) Then If Not StringIsFloat(GUICtrlRead($InputFees)) Then $validation = 2 EndIf ElseIf Not StringIsDigit(GUICtrlRead($InputDisb)) Then If Not StringIsFloat(GUICtrlRead($InputDisb)) Then $validation = 2 EndIf EndIf EndFunc Func MatterDetails() ControlClick("Matter Creation", "", "TBitBtn1") WinWaitActive("Code Selection", "") BlockInput(0) MsgBox(64, "Partner", "Please select the managing Partner for this Matter") WinWaitClose("Code Selection", "") BlockInput(1) WinActivate("Matter Creation") ControlClick("Matter Creation", "", "TBitBtn2") WinWaitActive("Code Selection", "") BlockInput(0) MsgBox(64, "Controller", "Please select the Controller for this Matter") WinWaitClose("Code Selection", "") BlockInput(1) WinActivate("Matter Creation") ControlClick("Matter Creation", "", "TBitBtn3") WinWaitActive("Code Selection", "") BlockInput(0) MsgBox(64, "Author", "Please select the Author for this Matter") WinWaitClose("Code Selection", "") BlockInput(1) WinActivate("Matter Creation") ControlClick("Matter Creation", "", "TBitBtn4") WinWaitActive("Code Selection", "") BlockInput(0) MsgBox(64, "Type", "Please select the Type for this Matter") WinWaitClose("Code Selection", "") BlockInput(1) WinActivate("Matter Creation") EndFunc Func Fdate() ControlClick("Matter Creation", "", "TPageControl1", "left", 1, 24, 10) ControlClick("Matter Creation", "", "TDateTimePicker1", "left", 1, 9, 10) Send(GUICtrlRead($Date)) Send("{TAB}") Send("{TAB}") EndFunc ;==>Fdate Func Sdescription() $Alpha = GUICtrlRead($InputAlpha) Send($Alpha) Send("{TAB}") $Sinput = StringUpper(GUICtrlRead($InputSDescrition)) Send($Sinput) Send("{TAB}") send("^a") send("{BS}") EndFunc ;==>Sdescription Func Ldescription() $Linput = StringUpper(GUICtrlRead($InputLDescrition)) Send($Linput) Send("{TAB}") $Ref = GUICtrlRead($InputRef) Send($ref) Send("{TAB 5}") Send("{RIGHT}") Send("{TAB}") EndFunc ;==>Ldescription Func Financial() $Value = GUICtrlRead($InputFees) Send($Value) Send("{TAB 3}") Send($Value) Send("{TAB}") $InputDisb1 = GUICtrlRead($InputDisb) Send($InputDisb1) $total = $Value + $InputDisb1 Send("{TAB}") Send($total) If GUICtrlRead($ChkAuth) = 1 Then ControlClick("Matter Creation", "", "TDBCheckBox2") Send("+{TAB 3}") Else EndIf EndFunc Func Billing() Send("+{TAB 6}") Send("{RIGHT 3}") ControlClick("Matter Creation", "", "TGroupButton4") Send("+{TAB 4}") Send("{RIGHT 2}") Send("{TAB 4}") If GUICtrlRead($RadioTaxBill) = 1 Then ElseIf GUICtrlRead($RadioExportBill) = 1 Then Send("{DOWN}") ElseIf GUICtrlRead($RadioOther) = 1 Then Send("{DOWN 2}") EndIf EndFunc Func Contacts() Send("+{TAB 4}") Send("{LEFT 3}") BlockInput(0) MsgBox(64, "Nearly Done...", "Please fill out all the fields in the Contacts Tab (Bill To, Contact, Referred By, Bill To Contact), Review the information and Submit. Your Done! ") EndFunc ; Func ED_WM_COMMAND($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg Local $iCode = BitShift($wParam, 16) Switch $lParam Case GUICtrlGetHandle($InputLDescrition) Switch $iCode Case $EN_SETFOCUS If GUICtrlRead($InputLDescrition) = "" Then GUICtrlSetData($InputLDescrition, GUICtrlRead($InputSDescrition)) EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc;==>ED_WM_COMMAND
Valuater Posted June 23, 2009 Posted June 23, 2009 Man, that's got a lot of mixed "stuff" in there.... #1 I have had some similar problem recently and it happened after I used Send("^m") It seemed that the control key got "stuck down" so, being the hobbyist I am, not a real programmer, I ended up finding the solution by replacing that with this.... Send("{CtrlDown}") Send("m") Send("{ctrlUp}") ... and that worked for me... #2 You might want to try to "capture" the Ctrl + n with a blank Function HotKeySet("^n"), "_Null") Func _Null() Return "" EndFunc ***************** anyways, you got to much crap in there for most of us to test, try testing with the ideas i gave you Gooood Luck!! Valuater 8)
PieMan Posted June 23, 2009 Author Posted June 23, 2009 Man, that's got a lot of mixed "stuff" in there.... #1 I have had some similar problem recently and it happened after I used Send("^m") It seemed that the control key got "stuck down" so, being the hobbyist I am, not a real programmer, I ended up finding the solution by replacing that with this.... Send("{CtrlDown}") Send("m") Send("{ctrlUp}") ... and that worked for me... #2 You might want to try to "capture" the Ctrl + n with a blank Function HotKeySet("^n"), "_Null") Func _Null() Return "" EndFunc ***************** anyways, you got to much crap in there for most of us to test, try testing with the ideas i gave you Gooood Luck!! Valuater 8) Ok thanks for the advice, ill give it a go in a sec. Now I've removed all the "crap" (Functions) and my code still is giving me the problem with Shift + N: expandcollapse popup#Region;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_icon=F:\Affinity\Affinity Script Resources\icon.ico #EndRegion;**** Directives created by AutoIt3Wrapper_GUI **** #cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.0.0 Author: Hilmy Abdic Script Function: Automate matter creation in Affinity #ce ---------------------------------------------------------------------------- ; Script Start - Add your code below here WinWaitActive("Matter Creation") $destination = "F:\Affinity\Affinity Script Resources\affinityB.JPG" SplashImageOn("Matter Creation Form", $destination,288,236) WinSetOnTop("Splash Screen", "", 1) Sleep(3000) SplashOff() Global $Date, $DTM_SETFORMAT_, $style, $validation, $Alpha, $Sinput, $Linput, $Value, $InputDisb1 #include <ButtonConstants.au3> #include <DateTimeConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $MatterCreationForm_1 = GUICreate("New Matter Creation Form", 485, 555, 192, 114) $MenuFile = GUICtrlCreateMenu("&File") $MenuClear = GUICtrlCreateMenuItem("Clear Fields", $MenuFile) $MenuExit = GUICtrlCreateMenuItem("Exit", $MenuFile) $MenuHelp = GUICtrlCreateMenu("&Help") $MenuAbout = GUICtrlCreateMenuItem("About", $MenuHelp) $Label1 = GUICtrlCreateLabel("*Instructed:", 8, 32, 54, 17) $Label2 = GUICtrlCreateLabel("Matter Creation", 168, 8, 79, 17) $Date = GUICtrlCreateDate("", 112, 32, 186, 21) $InputAlpha = GUICtrlCreateInput("", 112, 64, 121, 21) $InputSDescrition = GUICtrlCreateEdit("", 112, 96, 289, 57, $ES_AUTOVSCROLL + $WS_VSCROLL) GUICtrlSetLimit($InputSDescrition, 85) GUICtrlSetData(-1, "") $InputLDescrition = GUICtrlCreateEdit("", 112, 168, 289, 81, $ES_AUTOVSCROLL + $WS_VSCROLL) GUICtrlSetLimit($InputLDescrition, 400) GUICtrlSetData(-1, "") $InputRef = GUICtrlCreateInput("", 112, 272, 121, 21) $Label4 = GUICtrlCreateLabel("*Short Description:", 8, 88, 88, 17) $Label5 = GUICtrlCreateLabel("*Long Description:", 8, 168, 87, 17) $Group1 = GUICtrlCreateGroup("Financial", 17, 305, 255, 151) $Label7 = GUICtrlCreateLabel("Expected Value:", 24, 320, 85, 17) $Label8 = GUICtrlCreateLabel("Credit Limits:", 72, 352, 63, 17) $Label9 = GUICtrlCreateLabel("*Fees:", 24, 376, 30, 17) $Label10 = GUICtrlCreateLabel("*Disbursements:", 24, 400, 76, 17) $Label11 = GUICtrlCreateLabel("Overall Limit:", 24, 424, 64, 17) $InputEValue = GUICtrlCreateInput("", 112, 320, 73, 21) GUICtrlSetState(-1, $GUI_DISABLE) $InputFees = GUICtrlCreateInput("", 109, 373, 73, 21) $InputDisb = GUICtrlCreateInput("", 109, 397, 73, 21) $Label13 = GUICtrlCreateLabel("(Optional)", 208, 392, 49, 17) $InputOverLimit = GUICtrlCreateInput("", 109, 421, 73, 21) GUICtrlSetState(-1, $GUI_DISABLE) $ChkAuth = GUICtrlCreateCheckbox("Authority", 192, 376, 65, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) $Billing = GUICtrlCreateGroup("Billing", 280, 304, 169, 153) $RadioTaxBill = GUICtrlCreateRadio("Taxable Bill", 288, 352, 113, 17) $Label3 = GUICtrlCreateLabel("Tax Status for New Bills:", 288, 328, 122, 17) $RadioExportBill = GUICtrlCreateRadio("Export Bill", 288, 385, 113, 17) $RadioOther = GUICtrlCreateRadio("Other Tax-free Bill", 288, 416, 113, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) $ButtonPopulate = GUICtrlCreateButton("Populate Fields", 184, 480, 123, 33, $WS_GROUP) $Label6 = GUICtrlCreateLabel("Alpha (Optional):", 8, 64, 96, 17) $Label12 = GUICtrlCreateLabel("Your Ref. (Optional):", 8, 272, 100, 17) ;$BtnSLcopy = GUICtrlCreateButton("Copy", 408, 136, 67, 41, $WS_GROUP) GUISetState(@SW_SHOW) Dim $MatterCreationForm_1_AccelTable[1][2] = [["{NUM 5}", $MenuExit]] GUISetAccelerators($MatterCreationForm_1_AccelTable) #EndRegion ### END Koda GUI section ### ; to select a specific default format $DTM_SETFORMAT_ = 0x1032 $style = "dd/MM/yyyy" GUICtrlSendMsg($Date, $DTM_SETFORMAT_, 0, $style) ;Sets radio button to be checked at load GuiCtrlSetState($RadioTaxBill, $GUI_CHECKED) WinSetOnTop ("New Matter Creation Form", "", 1) While 1 $nMsg = GUIGetMsg() ;this makes sure the window is always active If Not WinActive($MatterCreationForm_1) Then WinActivate($MatterCreationForm_1) Switch $nMsg Case $GUI_EVENT_CLOSE Sleep(300) Run("F:\Affinity\Affinity Script Resources\New Affinity Scripts\Matter Creation reset.exe") Exit Case $ButtonPopulate If $validation = 0 Then BlockInput(1) WinSetState("New Matter Creation Form", "", @SW_MINIMIZE) WinActivate("Matter Creation") Sleep(200) Opt("SendKeyDelay", 10) Sleep(300) Run("F:\Affinity\Affinity Script Resources\New Affinity Scripts\Matter Creation reset.exe") Exit ElseIf $Validation = 1 Then WinSetOnTop ("New Matter Creation Form", "", 0) MsgBox(16, "STOP", "Not all the required fields have been entered, please fill out the required fields (*) and try again.") WinSetOnTop ("New Matter Creation Form", "", 1) ElseIf $validation = 2 Then WinSetOnTop ("New Matter Creation Form", "", 0) MsgBox(16, "STOP", "You can only enter in numbers in the Financial section. Please amend and try again") WinSetOnTop ("New Matter Creation Form", "", 1) EndIf Case $MenuAbout WinSetOnTop ("New Matter Creation Form", "", 0) MsgBox(0, "About", "Written By: Hilmy Abdic V1.0") WinSetOnTop ("New Matter Creation Form", "", 1) Case $MenuExit Sleep(300) Run("F:\Affinity\Affinity Script Resources\New Affinity Scripts\Matter Creation reset.exe") Exit EndSwitch WEnd ;my functions go here but ive removed them for simplicity
Valuater Posted June 23, 2009 Posted June 23, 2009 I really dont think I can help here I don't have that program It might do something to the Ctrl n ... Best of all, I am on FireFox right now, and if I press Ctrl n I get a new window 8)
PieMan Posted June 23, 2009 Author Posted June 23, 2009 (edited) ok i found out my problem..... i dont know how this code got into my script and i dont even know what it does but it was these lines: Dim $MatterCreationForm_1_AccelTable[1][2] = [["{NUM 5}", $MenuExit]] GUISetAccelerators($MatterCreationForm_1_AccelTable) EDIT: btw, it was SHIFT + N not CTRL + N Edited June 23, 2009 by PieMan
Valuater Posted June 23, 2009 Posted June 23, 2009 ok i found out my problem..... i dont know how this code got into my script and i dont even know what it does but it was these lines: Dim $MatterCreationForm_1_AccelTable[1][2] = [["{NUM 5}", $MenuExit]] GUISetAccelerators($MatterCreationForm_1_AccelTable) lol That was part of the "crap" I was talking about too!!..... 8)
PieMan Posted June 23, 2009 Author Posted June 23, 2009 (edited) lolThat was part of the "crap" I was talking about too!!..... 8).... why didn't you tell me to remove it lol.....?EDIT: I used Koda designt to formulate that section .... don't know y it put that in there :S Edited June 23, 2009 by PieMan
Valuater Posted June 23, 2009 Posted June 23, 2009 See... You Got to have your cake and eat it too!!! Pie Man!! lol Enjoy Autoit! 8)
PieMan Posted June 23, 2009 Author Posted June 23, 2009 See... You Got to have your cake and eat it too!!! Pie Man!!lolEnjoy Autoit!8)hahahah anyways ....Thanks!
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