Jump to content

Searh for file in system


3dude
 Share

Recommended Posts

Can I make the script searh for a file in the system!

Example

User presses Search the script finds hl.exe and remembers it end tipes it in something like an inputbox

so the user can press Run and hl.exe runs! ( the script remembers and the other time the user runs the script)

----

Sorry for my bad english but I am in a rush :P:)

thanks

View my blog :) 3dude's blog <= help with project :S

Link to comment
Share on other sites

Could you please give me a link because I couldn't find anything

Try this if you want to:

$File = "GIMPPortable.exe"
$Dir = "c:"

MsgBox(1, "", _FileFind($Dir, $File))

Func _FileFind($sDir, $sFile)
    Dim $HoldPath[1], $F_HoldPath[1]
    $HoldPath[0] = $sDir
    $z = 0
    While 1
        While 1
            $sFound = _SubDir($HoldPath[$z], $sFile, $F_HoldPath)
            If $sFound Then Return $sFound
            If $z = UBound($HoldPath)-1 Then
                $HoldPath = $F_HoldPath
                ExitLoop
            EndIf   
            $z += 1
        WEnd
        If UBound($HoldPath) = 1 Then ExitLoop
        $z = 1
        Dim $F_HoldPath[1]
    WEnd
    Return 0    
EndFunc
Func _SubDir($sDir, $sFile, ByRef $F_HoldPath)  
    $n_Search = FileFindFirstFile($sDir & "\*.*")
    If $n_Search = -1 Then Return
    While 1
        $n_File = FileFindNextFile($n_Search) 
        If @error Then ExitLoop
        If $n_File = $sFile Then Return $sDir & "\" & $n_File 
        If StringInStr(FileGetAttrib($sDir & "\" & $n_File), "D") Then
            ReDim $F_HoldPath[UBound($F_HoldPath)+1]
            $F_HoldPath [UBound($F_HoldPath)-1] = $sDir & "\" & $n_File
        EndIf   
    Wend
    FileClose($n_Search)
    Return 0
EndFunc
Edited by grham
Link to comment
Share on other sites

Forget that!

Just tell me how to run a file when the user has specified the directory

Example

D:\Games\Counter-Strike

The program reads it and it is instructed to run hl.exe in D:\Games\Counter-Strike!

Thanks in advanced!

:)

View my blog :) 3dude's blog <= help with project :S

Link to comment
Share on other sites

Can I make the script searh for a file in the system!

Example

User presses Search the script finds hl.exe and remembers it end tipes it in something like an inputbox

so the user can press Run and hl.exe runs! ( the script remembers and the other time the user runs the script)

----

Sorry for my bad english but I am in a rush :P:)

thanks

Hello!

Try this:

Dim $foo, $StdOut

$foo = Run(@ComSpec & " /c dir c:\test\test.txt /b /s", "", @SW_HIDE, 6)

While 1
    $StdOut &= StdoutRead($foo)
    If @error Then ExitLoop
WEnd
    
If $StdOut Then MsgBox(0, "File found", $StdOut)
Edited by rasim
Link to comment
Share on other sites

#include <guiconstants.au3>
#include <Misc.au3>
;#NoTrayIcon

Opt("TrayMenuMode",1)
;tray
$settingsitem   = TrayCreateMenu("Options")
$displayitem    = TrayCreateItem("Play CS", $settingsitem)
$printeritem    = TrayCreateItem("Printer", $settingsitem)
TrayCreateItem("")
$aboutitem    = TrayCreateItem("About")
TrayCreateItem("")
$showitem     = TrayCreateItem("Show")
TrayCreateItem("")
$exititem      = TrayCreateItem("Exit")





$das = GUICreate("My GUI", 500, 500) ; will create a dialog box that when displayed is centered
GUISetState (@SW_SHOW)    ; will display an empty dialog box
$save = GUICtrlCreateButton("Save And Hide", 25, 470, 450, 20)


;The tab
$tab=GUICtrlCreateTab (10,10, 450,450)

;CT
$tab0=GUICtrlCreateTabitem ("CT")
$radio2 = GUICtrlCreateRadio ("M4A1 Normal Set", 20, 50)
$Label_1 = GuiCtrlCreateLabel("Contains M4A1, Ammo"&@CRLF&"Button: F10"&@CRLF&"Press 2 times for full ammo  Cost:3380", 130, 53, 290, 40, 0x1000)
$radio1 = GUICtrlCreateRadio ("Full M4A1 Set", 20, 106)
$Label_1 = GuiCtrlCreateLabel("Contains M4A1, Armor+Helm, Ammo, He, Deagle, 2xFlash"&@CRLF&"Button: F11"&@CRLF&"Cost:----", 130, 106, 290, 40, 0x1000)
$radio3 = GUICtrlCreateRadio ("Full Magnum Set", 20, 163)
$Label_1 = GuiCtrlCreateLabel("Contains Magnum Sniper,Deagle,Armor+Helm"&@CRLF&"Button: F9"&@CRLF&"Cost:----", 130, 170, 290, 40, 0x1000)

;T
$tab1=GUICtrlCreateTabitem ( "T")


$tab2=GUICtrlCreateTabitem ("Settings")
GUICtrlCreateGroup("Game Settings", 20,40, 425, 200)
$run = GUICtrlCreateButton("Run Game", 30, 60)

GUICtrlCreateTabitem ("")  ; end tabitem definition






TraySetState()


; Run the GUI until the dialog is closed
While 1
    $msg = GUIGetMsg()
    $msg1 = TrayGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $radio2 And BitAND(GUICtrlRead($radio2), $GUI_CHECKED) = $GUI_CHECKED
            hotkey()
        Case $msg = $save
            GUISetState(@SW_HIDE, $das)
        Case $msg = $radio1 And BitAND(GUICtrlRead($radio1), $GUI_CHECKED) = $GUI_CHECKED
            hotkey2()
        Case $msg = $radio3 And BitAND(GUICtrlRead($radio3), $GUI_CHECKED) = $GUI_CHECKED   
            hotkey3()
        Case $msg1 = 0
            ContinueLoop
        Case $msg1 = $aboutitem
            Msgbox(64,"About:ACS","ACS V1.0 Created By KH-Computers Team!"&@CRLF&"New version soon!"&@CRLF&"Visit http://www.autoitscript.com/forum/blog/3dude/index.php?")
        Case $msg1 = $showitem
            GUISetState(@SW_SHOW, $das)
        Case $msg = $run
            run1() 
        Case $msg = $exititem
            ExitLoop    
    EndSelect
Wend

Func hotkey()
    HotKeySet("{f10}", "_m4a1")
EndFunc

Func hotkey2()
    HotKeySet("{f11}", "_m4a1f")
EndFunc

Func hotkey3()
    HotKeySet("{F9}", "magnum")
EndFunc

Func _m4a1()
    Send("b")
    Send("4")
    Send("3")
    Send("{SPACE}")
    Send("{SPACE}")
    Send("{SPACE}")
    Send("{SPACE}")
    Send("{SPACE}")
    Send("{SPACE}") 
    Send(",")
    Send(".")
    Send(",")
    Send(".")
    MouseClick("right")
    MouseClick("right")
    MouseClick("right")
    MouseClick("right")
    MouseClick("right")
    MouseClick("right") 
    MouseClick("right") 
    MouseClick("right") 
    MouseClick("right")
    MouseClick("right")
    MouseClick("right")
    MouseClick("right") 
    MouseClick("right") 
    MouseClick("right") 
    MouseClick("right") 
    MouseClick("right") 
    MouseClick("right") 
    MouseClick("right") 
    MouseClick("right") 
    MouseClick("right") 
    MouseClick("right") 
    MouseClick("right")     
EndFunc 


Func _m4a1f()
    Send("b")
    Send("b")   
    Send("4")
    Send("b")   
    Send("3")
    Send("b")   
    Send("{SPACE}")
    Send("{SPACE}")
    Send("{SPACE}")
    Send("{SPACE}")
    Send("{SPACE}")
    Send("{SPACE}") 
    Send("b")
    Send("1")
    Send("4")
    Send(",")
    Send(".")
    Send(",")
    Send(".")
    Send(",")
    Send(".")
    Send(",")
    Send(".")
    Send("o2")
    Send("e")
    Send("o")
    Send("e")
    Send("e")   
    Send("e")   
    Send("o3")
    Send("e")   
    Send("o")
    Send("3")
    Send("e")
    Send("o")
    Send("3")
    Send("o")
    Send("4")
    Send("1")
    Send("1")
    
EndFunc 

Func magnum()
    Send("b")
    Sleep(100)
    Send("4")
    Sleep(100)
    Send("6")
    Sleep(100)
    Send("b")
    Sleep(100)
    Send("14")
    Send("b")
    Sleep(100)
    Send("6")
    Sleep(100)
    Send("b")
    Sleep(500)
    Send("7")
    Sleep(100)
    Send("o2")
    Sleep(100)
    Send("o4")
    Sleep(100)
    Send("b")
    Sleep(100)
    Send("6")
    
    
EndFunc 

Func run1()
    Dim $foo, $StdOut

    $foo = Run(@ComSpec & " /c dir c:\test\test.txt /b /s", "", @SW_HIDE, 6)

    While 1
        $StdOut &= StdoutRead($foo)
        If @error Then ExitLoop
    WEnd
   
    If $StdOut Then MsgBox(0, "File found", $StdOut) 
EndFunc

View my blog :) 3dude's blog <= help with project :S

Link to comment
Share on other sites

You can use the ingame script to buy stuff, and use the radio command.

You can see, what button indicates what command if you type into console(default key is ~) "bind key" (eg: "bind b" will say bind "b" "buy"), so you can put these commands into a line, seperate with semicolon, and you done.

Heres buyscript (Append this into "D:\Games\Counter-Strike\cstrike\autoexec.cfg"):

bind "F9" "buy; menuselect 4; menuselect 6; buy; menuselect 6; buy; menuselect 7; buyequip; menuselect 2; buyequip; menuselect 4"
bind "F10" "buy; menuselect 4; menuselect 3; buy; menuselect 6; buy; menuselect 7"
bind "F11" "buy; menuselect 4; menuselect 3; buy; menuselect 6; buy; menuselect 7; buyequip; menuselect 2; buyequip; menuselect 3; buyequip; menuselect 3; buyequip; menuselect 4"

Note: My example is for Counter-Strike v1.5, if you have 1.6 "Steam" Counter-Strike, then you can use awp; m4a1; primammo; vesthelm commands, and rename the "autoexec.cfg" to "userconfig.cfg".

I'll show what I use, its simple, but very useful (I use 1.6 Steam version):

bind "'" "defuser; hegren; flash; buyammo2; buyammo2"
bind "k" "m4a1; ak47; vesthelm; primammo; defuser; hegren; flash; flash; sgren"
bind "l" "primammo; defuser; hegren; flash; flash; sgren"
bind "KP_INS" "say_team !!! BOMB LOCATED !!!; report"

Describe:

"'" - CT 1st round

"k" - CT/T full stuff

"l" - CT/T refill stuff (ammo, defuser, grenades)

"KP_INS" - Types a text in Team Say, and sends "I'm in position!" radio command.

Edited by Izebize
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...