Xenobiologist Posted October 8, 2007 Share Posted October 8, 2007 Hi, Autoit shows up a MsgBox when e.g. using _GUICtrlStatusBar_SetText and setting as handle a wrong handle like it did here : _GUICtrlStatusBar_SetText ($inst_LV, @TAB & "Time : " & Round(TimerDiff($timer), 2) & ' ms', 2) Complete script: expandcollapse popup#cs ---------------------------------------------------------------------------- AutoIt Version: 3.2.9.3 (beta) Author: Thorsten Meger Script Function: Institutsmapper #ce ---------------------------------------------------------------------------- #Region Compiler directives section ;XXX #EndRegion #include <GUIConstants.au3> #Include <GuiStatusBar.au3> #Include <GuiListView.au3> #Include <File.au3> #Include <Array.au3> Global $version = '1.0' Global $h_Gui = GUICreate("Institutsmapper XF01145", 644, 441, 193, 125) GUICtrlCreateGroup("", 5, 0, 635, 415) Global $inst_LV = GUICtrlCreateListView('Institutsnummer|bank21-reporting-MG|bank21-MG|Instanzname|ContentStore', 10, 50, 626, 360) GUICtrlSetBkColor(-1, $GUI_BKCOLOR_LV_ALTERNATE) GUICtrlSetBkColor(-1, 0xFFFFFF) GUICtrlSendMsg($inst_LV, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_GRIDLINES, $LVS_EX_GRIDLINES) GUICtrlSendMsg($inst_LV, $LVM_SETEXTENDEDLISTVIEWSTYLE, $LVS_EX_FULLROWSELECT, $LVS_EX_FULLROWSELECT) GUICtrlSetFont($inst_LV, 9, 600, '', 'Arial') _GUICtrlListView_SetColumnWidth ($inst_LV, 0, 120) _GUICtrlListView_SetColumnWidth ($inst_LV, 1, 130) _GUICtrlListView_SetColumnWidth ($inst_LV, 2, 100) _GUICtrlListView_SetColumnWidth ($inst_LV, 3, 100) _GUICtrlListView_SetColumnWidth ($inst_LV, 4, $LVSCW_AUTOSIZE_USEHEADER) GUICtrlCreateLabel("Institutsnummer", 15, 15, 140, 17) GUICtrlSetFont(-1, 12, 700) GUICtrlSetColor(-1, 0xFF0000) Global $instNr_I = GUICtrlCreateInput("6000", 155, 15, 51, 21, $ES_NUMBER) GUICtrlSetLimit(-1, 4, 1) Global $suche_B = GUICtrlCreateButton("Suche", 225, 15, 105, 20, 0) Global $copy_B = GUICtrlCreateButton("Zwischenablage", 335, 15, 105, 20, 0) Global $a_PartsRightEdge[3] = [90, 500, -1] Global $a_PartsText[3] = [@TAB & "Version : " & $version, @TAB & "... bereit ", "Time : " ] Global $statusbar = _GUICtrlStatusBar_Create ($h_Gui, $a_PartsRightEdge, $a_PartsText) GUICtrlCreateGroup("", -99, -99, 1, 1) Global $pfadDatei = @ScriptDir & '\REP_MG' Global $pfadMappingDatei = @ScriptDir & '\Mapping_DB\Mapping_DB_Instanz.txt' Global $mappingDateiInhalt = 0, $B_DESCENDING = 0, $index = 0 Global $timer = TimerInit() _start() _GUICtrlStatusBar_SetText ($inst_LV, @TAB & "Time : " & Round(TimerDiff($timer), 2) & ' ms', 2) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $suche_B _sucheInstNr() Case $copy_B _copyToClip() _GUICtrlStatusBar_SetText ($statusbar, @TAB & _GUICtrlListView_GetItemTextString ($inst_LV, $index) & ' in die Zwischenablage kopiert.', 1) EndSwitch WEnd Func _einlesen($pfad) ; Lies alle Mandantengruppen für reporting (bisher 6) Local $MandantengruppenReporting = _FileListToArray($pfad, '*.*', 2) If @error = 1 Then MsgBox(0, "", "1 ) No Files\Folders Found in " & $pfad) Exit EndIf Local $institusnummern_A ; Lies alle Institutsnummern pro Mandatengruppe für reporting (bisher 6) For $a = 1 To UBound($MandantengruppenReporting) - 1 Local $MG_Dateiennamen = _FileListToArray($pfad & '\' & $MandantengruppenReporting[$a], '*.txt', 1) For $b = 1 To UBound($MG_Dateiennamen) - 1 $file = FileOpen($pfad & '\' & $MandantengruppenReporting[$a] & '\' & $MG_Dateiennamen[$b], 0) While 1 $line = FileReadLine($file) If @error = -1 Then ExitLoop ; Instanz If StringLen(StringStripWS($line, 8)) = 4 Then $dbInstanz = StringRegExp($mappingDateiInhalt, 'db\w+(?=[ ]*.+' & StringStripWS($line, 8) & ')', 3) $contentStore = StringRegExp($mappingDateiInhalt, '(?<=' & $dbInstanz[0] & ')[ ]+CS[a-zA-Z0-9]*', 3) If IsArray($contentStore) Then $str = ' ' & $line & '|' & $MandantengruppenReporting[$a] & '|' & _ StringLeft(StringRight($MG_Dateiennamen[$b], 5), 1) & _ '|' & $dbInstanz[0] & '|' & StringStripWS($contentStore[0], 8) ;ConsoleWrite($str & @CRLF); Ausgabe der Aufbereitung GUICtrlCreateListViewItem($str, $inst_LV) GUICtrlSetBkColor(-1, 0x9C9CDE) EndIf EndIf WEnd Next Next Global $B_DESCENDING[5] Local $iCol[2] = [0] _GUICtrlListView_SimpleSort ($inst_LV, $B_DESCENDING, $iCol) EndFunc ;==>_einlesen Func _copyToClip() ClipPut(_GUICtrlListView_GetItemTextString ($inst_LV, $index)) EndFunc ;==>_copyToClip Func _sucheInstNr() Global $index = _GUICtrlListView_FindText ($inst_LV, ' ' & GUICtrlRead($instNr_I), -1, True, True) If $index = -1 Then _GUICtrlStatusBar_SetText ($statusbar, @TAB & GUICtrlRead($instNr_I) & ' konnte nicht gefunden werden.', 1) Else _GUICtrlListView_EnsureVisible ($inst_LV, $index, False) _GUICtrlListView_SetItemSelected ($inst_LV, $index, True) _GUICtrlStatusBar_SetText ($statusbar, @TAB & GUICtrlRead($instNr_I) & ' wurde gefunden und makiert.', 1) EndIf EndFunc ;==>_sucheInstNr Func _start() ;If Not (FileExists($pfadDatei) Or FileExists($pfadMappingDatei)) Then ; MsgBox(16, 'Error', 'Das Skript liegt nicht an der richtigen Stelle!', 10) ; Exit (0) ;EndIf $file = FileOpen($pfadMappingDatei, 0) If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf $mappingDateiInhalt = FileRead($file) _einlesen($pfadDatei) EndFunc ;==>_start This is no really bug, but maybe showing up a Msgbox and then retuning RC=0 is strange So long, Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
GaryFrost Posted October 8, 2007 Share Posted October 8, 2007 Hi, Autoit shows up a MsgBox when e.g. using _GUICtrlStatusBar_SetText and setting as handle a wrong handle like it did here : _GUICtrlStatusBar_SetText ($inst_LV, @TAB & "Time : " & Round(TimerDiff($timer), 2) & ' ms', 2) This is no really bug, but maybe showing up a Msgbox and then retuning RC=0 is strange So long, Mega I don't find it strange that it tells you an invalid window handle. Would think it would help in finding error(s) in your script(s). now that you know you have a bug, you could always add a debug line below the includes to give a better description $Debug_SB = True ; Check ClassName being passed to functions, set to True and use a handle to another control to see it work add that line and run your script SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
Xenobiologist Posted October 8, 2007 Author Share Posted October 8, 2007 Hi, okay thanks! Sorry for putting this question here, but I didn't want to start another thread. Where is _GUICtrlListViewJustifyColumn gone? ( in your new udfs) P.S.: The behaviour of Autoit showing the error is what I was curious about. Nevertheless keep going on! So long, Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
GaryFrost Posted October 8, 2007 Share Posted October 8, 2007 (edited) Hi,okay thanks! Sorry for putting this question here, but I didn't want to start another thread. Where is _GUICtrlListViewJustifyColumn gone? ( in your new udfs)P.S.: The behaviour of Autoit showing the error is what I was curious about.Nevertheless keep going on!So long,MegaLook at _GUICtrlListView_SetColumn functionMoved Topic to support Edited October 8, 2007 by GaryFrost SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
GaryFrost Posted October 9, 2007 Share Posted October 9, 2007 Was wondering if you figured out what you needed to do with the new beta function(s)? SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
jpm Posted October 12, 2007 Share Posted October 12, 2007 I like the debug flag, but I think a UDF should return an error and not displaying a popup on error except in very very special case. I don't think this one is so special Link to comment Share on other sites More sharing options...
Xenobiologist Posted October 12, 2007 Author Share Posted October 12, 2007 Hi, @Gary : Yes. It was a little step-by-step again, but once got used to the new funcs it is nearly the same as before. The helpfile is my friend. There are same special things I couldn't figure out till now, but I guess it is all in the help file. @jpm : That's all I wanted to say. No criticism, just an idea to let you thin about whether this popup is right. So long, Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
GaryFrost Posted October 12, 2007 Share Posted October 12, 2007 (edited) I like the debug flag, but I think a UDF should return an error and not displaying a popup on error except in very very special case. I don't think this one is so special Passing the wrong control in is not special? I would think it would be.Besides, most of the _WinAPI_/_Memxxxxx were not changed, just renamed so they work the same as they do in Paul's lib. Edited October 12, 2007 by GaryFrost SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
jpm Posted October 12, 2007 Share Posted October 12, 2007 Passing the wrong control in is not special? I would think it would be.Besides, most of the _WinAPI_/_Memxxxxx were not changed, just renamed so they work the same as they do in Paul's lib.I think we can suppress the msgbox in case of error and return something anormal. Link to comment Share on other sites More sharing options...
GaryFrost Posted October 12, 2007 Share Posted October 12, 2007 I think we can suppress the msgbox in case of error and return something anormal.Well it's going to be a while before that can happen I think, because that would mean any UDF that uses those calls will have to be modified.There are a lot that use those functions. SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
jpm Posted October 12, 2007 Share Posted October 12, 2007 Well it's going to be a while before that can happen I think, because that would mean any UDF that uses those calls will have to be modified.There are a lot that use those functions.I don't understand why the PaulIA implementation cannot be corrected to have a more standard behavior. Link to comment Share on other sites More sharing options...
GaryFrost Posted October 12, 2007 Share Posted October 12, 2007 I don't understand why the PaulIA implementation cannot be corrected to have a more standard behavior.It can be, just going to take time.Not sure I want functions that deal with memory just returning an error.At least exit the app/script.Of course if the app/script exits with-out an error message then the users won't know where to start looking for the problem. SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. 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