MHz Posted March 29, 2007 Share Posted March 29, 2007 (edited) @Gollum AutoIt is not case sensitive and your suggested line is no good as you need to check @error right after a function call or else it resets with the next function call which RegRead would reset it. Edit: lsakizada. out of the loop and into to more problems...hmm Edited March 29, 2007 by MHz Link to comment Share on other sites More sharing options...
Gollum Posted March 29, 2007 Share Posted March 29, 2007 @Gollum AutoIt is not case sensitive and your suggested line is no good as you need to check @error right after a function call or else it resets with the next function call which RegRead would reset it.Oops me and my big mouth :"> This get me the GUI up and running Func ODBCsources($h_controlID, $s_RegEntry, $s_Type) Local $s_List, $i_dsncount, $s_VarNm, $s_Value, $i $i = 1 $s_VarNm = RegEnumVal($s_RegEntry, $i) If @error Then Return $s_Value = RegRead($s_RegEntry, $s_VarNm) While $s_VarNm <> "" $s_VarNm = RegEnumVal($s_RegEntry, $i) If @error Then ExitLoop $s_Value = RegRead($s_RegEntry, $s_VarNm) If $s_VarNm <> "" Then GUICtrlCreateListViewItem($s_VarNm & "|" & $s_Type & "|" & $s_Value, $h_controlID) $i += 1 $i_DSNcount += 1 EndIf Wend EndFunc Link to comment Share on other sites More sharing options...
lsakizada Posted March 29, 2007 Author Share Posted March 29, 2007 Oops me and my big mouth :"> This get me the GUI up and running Func ODBCsources($h_controlID, $s_RegEntry, $s_Type) Local $s_List, $i_dsncount, $s_VarNm, $s_Value, $i $i = 1 $s_VarNm = RegEnumVal($s_RegEntry, $i) If @error Then Return $s_Value = RegRead($s_RegEntry, $s_VarNm) While $s_VarNm <> "" $s_VarNm = RegEnumVal($s_RegEntry, $i) If @error Then ExitLoop $s_Value = RegRead($s_RegEntry, $s_VarNm) If $s_VarNm <> "" Then GUICtrlCreateListViewItem($s_VarNm & "|" & $s_Type & "|" & $s_Value, $h_controlID) $i += 1 $i_DSNcount += 1 EndIf Wend EndFunc This is not working for me. Has the same error as I mentioned ... Be Green Now or Never (BGNN)! Link to comment Share on other sites More sharing options...
Gollum Posted March 29, 2007 Share Posted March 29, 2007 Yeah, sorry, was so intent on solution I forgot you're using beta only. I'll slink away now. Link to comment Share on other sites More sharing options...
lsakizada Posted March 29, 2007 Author Share Posted March 29, 2007 (edited) Yeah, sorry, was so intent on solution I forgot you're using beta only.I'll slink away now. I may got a clue:The ControlGetPos function in around line 146 does not working. It is not returning array as used to be. Edited March 29, 2007 by lsakizada Be Green Now or Never (BGNN)! Link to comment Share on other sites More sharing options...
MHz Posted March 29, 2007 Share Posted March 29, 2007 There is 2 GuiSetState in this example. Comment one and then comment the other to see the change in effect. GUICreate('') $Button_1 = GUICtrlCreateButton ("Run Notepad", 10, 30, 100) ;~ GUISetState () ControlGetPos('', '', $Button_1) If @error Then MsgBox(0, '', 'error') GUISetState () Sleep(10000) Link to comment Share on other sites More sharing options...
Gollum Posted March 29, 2007 Share Posted March 29, 2007 Cpuldn't keep away, had to find how this got solved. Damn clever solution MHz Link to comment Share on other sites More sharing options...
lsakizada Posted March 29, 2007 Author Share Posted March 29, 2007 (edited) There is 2 GuiSetState in this example. Comment one and then comment the other to see the change in effect. GUICreate('') $Button_1 = GUICtrlCreateButton ("Run Notepad", 10, 30, 100) ;~ GUISetState () ControlGetPos('', '', $Button_1) If @error Then MsgBox(0, '', 'error') GUISetState () Sleep(10000) MHZ Almost you done it. That's bring up the GUI but messed up the "Query" tab item. $tab_query=GUICtrlCreateTabitem (" Query "). I commented 2 lines and it works for me fine. I commented: ;$lab_sql2 = GUICtrlCreateLabel($sql_str_1, 20, $b_size[1]- 15, 550, 150) $c_size = ControlGetPos("", "", $lst_monitor1) ;$lab_sql2 = GUICtrlCreateLabel($sql_str_2, 20, $c_size[1]- 15, 550, 150) But still why it is behave not normal ???? Guys, I will monitor this topic latter today. I must go now. Thanks and many for your help. Please think about this issue. might be an Autoit Bug Edited March 29, 2007 by lsakizada Be Green Now or Never (BGNN)! Link to comment Share on other sites More sharing options...
Teldin Posted December 14, 2007 Share Posted December 14, 2007 (edited) In case you still care, Your problem is here: ; DSN Global Const $s_ODBCregUser = "HKEY_CURRENT_USER\SOFTWARE\ODBC\ODBC.INI\ODBC Data Sources" Global Const $s_ODBCregSystem = "HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI\ODBC Data Sources" Func ODBCsources($h_controlID, $s_RegEntry, $s_Type) Local $s_List, $i_dsncount, $s_VarNm, $s_Value, $i $i = 1 $s_VarNm = RegEnumVal($s_RegEntry, $i) If @error Then Return $s_Value = RegRead($s_RegEntry, $s_VarNm) While $s_VarNm <> "" $s_VarNm = RegEnumVal($s_RegEntry, $i) If @error Then ExitLoop $s_Value = RegRead($s_RegEntry, $s_VarNm) If $s_VarNm <> "" Then GUICtrlCreateListViewItem($s_VarNm & "|" & $s_Type & "|" & $s_Value, $h_controlID) $i += 1 $i_DSNcount += 1 EndIf Wend EndFunc If you trace those lines you'll find it loops infinately due to the fact that $s_VarNm never equals "". There are several SQL scripts floating around which have the same problem. The only solution I found is to hard code the DB name instead of trying to read it from the registry. Edited December 14, 2007 by Teldin 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