Jump to content
RaiNote

Just A Problem don't know how to name it^^

Recommended Posts

RaiNote

Well Hello,

I currently a bit sad because i can't find anywhere in helpfiles and google away in autoit to check if a number between another number is the same as 4 variables which is checking if the main variable got the same princip of looking >.<.( I really can't explain it at all)

Case $Send2Box
            $ReadText2Box = GuictrlRead($Text2Box)
            _GUICtrlEdit_AppendText($Console, $ReadText2Box & @CRLF)
            If $ReadText2Box = '/ping ' & $ip1 & '.' & $ip2 & '.' & $ip3 & '.' & $ip4 Then
                $IP = StringRight('/ping ', 1)
                $Ping = Ping($IP)
                _GUICtrlEdit_AppendText($Console,'Ping is: ' & $Ping & 'ms')
                GUICtrlSetData($Text2Box,'')
            EndIf

Next try to explain ^-^ i want to check if the text in the inputbox($Text2Box which is read from $ReadText2Box) the same looking like a ip but with a '/ping ' before and i don't know how to make the variables to check this.. and getting after it checked that it is truly a IP to ping it and send it to $Console to display the ms

I hope i could explained it anyway to understand it(if i write more i am getting more confused)

Thanks to everyone who try's to help me :D


  • C++/AutoIt/OpenGL Easy Coder
  • I will be Kind to you and try to help you
  • till what you want isn't against the Forum
  • Rules~

 

Share this post


Link to post
Share on other sites
Jfish

This looks like you are pinging the letter g which is what StringRight('/ping',1) will return.

$IP = StringRight('/ping ', 1)
                $Ping = Ping($IP)

I think you want to to ping:

$ip1 & '.' & $ip2 & '.' & $ip3 & '.' & $ip4

From what I can tell maybe the issue is that you are reading an IP address from the textbox that starts with "/ping".  If you want to remove that you could just trim it off from $ReadTextBox2.  StringTrimLeft is how you could chop off those characters. $IP=StringTrimLeft($ReadTextBox2,5).  That is all a guess based on what I think I read in your post.


Build your own poker game with AutoIt: pokerlogic.au3 | Learn To Program Using FREE Tools with AutoIt

Share this post


Link to post
Share on other sites
SadBunny

The StringRight call as you have it there just returns the rightmost character of "/ping ", which is a space.

Change

$IP = StringRight('/ping ', 1)

to

$IP = StringTrimLeft($ReadText2Box, 6)

It will trim 6 characters from the $RestText2Box, exactly the length of string "/ping ", and return the result, which should be your IP address.


Roses are FF0000, violets are 0000FF... All my base are belong to you.

Share this post


Link to post
Share on other sites
RaiNote

But i want also to test if $IP which is after '/ping ' looks like an IP xxx.xxx.xxx.xxx which i tried with $ip1 $ip2.. but it won't work out

 


  • C++/AutoIt/OpenGL Easy Coder
  • I will be Kind to you and try to help you
  • till what you want isn't against the Forum
  • Rules~

 

Share this post


Link to post
Share on other sites
SadBunny

What's in your $ip1, $ip2...? Judging from your current code it looks like you are checking whether it is a specific IP-address, defined in your $ip1 etc.. If you mean you want to check if the thing after "/ping " ($IP) is a string in the format of "<0-255>.<0-255>.<0-255>.<0-255>", you can take multiple approaches. One is to write a function to split $IP into parts using "." as a delimiter, then checking whether you get 4 results, each being a number between 0 and 255. Like so:

ConsoleWrite(_isIpAddress("abc") & @CRLF)
ConsoleWrite(_isIpAddress("12.34.56.78.90") & @CRLF)
ConsoleWrite(_isIpAddress("999.999.999.999") & @CRLF)
ConsoleWrite(_isIpAddress("127.0.0.1") & @CRLF)

Func _isIpAddress($IP)

    $splitResult = StringSplit($IP, ".")

    If $splitResult[0] <> 4 Then Return False
    For $supposedNumber In $splitResult
        If $supposedNumber < 0 Or $supposedNumber > 255 Then Return False
    Next
    Return True
EndFunc   ;==>_isIpAddress

 


Roses are FF0000, violets are 0000FF... All my base are belong to you.

Share this post


Link to post
Share on other sites
RaiNote

Thank you very much. *-*

but still i am bit stucked xD but that's just to check which command i wrote ^^

 

Edited by RaiNote

  • C++/AutoIt/OpenGL Easy Coder
  • I will be Kind to you and try to help you
  • till what you want isn't against the Forum
  • Rules~

 

Share this post


Link to post
Share on other sites
RaiNote

Hello,

I got a problem with my Code. Only GUI code works out but when i use with all my Functions the Gui goes down to the endless >.<

Code:

;*****************************************
;CraTool.au3 by RaiNote
;Erstellt mit ISN AutoIt Studio v. 0.98 BETA
;*****************************************


;Includes
#include <GUIConstantsEx.au3>
#include <GuiEdit.au3>
#include <String.au3>
#include "Forms\CraTool.isf"
#include "Functions.au3" 
#include <Inet.au3>
#include <_UskinDLL.au3>
#include <_UskinLibrary.au3>
#include <Skins\Descent.au3>
;Includes

_Uskin_LoadDLL()
_USkin_Init(_Descent(True))

;Variablen


GUISetState(@SW_SHOW, $CraTool)

While 1
    
    $nMsg = GUIGetMsg()
    Switch $nMsg
        
        Case $GUI_EVENT_CLOSE
            Exit
            
        Case $Send2Box
            
            ;Some Main needs for Commands
            $ReadText2Box = GuictrlRead($Text2Box)
            $IP = StringTrimLeft($ReadText2Box, 6)
            $IsIP = _isIpAddress($IP)
            $IP2 = StringTrimLeft($ReadText2Box, 4)
            $IsDomain = _isIpAddress($IP)
            $CheckCom4Digits = StringLeft($ReadText2Box,5)
            $CheckCom2Digits = StringLeft($ReadText2Box,3)
            _GUICtrlEdit_AppendText($Console, $ReadText2Box & @CRLF)
            ;
            
            If $CheckCom4Digits = '/ping' Then
                
                If $IsIP = 1 Then
                $Ping = Ping($IP)
                _GUICtrlEdit_AppendText($Console,'Ping is: ' & $Ping & 'ms' & @CRLF)
                
                ElseIf $IsIP = 0 Then
                    $PingDom = Ping($IP)
                    
                    If $PingDom > 0 Then
                    _GUICtrlEdit_AppendText($Console,'Ping is: ' & $PingDom & 'ms' & @CRLF)
                    
                    Else
                    _GUICtrlEdit_AppendText($Console,$IP & " isn't a valid IP" & @CRLF)
                    EndIf
                    
                EndIf
                
            EndIf
            
            If $CheckCom2Digits = '/ip' Then
                
                If $IsDomain = 0 Then
                    $IpGet = TCPNameToIP($IP2)
                _GUICtrlEdit_AppendText($Console,'IP is: ' & $IpGet & @CRLF)
                    
                ElseIf $IsDomain = 1 Then
                    $DomainGet = _TCPIpToName($IP2)
                    _GUICtrlEdit_AppendText($Console,$IP2 & ' is already an IP' &  @CRLF)
                    _GUICtrlEdit_AppendText($Console,$DomainGet & @CRLF & '->Domain of ' & $IP2 & @CRLF)
                EndIf
                
            EndIf
            GUICtrlSetData($Text2Box,'')
        Case $LoupCom
            _GUICtrlEdit_AppendText($Console, 'IIIIIIIIIIIIIIIIIIIIIIIIIIIIII' & @CRLF & 'vvvvvvvvvvvvvvvvvvvvvvvvvvvvvv' & @CRLF & 'Command: Ping' & @CRLF & 'Usage-> /ping Ip or Domain' & @CRLF & 'Info-> It shows the time it takes to connect from your Computer to another.' & @CRLF)
            
    EndSwitch

WEnd

GUI:

#include-once

; -- Created with ISN Form Studio 2 for ISN AutoIt Studio -- ;
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Include <GuiButton.au3>
#include <EditConstants.au3>
#Include <GuiMenu.au3>

$CraTool = GUICreate("CraTool",618,386,-1,-1,-1,-1)
$MenuItem681 = GUICtrlCreateMenu("Plugins")
$PluginsEnableMenu = GUICtrlCreateMenuItem("Enable",$MenuItem681,-1,1)
$PluginsDisableMenu = GUICtrlCreateMenuItem("Disable",$MenuItem681,-1,1)
$Send2Box = GUICtrlCreateButton("Send",413,323,60,19,-1,-1)
$Console = GUICtrlCreateEdit("",413,0,198,303,2244,-1)
GUICtrlSetFont(-1,8,400,0,"Lucida Console")
GUICtrlSetColor(-1,"0x0000A0")
GUICtrlSetBkColor(-1,"0x00FF80")
$Text2Box = GUICtrlCreateInput("Text to Box",413,303,194,20,192,512)
$LoupCom = GUICtrlCreateButton("Lookup Commands",473,323,100,19,-1,-1)
GUISetState(@SW_SHOW,$CraTool)

Functions:

;Functions.au3

Func _isIpAddress($IP)

    $splitResult = StringSplit($IP, ".")

    If $splitResult[0] <> 4 Then Return False
    For $supposedNumber In $splitResult
        If $supposedNumber < 0 Or $supposedNumber > 255 Then Return False
    Next
    Return True
EndFunc   ;==>_isIpAddress

That's all i can provide as code but i really don't get where the problem is. Maybe it's my Laptop because before on my computer it worked fine everything. ^^

I hope someone could help me :3

Thanks to everyone ^-^

Edit: Wups wrong section just saw it right now sorry If someone could move would be nice^^

Edited by RaiNote
Wrong Section

  • C++/AutoIt/OpenGL Easy Coder
  • I will be Kind to you and try to help you
  • till what you want isn't against the Forum
  • Rules~

 

Share this post


Link to post
Share on other sites
RaiNote

The Problem could be the Skin but why? °^°

 


  • C++/AutoIt/OpenGL Easy Coder
  • I will be Kind to you and try to help you
  • till what you want isn't against the Forum
  • Rules~

 

Share this post


Link to post
Share on other sites
Jfish

Are you trying to look at a string and see if it is formatted as an IP address?  xxx.xxx.xxx.xxx?  If so, have a look at StringRegExp to test for a pattern.  If that is not what you are after maybe you could post in your native language as something may be getting lost in translation (or use Google translate to explain).

  • Like 1

Build your own poker game with AutoIt: pokerlogic.au3 | Learn To Program Using FREE Tools with AutoIt

Share this post


Link to post
Share on other sites
RaiNote

Just to test if it looks like xxx.xxx.xxx.xxx but currently everything works without Uskin ^^ it destroys anyway my GUI Y-axis it ends somewhere in the nowhere^^

 


  • C++/AutoIt/OpenGL Easy Coder
  • I will be Kind to you and try to help you
  • till what you want isn't against the Forum
  • Rules~

 

Share this post


Link to post
Share on other sites
RaiNote

if the endborder goes beyound your taskbar where you can't see it also if u try to pull it to the top

 


  • C++/AutoIt/OpenGL Easy Coder
  • I will be Kind to you and try to help you
  • till what you want isn't against the Forum
  • Rules~

 

Share this post


Link to post
Share on other sites
RaiNote

complete Code and i know wrong section but i saw it to late e.e


  • C++/AutoIt/OpenGL Easy Coder
  • I will be Kind to you and try to help you
  • till what you want isn't against the Forum
  • Rules~

 

Share this post


Link to post
Share on other sites
RaiNote

exactly the same

 


  • C++/AutoIt/OpenGL Easy Coder
  • I will be Kind to you and try to help you
  • till what you want isn't against the Forum
  • Rules~

 

Share this post


Link to post
Share on other sites
RaiNote

and it looks it's due the skin but i don't get why >.< on my other Programs it work and a hour before it worked also


  • C++/AutoIt/OpenGL Easy Coder
  • I will be Kind to you and try to help you
  • till what you want isn't against the Forum
  • Rules~

 

Share this post


Link to post
Share on other sites
Jos

@RaiNote, Threads are merged and hope you will stick to one single thread for the same question from here on.

Believe this is "strike two" today.

Jos


SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
Jfish

@RaiNote:  you are posting snippets of your code - that would very hard (at least for me - maybe others have a better opinion) to test and figure out the problem.  If you don't want to post the entire code can you create a simple "reproducer" script that shows the exact issue with working code?


Build your own poker game with AutoIt: pokerlogic.au3 | Learn To Program Using FREE Tools with AutoIt

Share this post


Link to post
Share on other sites
RaiNote

I know right now the Problem so i would like if someone could Lock/close this and the other thread^^

And Thanks to everyone.


  • C++/AutoIt/OpenGL Easy Coder
  • I will be Kind to you and try to help you
  • till what you want isn't against the Forum
  • Rules~

 

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

  • Similar Content

    • Miliardsto
      By Miliardsto
      I got that func
      Func makeHelpImgGUI($title,$width,$height,$img) $img = GUICtrlCreatePic("",20,40,$width,$height) _ResourceSetImageToCtrl($img, "HERE") EndFunc and I call this func like that
      makeHelpImgGUI("Image",1190, 800,$SETTINGS_JPG)  
      so what is the problem in the parameter where is - "HERE" I need value of img but passed as string
      so $img = $SETTINGS_JPG and how make it "SETTINGS_JPG"
       
      I tried something like that but not work
      Func makeHelpImgGUI($title,$width,$height,$img) $name_str = String($img) $name_str = StringTrimLeft ($name_str, 1 ) $img = GUICtrlCreatePic("",20,40,$width,$height) _ResourceSetImageToCtrl($img, $name_str) EndFunc  
    • liagason
      By liagason
      Hello everyone,
      How can I display in ascending  sequence some numbers stored in a string variable?
      $str = "18,03,48,23" MsgBox(0,"test",$str) I would like it to display "03,18,23,48"
    • Rskm
      By Rskm
      Hi, i have a variable (floating number - could be positive or negative), i wish to print it into a text file, how can i keep the format in such a way that it always has 4 digits ahead of decimal and 2 after decimal
      basically i have total 7 columns in the text file to print the variable  ;
      eg: variable = 1.235, output requied = 0001.24
      variable=-23.55555, output required =-023.56
    • Rskm
      By Rskm
      Hi, I have the following line in a text file 'input.txt'. I know the line number - say '6'. I wish to replace the text 'WWW' in the below line with a random number (I can generate that with random()).
      WERIS  WWWJP   3.83  8.330  1.000                1097.RAXX 
      The WWW is a 3 digit integer (could be any number between 0 to 999), I can use stringtrimleft and get the numerical value of WWW in this file
      so, basically, I know the string to replace (ie; WWW stored in a variable), I know the line number to work on and the file location/name and the replacement variable (through random()). My requirement is to fill that 3 spaces with my random number (which Is a integer between 1 and 999)
      please put ur suggestions
       
    • nacerbaaziz
      By nacerbaaziz
      Hello Members of this best Forum
      i have a question please
      for example if i have a long string
      and i want to extract a text between two tag
      what i can do to make that?
      note :
      i know that there is a
      StringRegExp function
      it's do that work
      but it result is be as an array
      i want the result to be a string
      is there any function on autoit can do that?
      Thanks in advance.
×