Jump to content

Finding File Path and Saving it in Variable


Recommended Posts

Just now, dascondor said:

I'm trying to get a file path button in my GUI. And keep the path path in a variable. Currently I'm using "FileSelectFolder" It gets me the folder but not the file any thoughts?

 

 

findcopyreplace.au3

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <File.au3>

#Region ### START Koda GUI section ### Form=
$IPpong = GUICreate("IP Pinger", 572, 253, -1, -1)
$data1 = GUICtrlCreateInput("1", 184, 104, 81, 37)
GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x000000)
$data2 = GUICtrlCreateInput("23", 280, 104, 73, 37)
GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x000000)
$gobutton = GUICtrlCreateButton("GO", 80, 192, 75, 25)
GUICtrlSetBkColor(-1, 0x00FF00)
$Selectfolder = GUICtrlCreateButton("Select Folder", 240, 192, 75, 25)
GUICtrlSetBkColor(-1, 0xFFFF00)
$Label1 = GUICtrlCreateLabel("What Store?", 200, 40, 145, 33)
GUICtrlSetFont(-1, 18, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0x000000)
$exitbutton = GUICtrlCreateButton("exitbutton", 400, 192, 75, 25)
GUICtrlSetBkColor(-1, 0xFF0000)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

Global $replace2 = "Second"

Global $replace3 = "Thrid"

Global $userdata1 = GUICtrlRead($data1)

Global $userdata2 = GUICtrlRead($data2)

Global $Spath = FileSelectFolder( "Select a folder" , "")

Global $IP = "IP_List.txt"

Global $sMessage = "Select a folder"

;Local $sFileSelectFolder = FileSelectFolder($sMessage, "")





While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

         Case $gobutton
         $userdata1 = GUICtrlRead($data1)
         $userdata2 = GUICtrlRead($data2)
         $Spath
         replace()



         Case $exitbutton
         exit


    EndSwitch
WEnd



Func replace()
   $Spath
   _ReplaceStringInFile( $Spath , $replace2 ,$userdata1 )
   _ReplaceStringInFile( $Spath , $replace3, $userdata2 )
;~    exit
    MsgBox(0,"Waiting","hold")
   ;_ReplaceStringInFile( $Spath , $userdata1,$replace2 )
   ;_ReplaceStringInFile( $Spath , $userdata2,$replace3 )
Exit


EndFunc

 

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...