Manivel

Reg: Regular Expression handling in AutoIT

10 posts in this topic

#1 ·  Posted

Hi, We are trying to automate the SAP applications. For automating that we are using sap.au3 wrapper file. Facing some issues with the dynamic control values

example: Please consider the highlighted values.

("usr/subSUB0:SAPLMEGUI:0015/subSUB3:SAPLMEVIEWS:1100/subSUB2:SAPLMEVIEWS:1200/subSUB1:SAPLMEGUI:1301/subSUB2:SAPLMEGUI:1303/tabsITEM_DETAIL/tabpTABIDT3")

("usr/subSUB0:SAPLMEGUI:0019/subSUB3:SAPLMEVIEWS:1100/subSUB2:SAPLMEVIEWS:1200/subSUB1:SAPLMEGUI:1301/subSUB2:SAPLMEGUI:1303/tabsITEM_DETAIL/tabpTABIDT13")

While in execution we are getting either 15 or 19 and some times 13 also. How to handle this in autoit. What i though was through autoit regular expression we can ? but didn't get the proper guidelines and time to implement. If you have any idea how to handle this issue, please let me know.

Thanks

Manivel P

Share this post


Link to post
Share on other sites



#2 ·  Posted

You want to extract the value ?

Local $sString = '("usr/subSUB0:SAPLMEGUI:0015/subSUB3:SAPLMEVIEWS:1100/subSUB2:SAPLMEVIEWS:1200/subSUB1:SAPLMEGUI:1301/subSUB2:SAPLMEGUI:1303/tabsITEM_DETAIL/tabpTABIDT3")'
Local $aval = StringRegExp($sString, "SAPLMEGUI:00(\d+)", 1)
MsgBox(0, "", $aval[0])

 

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Actually its SAP Control property value. property values changed based on the selections. That value is belong to one of the menu option.

for example - in outlook we have home, Send/Receive, Folder, View extra right. Same thing.

if the particular menu selected by default - then the property id is usr/subSUB0:SAPLMEGUI:0015............................

if some other tab is selected or expanded, then we need to select the expected menu means  - the property id is usr/subSUB0:SAPLMEGUI:0019...

Not sure about the default selection. Its based on the users. so we need to handle this id's in regular expression.

Thank you

Edited by Manivel

Share this post


Link to post
Share on other sites

#4 ·  Posted

you don't need regular expressions provided the data is always in the same model

$sString = '("usr/subSUB0:SAPLMEGUI:0015/subSUB3:SAPLMEVIEWS:1100/subSUB2:SAPLMEVIEWS:1200/subSUB1:SAPLMEGUI:1301/subSUB2:SAPLMEGUI:1303/tabsITEM_DETAIL/tabpTABIDT3")'
msgbox(0, '' , number(stringsplit(stringsplit($sString , "/" ,2)[1] , ":" , 2)[2]))

 


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

Share this post


Link to post
Share on other sites

#5 ·  Posted

:)

$sString = '("usr/subSUB0:SAPLMEGUI:0015/subSUB3:SAPLMEVIEWS:1100/subSUB2:SAPLMEVIEWS:1200/subSUB1:SAPLMEGUI:1301/subSUB2:SAPLMEGUI:1303/tabsITEM_DETAIL/tabpTABIDT3")'
msgbox(0, '' , number(StringMid($sString, StringInStr($sString, "SAPLMEGUI")+10, 4)) )

 

1 person likes this

Share this post


Link to post
Share on other sites

#6 ·  Posted

nice, I like bringing you to the darkside

1 person likes this

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

Share this post


Link to post
Share on other sites

#7 ·  Posted

Yes. but don't go wrong. Still with me the Rx force is   sly.gif

Share this post


Link to post
Share on other sites

#8 ·  Posted

9 hours ago, iamtheky said:

you don't need regular expressions provided the data is always in the same model

$sString = '("usr/subSUB0:SAPLMEGUI:0015/subSUB3:SAPLMEVIEWS:1100/subSUB2:SAPLMEVIEWS:1200/subSUB1:SAPLMEGUI:1301/subSUB2:SAPLMEGUI:1303/tabsITEM_DETAIL/tabpTABIDT3")'
msgbox(0, '' , number(stringsplit(stringsplit($sString , "/" ,2)[1] , ":" , 2)[2]))

 

my concern is the values what you are showing in msg box is dynamic value. it may be 15 or 13 or 19  or any value. Its a control [button]. I need to click that button. The property value might be 15 or any value. Through sub string we can get the value. How to replace that value. Because the expected value is dynamic. thats why i thought of asking about regular expression.

Share this post


Link to post
Share on other sites

#9 ·  Posted

It totally doesn't matter what the value is, all the solutions provided would facilitate identifying the target. 

And replacing it is trivial with any of the solutions, but hopefully this is the part where everyone encourages you to try and work through the provided answers and post code when you have issues, rather than us just handing you functional code.


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

Share this post


Link to post
Share on other sites

#10 ·  Posted

Thanks for update. Will try to handle this.

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