BPBNA Posted July 12, 2006 Posted July 12, 2006 I have created a program that runs a search in another program and pulls out information. That part works fine. When I try to parse the file for the first time, it works, but if I parse it a second time it keeps running parseini.exe over and over again until I end the HEAT Util.exe process. If I comment out the lines below, it works perfectly. Why is this? Case $msg = $recentparse ParseFile() Here is the file... HEAT_Util.au3
Xenobiologist Posted July 12, 2006 Posted July 12, 2006 Hi, does this help? expandcollapse popup#include <GUIConstants.au3> Opt("TrayIconDebug", 1) Opt("WinTitleMatchMode", 2) Global $file[2][5], $fileopn, $recentfile $count = 4 $mainwindow = GUICreate("HEAT Utility", 175, 25) $filemenu = GUICtrlCreateMenu("&File") $open = GUICtrlCreateMenuItem("Open...", $filemenu) $parse = GUICtrlCreateMenuItem("Parse...", $filemenu) $recentopen = GUICtrlCreateMenu("Recent Open", $filemenu) $recentparse = GUICtrlCreateMenu("Recent Parse", $filemenu) $quit = GUICtrlCreateMenuItem("Exit", $filemenu) $heat = GUICtrlCreateMenu("&HEAT") $run = GUICtrlCreateMenuItem("HEAT Search", $heat) $noneopen = GUICtrlCreateMenuItem("(None)", $recentopen) $noneparse = GUICtrlCreateMenuItem("(None)", $recentparse) GUICtrlSetState($noneopen, $GUI_DISABLE) GUICtrlSetState($noneparse, $GUI_DISABLE) While 1 $msg = GUIGetMsg() Select Case $msg = $open $fileopn = FileOpenDialog("Choose file...",@ScriptDir & "\searches","INI File (*.ini)") If @error <> 1 then Run(@ComSpec & " /c notepad.exe " & $fileopn, "", @SW_HIDE) EndIf GUICtrlDelete($noneopen) $slash = StringInStr($fileopn, "\", 0, -1) $filerecent = StringTrimLeft($fileopn, $slash) $recentopen = GUICtrlCreateMenuItem($filerecent, $recentopen) Case $msg = $parse $fileparse = FileOpenDialog("Choose file...",@ScriptDir & "\searches","INI File (*.ini)") If @error <> 1 then ParseFile(2) EndIf GUICtrlDelete($noneparse) $slash = StringInStr($fileparse, "\", 0, -1) $filerecent = StringTrimLeft($fileparse, $slash) $recentparse = GUICtrlCreateMenuItem($filerecent, $recentparse) Case $msg = $run Run("HEATSearch.exe") WinActivate("HEAT Utility") Case $msg = $recentopen Run(@ComSpec & " /c notepad.exe " & $fileopn, "", @SW_HIDE) Case $msg = $recentparse ParseFile(1) Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $quit ExitLoop EndSelect WEnd Func ParseFile($h) If $h = 1 then IniWrite(@ScriptDir & "\ini\parsefile.ini", "FileToParse", "File", $recentparse) Elseif $h = 2 Then IniWrite(@ScriptDir & "\ini\parsefile.ini", "FileToParse", "File", $fileparse) EndIf Run(@ScriptDir & "\parseini.exe") EndFunc;==>ParseFile Func Quit() Exit EndFunc;==>Quit 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
BPBNA Posted July 12, 2006 Author Posted July 12, 2006 (edited) Still keeps running it. I had a nice little experience while ending the process this time.... My task manager lost its title bar, menus, tabs, and status bar thing at the bottom. I cant right click on it on my start bar, and it doesnt have a name on my start bar. Anyone ever seen that happen or know how to get it back? But anyways, it keeps looping but the way you setup the function does look alot cleaner. Here is the screenshot... oh and don't worry about some of those process names, theyr all fine. Edited July 12, 2006 by BPBNA
Skruge Posted July 12, 2006 Posted July 12, 2006 Change this:Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $quit ExitLoopoÝ÷ Ù:-+ºÚ"µÍØÙH ÌÍÛÙÈH ÌÍÑÕRWÑUSÐÓÔÑB^]ØÙH ÌÍÛÙÈH ÌÍÜ]Z]^] [font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font]
BPBNA Posted July 12, 2006 Author Posted July 12, 2006 I don't think that has anything to do with the ParseFile() function (or at least the run command in the function)running over and over again.
Moderators SmOke_N Posted July 12, 2006 Moderators Posted July 12, 2006 (edited) I had no repeats when I ran it like this:expandcollapse popup#include <GUIConstants.au3> Opt("TrayIconDebug", 1) Opt("WinTitleMatchMode", 2) Global $file[2][5], $fileopn, $recentfile $count = 4 $mainwindow = GUICreate("HEAT Utility", 175, 25) $filemenu = GUICtrlCreateMenu("&File") $open = GUICtrlCreateMenuItem("Open...", $filemenu) $parse = GUICtrlCreateMenuItem("Parse...", $filemenu) $recentopen = GUICtrlCreateMenu("Recent Open", $filemenu) $recentparse = GUICtrlCreateMenu("Recent Parse", $filemenu) $quit = GUICtrlCreateMenuItem("Exit", $filemenu) $heat = GUICtrlCreateMenu("&HEAT") $run = GUICtrlCreateMenuItem("HEAT Search", $heat) $noneopen = GUICtrlCreateMenuItem("(None)", $recentopen) $noneparse = GUICtrlCreateMenuItem("(None)", $recentparse) GUICtrlSetState($noneopen, $GUI_DISABLE) GUICtrlSetState($noneparse, $GUI_DISABLE) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $open $fileopn = FileOpenDialog("Choose file...",@ScriptDir & "\searches","INI File (*.ini)") If Not @error Then Run(@ComSpec & " /c notepad.exe " & $fileopn, "", @SW_HIDE) EndIf GUICtrlDelete($noneopen) $slash = StringInStr($fileopn, "\", 0, -1) $filerecent = StringTrimLeft($fileopn, $slash) $recentopen = GUICtrlCreateMenuItem($filerecent, $recentopen) Case $msg = $parse $fileparse = FileOpenDialog("Choose file...",@ScriptDir & "\searches","INI File (*.ini)") If Not @error Then ;MsgBox(0, '2', 'Ran 2') ParseFile(0) EndIf GUICtrlDelete($noneparse) $slash = StringInStr($fileparse, "\", 0, -1) $filerecent = StringTrimLeft($fileparse, $slash) $recentparse = GUICtrlCreateMenuItem($filerecent, $recentparse) Case $msg = $run Run("HEATSearch.exe") WinActivate("HEAT Utility") Case $msg = $recentopen Run(@ComSpec & " /c notepad.exe " & $fileopn, "", @SW_HIDE) Case $msg = $recentparse ;MsgBox(0, '1', 'Ran 1') ParseFile(1) Case $msg = $GUI_EVENT_CLOSE Or $msg = $quit Exit EndSelect WEnd Func ParseFile($iCommand) If $iCommand Then MsgBox(0, 'Info:', 'Sent Via $recentparse') ;IniWrite(@ScriptDir & "\ini\parsefile.ini", "FileToParse", "File", $recentparse) Else MsgBox(0, 'Info:', 'Sent Via $parse') ;IniWrite(@ScriptDir & "\ini\parsefile.ini", "FileToParse", "File", $fileparse) EndIf ;Run(@ScriptDir & "\parseini.exe") EndFunc;==>ParseFile Func Quit() Exit EndFunc;==>QuitI left the message boxes and commented out the other stuff. I did note that you were using 2 arrays the same $recentparse for MenuItem and Menu, had you tried to change those and just dim the MenuItem one? Edited July 12, 2006 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
BPBNA Posted July 12, 2006 Author Posted July 12, 2006 Ah damn! I didn't even notice that. It works now, thanks!
Xenobiologist Posted July 12, 2006 Posted July 12, 2006 Ah damn! I didn't even notice that. It works now, thanks!Hmmh, nearly the same as I posted above. Nevermid!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
Moderators SmOke_N Posted July 12, 2006 Moderators Posted July 12, 2006 No problem, I was answering one of the array questions before this one, and I noticed I said 'array' when it should have been 'variable'... glad it's working for you. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
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