Jump to content

SFK GUI Issue


Recommended Posts

I'm using SFK.exe (Swiss File Knife) to basically find out what files contain a particular variable. For instance:

A variable named ClearFocus. I want to look through perhaps 200 .lua or .xml files and see if the ClearFocus function exists and then write a text file after the variable name that contains a listing of the files it's listed in. SFK allows you to do that with the following command:

"SFK.exe find -names . ClearFocus > Path\ClearFocus.txt"

This works great in a DOS prompt. The problems are occurring within my GUI.

The GUI basically does the following:

Gives you a file open dialog to choose the file you want to parse.

Once the file is chosen the program stores the data within that file to an array

The array pieces are then called using RunWait for "SFK.exe find -names . ArrayData > Path\ArrayData.txt"

This "should" allow SFK to create a file in the specified path that contains the names of all files in the script directory.

The issue:

The progress bar works fine

The label updates fine showing each file as it is parsed

If I remove @swhide I can see the dos prompts working. I also have a file path exists checking scenario in the script to ensure that the file works. As the script runs, I can look in the process tree and see that SFK.exe is working. However, "It will NOT write my file to a file.txt format in the output directory".

WHY?

#include <Array.au3>
#include <EditConstants.au3>
#include <File.au3>
#include <GUIConstants.au3>
#include <GUIConstantsEx.au3>
#Include <GuiListView.au3>
#include <Misc.au3>
#include <WinAPI.au3>

Global $author = "Ealric", $version = "1.0.0"
Global $path = @ScriptDir
Global $outputpath = $path & "\output\"
Global $SFK = $path & '\sfk.exe'

Global $parent = GUICreate("Swiss File Knife Parser: " & $version, 300, 200)
GUICtrlCreateLabel("Click the parse button below and select the " & _ 
                    "text file you wish to parse.",10,10,270,40)
Global $pbar = GUICtrlCreateProgress(20,60,260,20)
Global $plabel = GUICtrlCreateLabel("File Names",20,85,260,20)
GUISetState(@SW_SHOW, $parent)

Local $PARSEb = GUICtrlCreateButton("&PARSE", 10, 170, 100, 20, $BS_DEFPUSHBUTTON)

While 1
    $msg = GUIGetMsg()
    Switch $msg
    Case $GUI_EVENT_CLOSE
        Exit
    Case $PARSEb
        _parse()
        MsgBox(64,"Completed","Parsing has been completed")
    EndSwitch
WEnd

Func _parse()
    If FileExists($SFK) Then
        Local $aFunctions
        Local $t,$d,$i = 0
        Local $fOpen = FileOpenDialog("Chose Path\Filename.txt to be parsed", $path, "Text files (*.txt)")
        _FileReadToArray($fOpen,$aFunctions)
        If IsArray($aFunctions) = 1 Then
            $t = Round($aFunctions[0]/100,0)
            $d = $t
            For $x = 1 to $aFunctions[0]
                GUICtrlSetData($plabel,$aFunctions[$x])
                RunWait($SFK & ' find -names . ' & $aFunctions[$x] & ' > ' & $outputpath & _ 
                        $aFunctions[$x] & ".txt",@ScriptDir,@SW_HIDE)
                If $x = $t Then
                    GUICtrlSetData($pbar,$i+1)
                    $t = $t+$d 
                EndIf
            Next
        Else
            MsgBox(48,"Not an Array","The file you are attempting to open can not be written to an array.")
        EndIf
        FileClose($fOpen)
    Else
        MsgBox(48,"Error","The file path to the executable does not exist or is incorrect.")
    EndIf
EndFunc

My Projects: [topic="89413"]GoogleHack Search[/topic], [topic="67095"]Swiss File Knife GUI[/topic], [topic="69072"]Mouse Location Pointer[/topic], [topic="86040"]Standard Deviation Calculator[/topic]

Link to comment
Share on other sites

Just going to reiterate something here.

SFK is a dos utility with a lot of console type features and switches.

Let's say I have a folder structure as such:

C:\Test\sfk.exe

C:\Test\Output\

If I type the following:

(from the C:\Test\ directory at a dos prompt)

sfk find -names . ClearFocus > c:\Test\Output\output.txt

..

I will get an output.txt file that contains about 11 file names listed inside of it. So, the program and it's usage works correctly. Now I need to translate that same feature into autoit so that it runs a RunWait command (allowing the process to finish per file searched) and do the same type of output. See my script above and the example here and let me know what I might be doing wrong.

Thanks.

Edited by Ealric

My Projects: [topic="89413"]GoogleHack Search[/topic], [topic="67095"]Swiss File Knife GUI[/topic], [topic="69072"]Mouse Location Pointer[/topic], [topic="86040"]Standard Deviation Calculator[/topic]

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...