Hypertrophy Posted August 16, 2009 Share Posted August 16, 2009 (edited) The code below creates pictures on the current window in the loop by a method of inireading and so forth. What is important and what I'm having trouble with is at the beginning of my function I want to delete all of the pictures created by _TargetAddPic(). For example, I have two external windows running and I "embed" and create a picture on each external window using _TargetAddPic(). So far everything is perfect. Well after it has finished running through the loop it goes back to the beginning of the function. What I want to do is when it starts over again I want to delete ALL pictures on the external windows before continuing in the function and I dont know how to do this. I attempted as you will see below but failed >_< expandcollapse popup;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; MY GOAL AND WHAT I NEED HELP WITH IS TO CREATE LITTLE ; PICTURES ON EXTERNAL WINDOWS USING ANYGUI. THE REASON I ; WANT TO USE ANYGUI IS BECAUSE IT "EMBEDS" THE PICTURES ; INTO THE TARGET WINDOW SO THEY WILL MOVE WITH AND ; MINIMIZE WITH THE TARGET WINDOW ; MY PROBLEM IS AT THE BEGINNING OF THIS FUNCTION I WANT ; TO --DELETE-- ALL EXISTING PICTURES CREATED BY ANYGUI ; USING THE _TARGETADDPIC(). I TRY TO DO THIS ON LINE ; 18 BUT IT'S NOT COMPLETELY WORKING. PLEASE HELP ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Func Test() If ProcessExists("Application.exe") Then ;------------------------------------------------- For $i = 1 To $ahInput[0][0] GUIDelete($ahInput[$i][0]) ; delete all little pictures created by _TargetAddPic() (NOT WORKING) Next ;------------------------------------------------- $string = "Test" & StringReplace(StringTrimRight(_NowCalc(),8), "/","") $ftpname = IniRead(@ScriptDir & "\data\Config.dat", "Section", "Logging", "") $array = StringSplit($ftpname, "\") $i = $array[0] $ftpname = $array[$i] If $ftpname = "" Then ; either the user hasn't set Logging location yet or has done it incorrectly MsgBox(0, "", "Configure your Logging location in the settings window.") EndIf $hhf_dir = IniRead(@ScriptDir & "\data\Config.dat", "Section", "Logging", "") $list = WinList("[CLASS:QWidget]") ; list all windows with classname QWidget For $n = 1 To $list[0][0] If $list[$n][0] <> "" AND IsVisible($list[$n][1]) Then ; if window is visible and has a title If $list[$n][0] = "Window Name Test Window " & $ftpname Then ; skip this window Else ; store the path of the file $path = $hhf_dir & "\" & $string & "" & StringTrimRight(StringReplace($list[$n][0], "/", "-"), StringLen($ftpname) + 16) & ".txt" ; open for reading $hh = FileOpen($hhf_dir & "\" & $string & "" & StringTrimRight(StringReplace($list[$n][0], "/", "-"), StringLen($ftpname) + 16) & ".txt", 0) If $hh = -1 Then ContinueLoop EndIf ; close file FileClose($hh) $target = _GUITarget($list[$n][0] ; HERE'S THE ANYGUI CODE --- I WANT TO TARGET THE CURRENT WINDOW IN THE LOOP $count = _FileCountLines($path) For $s=10 To 0 Step -1 $line = FileReadLine($path, $count - $s) FileWrite(@ScriptDir & "\data\" & StringReplace($list[$n][0], "/", "-") & ".txt", $line & @CRLF) Next $readtemp = FileRead(@ScriptDir & "\data\" & StringReplace($list[$n][0], "/", "-") & ".txt") ; read temp data into array _FileReadToArray(@ScriptDir & "\data\" & StringReplace($list[$n][0], "/", "-") & ".txt", $asArray) $sectionNAMES=IniReadSectionNames($datfile) For $t=1 To $sectionNAMES[0] $section = IniReadSection($datfile, "Section" & $t) For $i=1 To $section[0][0] If StringInStr($readtemp, $section[$i][0]) Then $split = StringSplit($section[$i][1], ",") For $x = 1 To $split[0] If $split[$x] = "Info/data" Then For $q = 1 To $asArray[0] If StringInStr($asArray[$q],$section[$i][0]) > 0 Then If StringLeft($asArray[$q],5) = "Seat " Then $Seat = StringMid($asArray[$q],6,1) IniWrite(@ScriptDir & "\data\test.ini", $list[$n][0], $section[$i][0] & "*Seat" & $Seat, "Info/data") EndIf EndIf Next EndIf Next EndIf Next Next FileDelete(@ScriptDir & "\data\" & StringReplace($list[$n][0], "/", "-") & ".txt") $names = IniReadSectionNames(@ScriptDir & "\data\test.ini") If IsArray($names) Then For $e=1 To $names[0] ; for each section name $dumpsection = IniReadSection(@ScriptDir & "\data\test.ini", $names[$e]) For $a=1 To $dumpsection[0][0] ; for each key/value in section $secondsplit = StringSplit($dumpsection[$a][0], "*") For $g=1 To $secondsplit[0] If $secondsplit[$g] = "Seat1" Then $current_tilt_win = WinGetPos($names[$e]) $ahInput[0][0] += 1 ReDim $ahInput[$ahInput[0][0] + 1][6] ; HERE'S WHERE I ADD A PIC ONTO THE WINDOW $ahInput[$ahInput[0][0]][0] = _TargetAddPic(@ScriptDir & "\folder\" & $dumpsection[$a][1] & ".gif", 100, 100, 26, 26, -1, -1, $target) #cs -- HERE'S THE OLD METHOD I USED TO CREATE WINDOWS ON AN EXTERNAL APP -- $ahInput[$ahInput[0][0]][0] = GUICreate(StringTrimRight($dumpsection[$a][0], 6), 26, 26, $current_tilt_win[0] + 454, $current_tilt_win[1] + 139, _ $WS_POPUP, BitOR($WS_EX_TOOLWINDOW, $WS_EX_LAYERED)) $ahInput[$ahInput[0][0]][1] = GUICtrlCreatePic(@ScriptDir & "\folder\" & $dumpsection[$a][1] & ".gif", 0, 0, 26, 26, -1) #ce ElseIf $secondsplit[$g] = "Seat2" Then $current_tilt_win = WinGetPos($names[$e]) $ahInput[0][0] += 1 ReDim $ahInput[$ahInput[0][0] + 1][6] ; HERE'S WHERE I ADD A PIC ONTO THE WINDOW $ahInput[$ahInput[0][0]][0] = _TargetAddPic(@ScriptDir & "\folder\" & $dumpsection[$a][1] & ".gif", 204, 141, 26, 26, -1, -1, $target) #cs -- HERE'S THE OLD METHOD I USED TO CREATE WINDOWS ON AN EXTERNAL APP -- $ahInput[$ahInput[0][0]][0] = GUICreate(StringTrimRight($dumpsection[$a][0], 6), 26, 26, $current_tilt_win[0] + 628, $current_tilt_win[1] + 219, _ $WS_POPUP, BitOR($WS_EX_TOOLWINDOW, $WS_EX_LAYERED)) $ahInput[$ahInput[0][0]][1] = GUICtrlCreatePic(@ScriptDir & "\folder\" & $dumpsection[$a][1] & ".gif", 0, 0, 26, 26, -1) #ce Next Next Next EndIf FileDelete(@ScriptDir & "\data\test.ini") EndIf EndIf Next EndIf EndFunc Edited August 16, 2009 by Hypertrophy Link to comment Share on other sites More sharing options...
Developers Jos Posted August 16, 2009 Developers Share Posted August 16, 2009 How many thread do you want to have on this subject? What about sticking to 1? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Hypertrophy Posted August 16, 2009 Author Share Posted August 16, 2009 This is the first thread I posted all my code... Link to comment Share on other sites More sharing options...
Developers Jos Posted August 16, 2009 Developers Share Posted August 16, 2009 This is the first thread I posted all my code...I don't really care, just stick to one thread. After 2 warnings there is less compassion.Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Recommended Posts