Jump to content

replace


Recommended Posts

hello all

actually i am having a .txt file (attached), now i want to replace all PUBLISHERNAME, REPUBLISHERNAME and DATABASENAME without opening the file. can anyone suggest how can i do it???

i am having an Input form which demands values to change at PUBLISHERNAME, REPUBLISHERNAME and DATABASENAME.

right now i am opening this .txt file with wordpad and entering them using "REPLACE" which is a very long procedure.

thanx in advance.

#Include <GuiListView.au3>
#Include <GuiEdit.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

Func RePublisherInputForm()

Local $msg1, $Btn_OK, $Label1, $Label2, $Label3, $Label4, $Label5, $Label6, $Label7, $Input1, $Input2, $Input3, $Input4, $Input5, $Input6, $Input7, $MainLabel
Local $InputWindowHandle

global $RePublisherDataBaseName, $RePublisherIP,  $RePublisherPublisherName, $RePublisherUserName,  $RePublisherUserName

Opt("GUIOnEventMode",0)

    $InputWindowHandle = GUICreate("Details for Re-Publisher", 250, 253, -1, -1, $WS_EX_DLGMODALFRAME)  ; will create a dialog box that when displayed is centered
    GUISetIcon("ARTEVEAI.ICO",-20)
    $MainLabel = GUICtrlCreateLabel("Please provide following details", 10, 20)
    $Label1 = GUICtrlCreateLabel("Database Name", 10, 50)
    $Label2 = GUICtrlCreateLabel("IP Address", 10, 80)
    $Label3 = GUICtrlCreateLabel("Host Name", 10, 110)
    $Label4 = GUICtrlCreateLabel("Re-Publisher Name", 10, 140)
    $Label5 = GUICtrlCreateLabel("Windows User", 10, 170)
;   $Label6 = GUICtrlCreateLabel("Password", 10, 200)
;   $Label7 = guictrlcreatelabel("RePublisher Name", 10, 230)

    $Input1 = GUICtrlCreateInput("", 150, 43, 80)                                   ;for DB Name
    $Input2 = GUICtrlCreateInput("", 150, 73, 80, 0, $ES_NUMBER)                    ;for Ip address
    $Input3 = GUICtrlCreateInput("", 150, 103, 80)
    $Input4 = GUICtrlCreateInput("", 150, 133, 80)
    $Input5 = guictrlcreateinput("", 150, 163, 80)                                  ;for Username
;   $Input6 = guictrlcreateinput("", 150, 193, 80)                                  ;for password
;   $Input7 = guictrlcreateinput("", 150, 223, 80)
    $Btn_OK = GUICtrlCreateButton("OK", 90, 193, 80)                                ;OK button
    GuiCtrlSetState($Btn_OK, $GUI_Disable)

Local $Enabled = False
GUISetState()

While 1

$msg1 = GUIGetMsg()

     If GuiCtrlRead($Input1) And GuiCtrlRead($Input3) And GuiCtrlRead($Input4) And GuiCtrlRead($Input5) <> "" And $Enabled = False Then
        GuiCtrlSetState($Btn_OK, $GUI_ENABLE)
        $Enabled = True
    EndIf

    Select

        Case $msg1 = $Btn_OK
             $RePublisherDataBaseName = GUICtrlRead($Input1)
             $RePublisherIP = GUICtrlRead($Input2)
             $RePublisherPublisherName = GUICtrlRead($Input3)
             $RePublisherName = guictrlread($Input4)
             $RePublisherUserName = GUICtrlRead($Input5)
             ;$RePublisherPassword = GUICtrlRead($Input6)
            ; $RePublisherName = GUICtrlRead($Input7)
            GUIDELETE()
            ;$RetValue = True
             ExitLoop

        Case $msg1 = $GUI_EVENT_CLOSE
            ExitLoop
    EndSelect

WEnd

GUIDelete($InputWindowHandle)
WinWaitClose("Details for RePublisher")
Opt("GUIOnEventMode",1)

;Return $RetValue

EndFunc
Edited by randeep

[font="Palatino Linotype"]Randeep Singh[/font][sub][/sub]

Link to comment
Share on other sites

Hi m8,

I really didnt get what you need.

You need to replace those values in the txt file or in the script?

Cheers

Old Scriptology

Visual Ping 1.8 - Mass Ping Program with export to txt delimited.

Desktop 2 RGB and YMCK - Pick a color in the desktop and get the RGB and YMCK code.

Desktop 2 RGB - Pick a color in the desktop and get the RGB code.

ShootIT 1.0 - Screen Capture full and partial screen

[font="'Arial Black';"]Remember Remember The Fifth of November.[/font]

Link to comment
Share on other sites

@November

i need to make changes in 'Create_Republisher.txt' file only, script is only to provide input......

thanx

Hi m8,

I really didnt get what you need.

You need to replace those values in the txt file or in the script?

Cheers

Edited by randeep

[font="Palatino Linotype"]Randeep Singh[/font][sub][/sub]

Link to comment
Share on other sites

Try and see

_ReplaceStringInFile

I don´t know if you want to make a little application to replace all what you desire... but i think it will help.

Cheers

Old Scriptology

Visual Ping 1.8 - Mass Ping Program with export to txt delimited.

Desktop 2 RGB and YMCK - Pick a color in the desktop and get the RGB and YMCK code.

Desktop 2 RGB - Pick a color in the desktop and get the RGB code.

ShootIT 1.0 - Screen Capture full and partial screen

[font="'Arial Black';"]Remember Remember The Fifth of November.[/font]

Link to comment
Share on other sites

@november

thanx for help. let me try.

Try and see

_ReplaceStringInFile

I don´t know if you want to make a little application to replace all what you desire... but i think it will help.

Cheers

[font="Palatino Linotype"]Randeep Singh[/font][sub][/sub]

Link to comment
Share on other sites

@November

it works man. thanks for help

Try and see

_ReplaceStringInFile

I don´t know if you want to make a little application to replace all what you desire... but i think it will help.

Cheers

[font="Palatino Linotype"]Randeep Singh[/font][sub][/sub]

Link to comment
Share on other sites

No problem m8 :D

Any time!

Old Scriptology

Visual Ping 1.8 - Mass Ping Program with export to txt delimited.

Desktop 2 RGB and YMCK - Pick a color in the desktop and get the RGB and YMCK code.

Desktop 2 RGB - Pick a color in the desktop and get the RGB code.

ShootIT 1.0 - Screen Capture full and partial screen

[font="'Arial Black';"]Remember Remember The Fifth of November.[/font]

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