Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

EDITBOX question, please help

Status
Not open for further replies.

ewsdguy

Technical User
Mar 1, 2004
5
US
I am a newbee to aspect programing, the problem I am having is with an EDITBOX. I need to send commands to a Siemens EWSD switch, via cut and paste from another program. The problem is sometimes the combined commands will be more then 256 chars that get pasted into the EDITBOX. I figured out how to get all the information to display in the EDITBOX using this command:

editbox 1 8 22 449 134 mml 1000 MULTILINE

but when I read the information from the EDITBOX in the string "mml" I am missing all chars after 256. Can someone help me out here how can I get the rest of the information.
 
Is the information that is being copied and pasted getting modified in any way? Is the string in the editbox just what was pasted, or is there additional information the user or script is adding? ASPECT can only handle strings up to 256 characters in length no matter where the data comes from, but maybe you can modify the dialog so it has info in a couple different edit fields and your script can transmit (I assume) the contents of each field separately. If the pasted string is all that is being sent, you could use the cliptostr command to get that information from the Windows Clipboard, store it in a string in your script (still subject to the 256-character limit), and then transmit it.


aspect@aspectscripting.com
 
The information is not being changed at all, just copied then pasted. I was thinking about what you said, having different edit fields, but wouldn't that required more then one editbox and more then one cut and paste? If you know away I could do it, with a single cut and paste that is what I am looking for.
 
Yes, you would need multiple edit fields. Are you copying and pasting multiple strings into one long string? If so, then the multiple edit fields is the only way around the problem you are experiencing due to the 256-character limit in ASPECT strings.


aspect@aspectscripting.com
 
Hey Knob,
What I am doing is copying commands that another program generates, so it would look something like this:

COMMAND ONE

COMMAND TWO

COMMAND THREE

COMMAND FOUR

COMMAND FIVE

I want to copy and paste them all in one shot, I trying to elimate the need to do multiple copied and pastes. The problem is sometimes not all the time, all the commands together will equal more then 256 chars. I was thinking about this last night, want to get your opinion on maybe another way of doing it. Since when I do the copy the information is now in the windows clipboard. Is thier way that the clipboard could be copied to file, then have program, read the commands from the file and send them to the switch? Since I am a newbee to aspect, I am not sure if that could be done and if it can, how to do it. Any help would be greatly apprecated.
 
After you've copied the data to the clipboard, you can use the cliptofile command to save the contents of the clipboard to a text file. You can then use the fopen command to open that file and fgets to read line by line the contents of that file. If you look at the ASPECT help file discussion of the fopen command, it shows how to do some error-checking while opening the file so everything goes smoothly.


aspect@aspectscripting.com
 
Thanks knob that worked great, I have one more thing that I have looked and can't find out how to do and then the program is done. I am sure this is a simple thing, I just can't find it, after I read the text from the file, I display it in a ftext box, on a simple form, so the user can verfied it's correct, the form only has the ftext box, a cancel button and a Ok button, what I need to do, is once the form comes up and the user verifies that it's correct, I want them just to be able to hit the enter key to send this information to the switch. Here's my script, if you could show me out to do that, that will finish the script, I have looked everywere and can't find it.

string mml
integer len
integer event

PROC MAIN
mml=$nullstr


cliptofile text "c:\temp\cmd.txt"


dialogbox 0 100 120 466 182 2 "Switch Order Program - Ver 1.0"
ftext 1 8 22 449 134 "c:\temp\cmd.txt"
pushbutton 2 387 162 60 13 "&Send to Switch" DEFAULT
pushbutton 3 341 162 40 13 "Cancel"
text 4 8 9 268 11 "Verify Commands That Will Be Sent To The Switch:" left
enddialog


while 1

dlgevent 0 event
switch event

case 0
endcase

case 1
endcase

case 2
DLGDESTROY 0 CANCEL

if fopen 0 "c:\temp\cmd.txt" READ TEXT ; Open file for read only.
tryagain:
while not feof 0 ; Loop while not end of file.
fgets 0 mml ; Get line from file.
strlen mml len

if len == 0
goto tryagain
endif

transmit "^m"
waitfor "<" FOREVER
transmit mml
transmit "^m"
waitfor "END JOB"


endwhile
fclose 0 ; Close file opened for read.
endif



case 3
exit
endcase


endswitch
endwhile
exit
endproc
 
Hey Knob, I figured it out and the script is working perfectly, I just wanted to thank you for all your help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top