Jump to content

APPEND STRING


Recommended Posts

Hi Guys,

I am having problems with: $textfile = ($acct&".txt") in the sample script below.

It is returning $acct on one line an the ".txt" on a separate line.

I am attempting to create a txt file name such as v180.txt to use in SEND command.

Thanks for your help.

#include <GUIConstants.au3>

; Declare variable for the file path to be entered into Meditech

$filepath = "C:\Documents and Settings\My Documents" ; Must Change

$ext=".txt"

; Location of the file for input

$writetofile = "c:\cpd.txt"

$read = FileOpen($writetofile, 2)

; Check if file opened for writing OK

If $read = -1 Then

MsgBox(0, "Error", "Unable to open file.")

Exit

EndIf

; Create and send to screen the Window for input

GUICreate("ECHOCARDIOGRAPHY", 320, 120, @DesktopWidth / 2 - 160, @DesktopHeight / 2 - 45, -1, 0x00000018); WS_EX_ACCEPTFILES

GUICtrlCreateLabel("V NUMBER ", 10, 10)

$Input_1 = GUICtrlCreateInput("", 100, 10, 150, 20, $ES_UPPERCASE)

GUICtrlSetState(-1, $GUI_FOCUS)

GUICtrlCreateLabel("PROVIDER ", 10, 40)

$Input_2 = GUICtrlCreateInput("", 100, 40, 150, 20, $ES_UPPERCASE)

$ok = GUICtrlCreateButton("OK", 90, 90, 70, 20)

$cancel = GUICtrlCreateButton("CANCEL", 190, 90, 70, 20)

GUISetState()

; Read the screen input and write to file.

While 1

$msg = GUIGetMsg()

Select

Case $msg = $GUI_Event_Close

Exit

Case $msg = $cancel

Exit

Case $msg = $ok

$contents1 = (GUICtrlRead($Input_1))

$contents2 = (GUICtrlRead($Input_2))

FileWriteLine($writetofile, $contents1)

FileWriteLine($writetofile, $contents2)

FileClose($writetofile)

ExitLoop

;;;

EndSelect

WEnd

GUIDelete(); ; will return 1

; open file for reading

$readfile = "c:\cpd.txt"

$output = FileOpen($readfile, 0)

; Check if file opened for writing OK

If $output = -1 Then

MsgBox(0, "Error", "Unable to open file.")

Exit

EndIf

; file that include the subroutine to read to array

#include <file.au3>

;Read in lines of text into array until the EOF is reached

Dim $aRecords

If Not _FileReadToArray("c:\cpd.txt", $aRecords) Then

MsgBox(4096, "Error", " Error reading log to Array error:" & @error)

Exit

EndIf

For $x = 1 To $aRecords[0]

$acct = $aRecords[1]

$provider = $aRecords[2]

Next

; Close file

FileClose($readfile)

$textfile = ($acct&".txt")

MsgBox(0, "Error", $textfile)

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