Sign in to follow this  
Followers 0
Michael36

If and elseif

9 posts in this topic

Hi all

i need a bit of help on the IF in my script

;---click button-----------------------------------------------

If $msg = $Button_12 then

;-----send data from input to edit--------------------------------------------

GUICtrlSetData($Edit_10, GUICtrlRead($Edit_10) & GUICtrlRead($Input_11) & @CRLF )

i'm stuck here i need to read $Input_11 it's a input if it Contains "/" i then need to use the StringTrimleft to

rid the / before it hits the TCPSend then elseif the input dose not Contain "/" i just need it to

TCPSend($socket,"PRIVMSG:"&GUICtrlRead($Input_11)&@LF)

button $Button_12 is a send button

any ideas on this ?

i was thinking of using the Select /EndSelect on this but i just don't know

thank you

michael

If GUICtrlRead($Input_11) = "/" Then
$re = StringTrimleft($Input_11, 1)
TCPSend( $socket, $re)


elseif  GUICtrlRead($Input_11) = "" Then
TCPSend($socket,"PRIVMSG:"&GUICtrlRead($Input_11)&@LF)
endif
endif

Share this post


Link to post
Share on other sites



i think i fig out my prob it's

$re = StringTrimleft ,&GUICtrlRead($Input_11) , 1)

i left the GUICtrlRead out can GUICtrlRead($Input_11) be placed in a StringTrimleft ?

Share this post


Link to post
Share on other sites

try:

If StringRight(GUICtrlRead($Input_11),1) = "/" Then
i don't understand this

If StringRight(GUICtrlRead($Input_11),1) = "/" Then

i'm trying to trim the / of the word for Example /hi i need to trim the / so it's just hi

my bit of code

if  GUICtrlRead($Input_11) = "/" Then
$result = StringTrimLeft($Input_11), 3) 

MsgBox(4096, "Test",$result , 0)

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

i don't understand this

If StringRight(GUICtrlRead($Input_11),1) = "/" Then

i'm trying to trim the / of the word for Example /hi i need to trim the / so it's just hi

my bit of code

if  GUICtrlRead($Input_11) = "/" Then
$result = StringTrimLeft($Input_11), 3) 

MsgBox(4096, "Test",$result , 0)
Thought you wanted to check for trailing "/"

To trim a leading slash you can:

$result = GUICtrlRead($Input_11)
If StringLeft($result ,1) = "/" Then
    $result = StringTrimLeft($result ,1) 
EndIf
Edited by JdeB

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

i don't understand this

If StringRight(GUICtrlRead($Input_11),1) = "/" Then

i'm trying to trim the / of the word for Example /hi i need to trim the / so it's just hi

my bit of code

if  GUICtrlRead($Input_11) = "/" Then
$result = StringTrimLeft($Input_11), 3) 

MsgBox(4096, "Test",$result , 0)
Try

if  StringRight(GUICtrlRead($Input_11),1) = "/" Then
$result = StringTrimLeft($Input_11), 3) 

MsgBox(4096, "Test",$result , 0)

What it does is read the first letter of the input and checks to see it is "/". If it is it will then strip it off.

Edit-

Beaten again, must learn to type faster. :"> :">

Edited by BigDod


Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Share this post


Link to post
Share on other sites

Try

if  StringRight(GUICtrlRead($Input_11),1) = "/" Then
$result = StringTrimLeft($Input_11), 3) 

MsgBox(4096, "Test",$result , 0)

What it does is read the first letter of the input and checks to see it is "/". If it is it will then strip it off.

Edit-

Beaten again, must learn to type faster. :"> :">

thank you guys fo the help would be lost without it

your examples are working but for some reson it will not send tcp

but if i use a msgbox as a test it will work the / will be gone so i just have to fig out why it will not send tcp .

If $msg = $Button_12 Then 
$result = GUICtrlRead($Input_11)
If StringLeft($result ,1) = "/" Then
    $result = StringTrimLeft($result ,1) 
EndIf
TCPSend($socket,$result)

Share this post


Link to post
Share on other sites

Did you define $socket as a TCPConnect socketID somewhere in your script?

Like:

$socket = TCPConnect("192.168.1.1",23)

Here's the helpfile:

TCPSend ( socket, data ) 

Parameters
-socket: The main socket identifier (SocketID) as returned by a TCPConnect function. 
-data: binary/string to be send to the connected socket

Share this post


Link to post
Share on other sites

yes i define $socket i will just keep at it i will get it lol

never give up B)

thank you

Share this post


Link to post
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
Sign in to follow this  
Followers 0