youtuber

To take between hyphens?

7 posts in this topic

#1 ·  Posted

Hi everyone, I have specified the my question in the in gui codes :closedeyes:

Thank you

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

$Form1 = GUICreate("Form1", 741, 318)

$Input1 = GUICtrlCreateInput("DE536F150981EE9-843246755A584A645957686A5A58526C634756415A3231686157777559323973-6304D0584A4C0CB072A2E120A4ADBCB6", 74, 48, 649, 21)
$Input2 = GUICtrlCreateInput("",74, 88, 649, 21)
$Input3 = GUICtrlCreateInput("",74, 128, 649, 21)

$Button1 = GUICtrlCreateButton("Button1", 288, 264, 75, 25)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
$aReadinput1 = GUICtrlRead($Input1)
;I want to delete 15 characters here : --> DE536F150981EE9-
;GUICtrlSetData($Input2,"843246755A584A645957686A5A58526C634756415A3231686157777559323973")
;GUICtrlSetData($Input3,"6304D0584A4C0CB072A2E120A4ADBCB6")
    EndSwitch
WEnd

 

Share this post


Link to post
Share on other sites



#2 ·  Posted

Please check the help file for StringSplit or StringInStr combined with StringMid.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#3 ·  Posted

I looked at the help file but could not :(

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

$Form1 = GUICreate("Form1", 741, 318)

$Input1 = GUICtrlCreateInput("DE536F150981EE9-843246755A584A645957686A5A58526C634756415A3231686157777559323973-6304D0584A4C0CB072A2E120A4ADBCB6", 74, 48, 649, 21)
$Input2 = GUICtrlCreateInput("",74, 88, 649, 21)
$Input3 = GUICtrlCreateInput("",74, 128, 649, 21)

$Button1 = GUICtrlCreateButton("Button1", 288, 264, 75, 25)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
$aReadinput1 = GUICtrlRead($Input1)
$aSplit = StringSplit($aReadinput1, "-")
    For $i = 1 To $aSplit[0]
        $aTrimRight = StringTrimRight($aSplit,32)
        $aStr = StringInStr ($aSplit[$i], "-" )
    Next
    $sString = StringMid($aStr,15)
    GUICtrlSetData($Input2,$sString)
    GUICtrlSetData($Input3,$aTrimRight)
    EndSwitch
WEnd

 

Share this post


Link to post
Share on other sites

#4 ·  Posted

You obviously didn't look that hard, then, as there are a half-dozen ways documented in the help file to accomplish this. Try this and see what you get:

#include <Array.au3>

Local $sString = "DE536F150981EE9-843246755A584A645957686A5A58526C634756415A3231686157777559323973-6304D0584A4C0CB072A2E120A4ADBCB6"
Local $aSplit = StringSplit($sString, "-")
    _ArrayDisplay($aSplit)

;=======OR=======

MsgBox(0, "StringMid Example", StringMid($sString, 16)) ;skip 15 chars

;=======OR=======

MsgBox(0, "StringTrimLeft Example", StringTrimLeft($sString, 15))

;=======OR=======

MsgBox(0, "StringRight Example", StringRight($sString, (StringLen($sString) - 15)))

 

1 person likes this

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Try (untested):

GUICtrlSetData($Input2, $aSplit[2])
GUICtrlSetData($Input3, $aSplit[3])

And delete the for-next-loop.

Conrad

Edited by Simpel
Spelling
1 person likes this

SciTE = 3.6.2.0/full   AutoIt = 3.3.14.2   AutoItX64 = 0   OS = Win7Pro SP1   OSArch = X64   Language = 0407/german
H:\...\AutoIt3\SciTE   H:\...\AutoIt3   H:\...\AutoIt3\Include   H: = Network Drive

   88x31.png  Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind.

Share this post


Link to post
Share on other sites

#6 ·  Posted

using just stringinstr and stringmid

$str = "DE536F150981EE9-843246755A584A645957686A5A58526C634756415A3231686157777559323973-6304D0584A4C0CB072A2E120A4ADBCB6"

consolewrite(stringmid($str , stringinstr($str , "-" , 0 , 1) + 1 , (stringinstr($str , "-" , 0 , 2) - stringinstr($str , "-" , 0 , 1) - 1))  & @CR & stringmid($str , stringinstr($str , "-" , 0 , -1) + 1) & @CR)

 

1 person likes this

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

$Form1 = GUICreate("Form1", 741, 318)
$sString = "DE536F150981EE9-843246755A584A645957686A5A58526C634756415A3231686157777559323973-6304D0584A4C0CB072A2E120A4ADBCB6"
$Input1 = GUICtrlCreateInput($sString, 74, 48, 649, 21)
$Input2 = GUICtrlCreateInput("",74, 88, 649, 21)
$Input3 = GUICtrlCreateInput("",74, 128, 649, 21)

$Button1 = GUICtrlCreateButton("Button1", 288, 264, 75, 25)
GUISetState(@SW_SHOW)
$aResult = StringRegExp($sString, "([[:xdigit:]]+)-([[:xdigit:]]+)-([[:xdigit:]]+)", 3)
GUICtrlSetData($Input2, $aResult[1])
GUICtrlSetData($Input3, $aResult[2])

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
$aReadinput1 = GUICtrlRead($Input1)
;I want to delete 15 characters here : --> DE536F150981EE9-
;GUICtrlSetData($Input2,"843246755A584A645957686A5A58526C634756415A3231686157777559323973")
;GUICtrlSetData($Input3,"6304D0584A4C0CB072A2E120A4ADBCB6")
    EndSwitch
WEnd

Or

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

$Form1 = GUICreate("Form1", 741, 318)
$sString = "DE536F150981EE9-843246755A584A645957686A5A58526C634756415A3231686157777559323973-6304D0584A4C0CB072A2E120A4ADBCB6"
$Input1 = GUICtrlCreateInput($sString, 74, 48, 649, 21)
$Input2 = GUICtrlCreateInput("",74, 88, 649, 21)
$Input3 = GUICtrlCreateInput("",74, 128, 649, 21)

$Button1 = GUICtrlCreateButton("Button1", 288, 264, 75, 25)
GUISetState(@SW_SHOW)

$iPosL = StringInStr($sString, "-")
$iPosR = StringInStr($sString, "-", 0, -1)

GUICtrlSetData($Input2, StringMid($sString, $iPosL + 1, $iPosR - $iPosL - 1))
GUICtrlSetData($Input3, StringMid($sString, $iPosR + 1, StringLen($sString) - $iPosR))

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
$aReadinput1 = GUICtrlRead($Input1)
;I want to delete 15 characters here : --> DE536F150981EE9-
;GUICtrlSetData($Input2,"843246755A584A645957686A5A58526C634756415A3231686157777559323973")
;GUICtrlSetData($Input3,"6304D0584A4C0CB072A2E120A4ADBCB6")
    EndSwitch
WEnd

 

Edited by UEZ
1 person likes this

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

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