Sign in to follow this  
Followers 0
Guest dabronko

Replace part of a selected number

19 posts in this topic

i write on an script in Autoit and i need Help for one step!

In one Application (AVAYA IP AGEND) i only mark the number and copy it to the clipboard to use it in an another application but sometimes the number has an country code shows as +49 or +43. I must replace it with "0". And sometimes the number started with (003), here must the clamps and one "0" be deleted

Did you have an Idee for me?

Thanks and regards

Maik

Share this post


Link to post
Share on other sites



See StringReplace() in the Help file.


- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

dabronko,

Welcome to the AutoIt forum. :)

This sounds like a job for StringRegExpReplace Except that it is not. ;)

This should do what you want But does not:

$sNumber = "+491234567"
$sNewNumber = Renumber($sNumber)
ConsoleWrite($sNumber & " - " & $sNewNumber & @CRLF)

$sNumber = "+49 123 4567"
$sNewNumber = Renumber($sNumber)
ConsoleWrite($sNumber & " - " & $sNewNumber & @CRLF)

$sNumber = "(003)1234567"
$sNewNumber = Renumber($sNumber)
ConsoleWrite($sNumber & " - " & $sNewNumber & @CRLF)

$sNumber = "(003) 123 4567"
$sNewNumber = Renumber($sNumber)
ConsoleWrite($sNumber & " - " & $sNewNumber & @CRLF)


Func Renumber($sNumber)

    Return StringRegExpReplace(StringStripWS($sNumber, 8), "A(+dd|(ddd))(.*)", "0$2")

EndFunc

The SRE works like this:

First we use StringStripWS to remove all spaces

A                  - Start at the beginning
(+dd|(ddd)) - Look for either +## or (###) - we need all the  to escape certain characters
(.*)                - And also capture the rest of the string

0$2                 - and return 0 followed by the rest of the string that we captured above

All clear? ;)

M23

Edit: I just reread your requirements - the above does not do what you want, sorry. :)

But this does: ;)

$sNumber = "+491234567"
$sNewNumber = Renumber($sNumber)
ConsoleWrite($sNumber & " - " & $sNewNumber & @CRLF)

$sNumber = "+49 123 4567"
$sNewNumber = Renumber($sNumber)
ConsoleWrite($sNumber & " - " & $sNewNumber & @CRLF)

$sNumber = "(003)1234567"
$sNewNumber = Renumber($sNumber)
ConsoleWrite($sNumber & " - " & $sNewNumber & @CRLF)

$sNumber = "(003) 123 4567"
$sNewNumber = Renumber($sNumber)
ConsoleWrite($sNumber & " - " & $sNewNumber & @CRLF)


Func Renumber($sNumber)

    $sNumber = StringStripWS($sNumber, 8)

    If StringLeft($sNumber, 1) = "+" Then
        Return "0" & StringTrimLeft($sNumber, 3)
    ElseIf StringLeft($sNumber, 1) = "(" Then
        Return StringTrimLeft(StringReplace($sNumber, ")", ""), 2)
    EndIf

EndFunc

Better? :D

Edited by Melba23

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Hi Melba 23,

i will test it and gave you feedback

Maik

Share this post


Link to post
Share on other sites

dabronko,

You need the second script I just added - please read the edited post above! :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Hi Melba,

i test the code in following scipt:

_WinWaitActivate("Contact History","")
Send("!e")
Send("u")
$sNumber = Send("{CTRLDOWN}c{CTRLUP}")
Func Re$sNumber = "+491234567"
$sNewNumber = Renumber($sNumber)
ConsoleWrite($sNumber & " - " & $sNewNumber & @CRLF)
$sNumber = "+49 123 4567"
$sNewNumber = Renumber($sNumber)
ConsoleWrite($sNumber & " - " & $sNewNumber & @CRLF)
$sNumber = "(003)1234567"
$sNewNumber = Renumber($sNumber)
ConsoleWrite($sNumber & " - " & $sNewNumber & @CRLF)
$sNumber = "(003) 123 4567"
$sNewNumber = Renumber($sNumber)
ConsoleWrite($sNumber & " - " & $sNewNumber & @CRLF)

Func Renumber($sNumber)
    $sNumber = StringStripWS($sNumber, 8)
    If StringLeft($sNumber, 1) = "+" Then
        Return "0" & StringTrimLeft($sNumber, 3)
    ElseIf StringLeft($sNumber, 1) = "(" Then
        Return StringTrimLeft(StringReplace($sNumber, ")", ""), 2)
    EndIf

The number is on my clipboard, what i have to do or to change if the script run?

In the moment nothing happend.

with

_WinWaitActivate("Contact History","")
Send("!e")
Send("u")
$sNumber = Send("{CTRLDOWN}c{CTRLUP}")

i get the number von AVAYA to Clipboard

thanks

Maik

Share this post


Link to post
Share on other sites

exaplenumber:

comes as: +49 (069) 9002760

i need as: 0699002760

Share this post


Link to post
Share on other sites

2nd. example:

comes as: 004940307067353

i need as: 040307067353

thanks

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

test post

Edited by dabronko1

Share this post


Link to post
Share on other sites

dabronko1,

I assume you are the same person as dabronko who started this thread. Would you care to explain why you have 2 accounts? :)

From the Forum Rules:- "Do not create multiple accounts"

Waiting for an explanation.... ;)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

Hi Melba,

sorry but @ Home i used my Facebook account to Login and @Work i cannot Login with facebook, so i create a new account.

I will see that i delete one of them.

regards

maik

Share this post


Link to post
Share on other sites

dabronko(1),

You cannot delete them - just let me know which one you want to use and I will remove the other. :)

And I will look at developing a new function for you. But next time please give concrete examples in the first post - you only partly explained the problem so you only got a partial solution. Giving "start" and "end" values is always useful in cases where you want to amend to strings. ;)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

dabronko(1),

This does what you say you need based on the 2 examples you gave above:

$sNumber = "+49 (069) 9002760"
$sNewNumber = StringRegExpReplace(StringRegExpReplace(StringStripWS($sNumber, 8), "(0(dd))", "$1"), "A(+dd|00dd)", 0)
MsgBox(0, "Changed", $sNumber & @CRLF & $sNewNumber)

$sNumber = "004940307067353"
$sNewNumber = StringRegExpReplace(StringRegExpReplace(StringStripWS($sNumber, 8), "(0(dd))", "$1"), "A(+dd|00dd)", 0)
MsgBox(0, "Changed", $sNumber & @CRLF & $sNewNumber)

- 1. We strip all spaces

- 2. We look for a (0##) and replace it with just ##

- 3. We look for either +## or 00## at the beginning of the number and replace it with 0

I hope that is what you want. :)

M23

P.S. And do let me know which is the unwanted account - I do not want to have to block both of them. ;)


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

HI Melba,

thanks for you time and idears, the script works but only in ONE time! I use this in a while and in an secund test it use the first number?

My 2nd problem is that my script is slow and not all Hotkey works at the fist time, in many cases they work after 3 attempts? Do you have an idear?

here is my complete Script without your formular, i will work on this tonight.

#region ---Au3Recorder generated code Start ---
#include <Misc.au3>
if _Singleton("CASE LOGGER",1) = 0 Then            ; eine Instanz erlauben
Msgbox(0,"Warning","CASE LOGGER is already running")
_WinWaitActivate("CASE LOGGER 1.1.02.04","")
Exit
EndIf
HotKeySet("^1", "opera")                  ;Hotkeys
HotKeySet("^2", "interface")
HotKeySet("^3", "fideliov6")
HotKeySet("^4", "systems")
HotKeySet("^5", "pos")
HotKeySet("^6", "mfpos")
HotKeySet("^8", "suite")
HotKeySet("^9", "clear")
#include <ButtonConstants.au3>               ;GUI
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=C:Documents and SettingsMSchwarzDesktopCASE LOGGER1.1.02.04logger 1.3.kxf
$prev = GUICreate("CASE LOGGER 1.1.02.04", 511, 450, 211, 139)
GUISetFont(13, 400, 0, "Calibri")
GUISetBkColor(0xFFFFFF)
$MenuItem1 = GUICtrlCreateMenu("&Menü")               ;Menü
$MenuItem10 = GUICtrlCreateMenuItem("Save Notes", $MenuItem1)
$MenuItem2 = GUICtrlCreateMenuItem("Close Window", $MenuItem1)
;$MenuItem3 = GUICtrlCreateMenu("&Features")
;$MenuItem4 = GUICtrlCreateMenuItem("own template", $MenuItem3)
;$MenuItem8= GUICtrlCreateMenuItem("hide notes", $MenuItem3)
;$MenuItem9 = GUICtrlCreateMenuItem("show notes", $MenuItem3)
$MenuItem5 = GUICtrlCreateMenu("&?")
$MenuItem6 = GUICtrlCreateMenuItem("Version History", $MenuItem5)
$MenuItem7 = GUICtrlCreateMenuItem("Help", $MenuItem5)
$OK = GUICtrlCreateButton("OK", 161, 128, 107, 41, $WS_GROUP)        ; Button OK
GUICtrlSetFont(-1, 12, 800, 0, "Calibri")
$CLOSE = GUICtrlCreateButton("CLOSE", 161, 176, 107, 25, $WS_GROUP)     ; Button Close
GUICtrlSetFont(-1, 12, 800, 0, "Calibri")
$Label1 = GUICtrlCreateLabel("click the desired product and number in your contact history" & @CRLF & "and then OK to open a case", 8, 90, 484, 35)  ; Text
GUICtrlSetFont(-1, 11, 800, 0, "Calibri")
$Pic1 = GUICtrlCreatePic("Q:supportoperamschwarzCase LoggerDATAmicros a.jpg", -1, 49, 347, 13, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
$Pic2 = GUICtrlCreatePic("Q:supportoperamschwarzCase LoggerDATAclarify.gif", 160, 55, 68, 44, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
$Pic4 = GUICtrlCreatePic("Q:supportoperamschwarzCase LoggerDATApfeil.gif", 112, 55, 44, 44, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
$Pic3 = GUICtrlCreatePic("Q:supportoperamschwarzCase LoggerDATAimages.jpg", 8, 63, 100, 28, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
$Pic5 = GUICtrlCreatePic("Q:supportoperamschwarzCase LoggerDATAMF-Logo BMP.bmp", 116, 400, 124, 18, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
$Pic6 = GUICtrlCreatePic("Q:supportoperamschwarzCase LoggerDATAcopyright.jpg", 245, 406, 15, 15, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
$Label2 = GUICtrlCreateLabel("MSchwarz@MICROS.COM", 261, 406, 133, 18)                   ;mailto and footer
GUICtrlSetFont(-1, 9, 800, 0, "Calibri")
$Pic7 = GUICtrlCreatePic("Q:supportoperamschwarzCase LoggerDATAlogger+logo+long.gif", 8, 8, 308, 36, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
$Pic8 = GUICtrlCreatePic("Q:supportoperamschwarzCase LoggerDATAmicros b.jpg", 352, 0, 156, 68, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
$opera = GUICtrlCreateRadio("OPERA", 8, 128, 73, 17)                         ;radiobuttons
$suite = GUICtrlCreateRadio("Suite8", 8, 144, 65, 17)
$fo6 = GUICtrlCreateRadio("FO", 80, 144, 57, 17)
$pos = GUICtrlCreateRadio("POS", 80, 176, 57, 17)
$sys = GUICtrlCreateRadio("SYS", 8, 160, 49, 17)
$ifc = GUICtrlCreateRadio("IFC", 80, 160, 49, 17)
$mfpos = GUICtrlCreateRadio("MFPOS", 8, 176, 73, 17)
$Clear = GUICtrlCreateRadio("Clear", 80, 128, 73, 17)
GUICtrlSetState($Clear, $GUI_CHECKED)                            ;sagt das Clear beim start ausgewählt ist
$Label3 = GUICtrlCreateLabel("Hotkeys:",  392, 56, 64, 25)                      ;Checkboxen
GUICtrlSetFont(-1, 13, 800, 4, "Calibri")
$Label20 = GUICtrlCreateLabel("Strg + 1 = Opera", 392, 80, 76, 17)
GUICtrlSetFont(-1, 8, 400, 0, "Calibri")
$Label21 = GUICtrlCreateLabel("Strg + 2 = Interface", 392, 96, 86, 17)
GUICtrlSetFont(-1, 8, 400, 0, "Calibri")
$Label22 = GUICtrlCreateLabel("Strg + 3 = Fidelio V6", 392, 112, 92, 17)
GUICtrlSetFont(-1, 8, 400, 0, "Calibri")
$Label23 = GUICtrlCreateLabel("Strg + 4 = Systems", 392, 128, 84, 17)
GUICtrlSetFont(-1, 8, 400, 0, "Calibri")
$Label24 = GUICtrlCreateLabel("Strg + 5 = POS", 392, 144, 86, 17)
GUICtrlSetFont(-1, 8, 400, 0, "Calibri")
$Label25 = GUICtrlCreateLabel("Strg + 6 = MFPOS", 392, 160, 86, 17)
GUICtrlSetFont(-1, 8, 400, 0, "Calibri")
$Label26 = GUICtrlCreateLabel("Strg + 8 = Suite 8", 392, 176, 78, 17)
GUICtrlSetFont(-1, 8, 400, 0, "Calibri")
$Label27 = GUICtrlCreateLabel("Strg + 9 = Clear", 392, 192, 92, 17)
GUICtrlSetFont(-1, 8, 400, 0, "Calibri")
$always = GUICtrlCreateCheckbox("display always", 288, 152, 97, 17)
GUICtrlSetFont(-1, 8, 400, 0, "Calibri")
GUICtrlSetState($always, $GUI_CHECKED)                           ;sagt das always beim start ausgewählt ist
$temp = GUICtrlCreateCheckbox("display once", 288, 168, 97, 17)
GUICtrlSetFont(-1, 8, 400, 0, "Calibri")
;$history = GUICtrlCreateCheckbox("show Contacts", 288, 136, 97, 17)
;GUICtrlSetFont(-1, 8, 400, 0, "Calibri")
$ssd = GUICtrlCreateCheckbox("SSD as Title", 288, 120, 81, 17)
GUICtrlSetFont(-1, 8, 400, 0, "Calibri")
$usenotes = GUICtrlCreateCheckbox("use notes text", 288, 184, 97, 17)
GUICtrlSetFont(-1, 8, 400, 0, "Calibri")
;$prev = GUICtrlCreateCheckbox("prev. Cases", 288, 136, 97, 17)
;GUICtrlSetFont(-1, 8, 400, 0, "Calibri")
$notes = GUICtrlCreateEdit("", 8, 208, 497, 193)                          ; notesbox
GUICtrlSetFont(-1, 10, 400, 0, "Calibri")
GUICtrlSetColor(-1, 0x000000)
GUICtrlSetBkColor(-1, 0xD4D0C8)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Label1
EndSwitch
If GUIGetMsg() = $Label2 Then ShellExecute("mailto:Mschwarz@MICROS.COM?subject=Informationen/Anregungen/Wünsche%20zum%20Case%20Logger")     ; erstellt eine neue E-Mail an MSchwarz@MICROS.COM
If $nMsg = $MenuItem2 Then       ;Menüstrucktur, Beenden
$saving = MsgBox( 1, "CASE LOGGER" , "would't you save the LOGGER NOTES?")
If $saving = 1 Then
  _WinWaitActivate("CASE LOGGER 1.1.02.04","")
  Send("{ALTDOWN}ms{ALTUP}")
  ElseIf $saving = 2
  WinClose("CASE LOGGER 1.1.02.04")
EndIf
EndIf
If $nMsg = $MenuItem6 Then       ;Menüstrucktur, Versionshistory
ShellExecute("Q:supportoperamschwarzCase Logger1.1.02.04about.htm")
EndIf
If $nMsg = $MenuItem7 Then       ;Menüstrucktur, Help
ShellExecute("Q:supportoperamschwarzCase Logger1.1.02.04Hilfe zum CASE LOGGER.htm")
EndIf
If $nMsg = $MenuItem10 Then      ;Menüstrucktur, save notes
ClipPut(GuiCtrlread($notes))
Run("notepad")
_WinWaitActivate("Untitled","")
Send("{CTRLDOWN}v{CTRLUP}")
Send("!fa")
Send("LOGGER NOTES - ")
Send(@mday)
Send(".")
Send(@mon)
Send(".")
Send(@year)
Send("-")
Send(@hour)
Send(".")
Send(@min)
Send(".")
Send(@sec)
EndIf
If $nMsg = $CLOSE Then
WinClose("CASE LOGGER 1.1.02.04")

ElseIf $nMsg=$OK Then                                    ; Hier startet der ablauf wenn Ok gedrückt wurde

If  GUICtrlRead ($temp) = 1 Then
WinClose("CASE LOGGER 1.1.02.04")
EndIf
_WinWaitActivate("Contact History","")
Send("!e")
Send("u")
Send("{CTRLDOWN}c{CTRLUP}")
_WinWaitActivate("ClarifyCRM","")
Send("{CTRLDOWN}n{CTRLUP}")
Sleep(1000)
Send("{TAB}{TAB}EU")
Send("{TAB}{TAB}{CTRLDOWN}v{CTRLUP}{BACKSPACE}{BACKSPACE}{BACKSPACE}{BACKSPACE}{TAB 4}")
Send("{TAB}S{TAB}PP{TAB}N{TAB}4{TAB}")
Send("Phone        : {CTRLDOWN}v{CTRLUP}{ENTER}")
Send("Contact        : {ENTER}")
Send("Problem        : ")
If GUICtrlRead($usenotes) = 1 Then
  ClipPut(GuiCtrlread($notes))
  Send("{CTRLDOWN}v{CTRLUP}")
  EndIf
Send("+{TAB 5}")
  If GUICtrlRead($ssd) = 1 Then
   Send("SSD ")
   EndIf
If GUICtrlRead($opera) = 1 Then
  Send("OPERA/V")
  $BusGroup = ControlCommand("ClarifyCRM","","ComboBox9","FindString", 'PMS')
  ControlCommand("ClarifyCRM","","ComboBox9","SetCurrentSelection", $BusGroup)
  $ProdLine = ControlCommand("ClarifyCRM","","ComboBox10","FindString", 'Opera-PMS')
  ControlCommand("ClarifyCRM","","ComboBox10","SetCurrentSelection", $ProdLine)
  ControlClick("ClarifyCRM","","[CLASS:Button; INSTANCE:4]","")
   ElseIf GUICtrlRead($suite) = 1 Then
    Send("V8 ")
    $BusGroup = ControlCommand("ClarifyCRM","","ComboBox9","FindString", 'PMS')
    ControlCommand("ClarifyCRM","","ComboBox9","SetCurrentSelection", $BusGroup)
    $ProdLine = ControlCommand("ClarifyCRM","","ComboBox10","FindString", 'Suite 8 - PMS')
    ControlCommand("ClarifyCRM","","ComboBox10","SetCurrentSelection", $ProdLine)
    ControlClick("ClarifyCRM","","[CLASS:Button; INSTANCE:4]","")
     ElseIf GUICtrlRead($fo6) = 1 Then
      Send("FO ")
      $BusGroup = ControlCommand("ClarifyCRM","","ComboBox9","FindString", 'PMS')
      ControlCommand("ClarifyCRM","","ComboBox9","SetCurrentSelection", $BusGroup)
      $ProdLine = ControlCommand("ClarifyCRM","","ComboBox10","FindString", 'Fidelio V6')
      ControlCommand("ClarifyCRM","","ComboBox10","SetCurrentSelection", $ProdLine)
      ControlClick("ClarifyCRM","","[CLASS:Button; INSTANCE:4]","")
         ElseIf GUICtrlRead($sys) = 1 Then
          Send("SYS ")
          $BusGroup = ControlCommand("ClarifyCRM","","ComboBox9","FindString", 'ProfessionalServices')
          ControlCommand("ClarifyCRM","","ComboBox9","SetCurrentSelection", $BusGroup)
          $ProdLine = ControlCommand("ClarifyCRM","","ComboBox10","FindString", 'Systems')
          ControlCommand("ClarifyCRM","","ComboBox10","SetCurrentSelection", $ProdLine)
          ControlClick("ClarifyCRM","","[CLASS:Button; INSTANCE:4]","")
           ElseIf GUICtrlRead($ifc) = 1 Then
            Send("IFC ")
            $BusGroup = ControlCommand("ClarifyCRM","","ComboBox9","FindString", 'Interface')
            ControlCommand("ClarifyCRM","","ComboBox9","SetCurrentSelection", $BusGroup)
            ControlClick("ClarifyCRM","","[CLASS:Button; INSTANCE:4]","")
             ElseIf GUICtrlRead($mfpos) = 1 Then
              Send("MFPOS")
              $BusGroup = ControlCommand("ClarifyCRM","","ComboBox9","FindString", 'POS')
              ControlCommand("ClarifyCRM","","ComboBox9","SetCurrentSelection", $BusGroup)
              $ProdLine = ControlCommand("ClarifyCRM","","ComboBox10","FindString", 'MFPOS')
              ControlCommand("ClarifyCRM","","ComboBox10","SetCurrentSelection", $ProdLine)
              ControlClick("ClarifyCRM","","[CLASS:Button; INSTANCE:4]","")
               ElseIf GUICtrlRead($pos) = 1 Then
               Send("")
               $BusGroup = ControlCommand("ClarifyCRM","","ComboBox9","FindString", 'POS')
               ControlCommand("ClarifyCRM","","ComboBox9","SetCurrentSelection", $BusGroup)
               ControlClick("ClarifyCRM","","[CLASS:Button; INSTANCE:4]","")
                ElseIf GUICtrlRead($Clear) = 1 Then
                ControlClick("ClarifyCRM","","[CLASS:Button; INSTANCE:4]","")
                EndIf
ElseIf $nMsg = $CLOSE Then
WinClose("CASE LOGGER 1.1.02.04")
Func opera()                                   ; die functions steuern die HotKeys
GUICtrlSetState($opera, $GUI_CHECKED)
ControlClick("CASE LOGGER 1.1.02.04","","[CLASS:Button; INSTANCE:1]","")
EndFunc
Func interface()
GUICtrlSetState($ifc, $GUI_CHECKED)
ControlClick("CASE LOGGER 1.1.02.04","","[CLASS:Button; INSTANCE:1]","")
EndFunc
Func fideliov6()
GUICtrlSetState($fo6, $GUI_CHECKED)
ControlClick("CASE LOGGER 1.1.02.04","","[CLASS:Button; INSTANCE:1]","")
EndFunc
Func systems()
GUICtrlSetState($sys, $GUI_CHECKED)
ControlClick("CASE LOGGER 1.1.02.04","","[CLASS:Button; INSTANCE:1]","")
EndFunc
Func pos()
GUICtrlSetState($pos, $GUI_CHECKED)
ControlClick("CASE LOGGER 1.1.02.04","","[CLASS:Button; INSTANCE:1]","")
EndFunc
Func mfpos()
GUICtrlSetState($mfpos, $GUI_CHECKED)
ControlClick("CASE LOGGER 1.1.02.04","","[CLASS:Button; INSTANCE:1]","")
EndFunc
Func suite()
GUICtrlSetState($suite, $GUI_CHECKED)
ControlClick("CASE LOGGER 1.1.02.04","","[CLASS:Button; INSTANCE:1]","")
EndFunc
Func clear()
GUICtrlSetState($Clear, $GUI_CHECKED)
ControlClick("CASE LOGGER 1.1.02.04","","[CLASS:Button; INSTANCE:1]","")
EndFunc
EndIf
WEnd
#region --- Internal functions Au3Recorder Start ---
Func _WinWaitActivate($title,$text,$timeout=0)
WinWait($title,$text,$timeout)
If Not WinActive($title,$text) Then WinActivate($title,$text)
WinWaitActive($title,$text,$timeout)
EndFunc
#endregion --- Internal functions Au3Recorder End ---
#endregion --- Au3Recorder generated code End ---

Many thanks to you

Bye, Dabronko

p.s.

The Login dabronko can delete, its created by Facebook, thanks

p.p.s.

i have edit the lines for the number and it works WONDERFUL... so great!!!

_WinWaitActivate("Contact History","")
Send("!e")
Send("u")
Send("{CTRLDOWN}c{CTRLUP}")
Sleep(500)
$sNumber = ClipGet()
$sNewNumber = StringRegExpReplace(StringRegExpReplace(StringStripWS($sNumber, 8), "(0(dd))", "$1"), "A(+dd|00dd)", 0)
_WinWaitActivate("ClarifyCRM","")
Send("{CTRLDOWN}n{CTRLUP}")
Sleep(1000)
Send("{TAB}{TAB}EU")
Send("{TAB}{TAB}")
Send($sNewNumber)
Send("{BACKSPACE}{BACKSPACE}{BACKSPACE}{BACKSPACE}{TAB 4}")
Send("{TAB}S{TAB}PP{TAB}N{TAB}4{TAB}")
Send("Phone        : ")
Send($sNewNumber)
Send("{ENTER}")
Send("Contact        : {ENTER}")
Send("Problem        : ")
Edited by dabronko1

Share this post


Link to post
Share on other sites

#15 ·  Posted (edited)

I'm afraid it won't work in the general case.

You see, international phone prefix (country codes) are a bit of a mess.

While it's correct to transform 001# into 01# and 007# into 07#, the North America group {Canada + USA} and the group {Federation of Russia and Kazakstan} being the only regions with a single "significant" digit "country" code, you're not done anyway in the general case.

The real issue is with the actual international format, + <country code with 0 prepended for North America> <national phone number without the leading zero when applicable>

Some of the examples that have been shown are in fact invalid:

comes as: 004940307067353

i need as: 040307067353

The number should be +4940307067353 [sometimes even +49(0)40307067353] or 0049040307067353

Now the problem is that you don't know where to insert a leading zero to retain the national number, unless you use a table of international prefixes.

To see why, let's take a couple of (made up) examples:

+33558777179 (France)

+3518715684233 (Portugal)

The first has a country code of 33, hence the national number is 0558777179

The latter use a 3-digit country code (351), thus giving 08715684233

The length of the national number is much, much harder to figure out and this is constantly changing in the real world, so you definitely can't rely on a fixed (or even computed) length. You just have to work left to right: lookup in a table the possible country prefix code (1, 2 or 3 digits), skip the adequate number of digits and add a zero there (but only if one hasn't been placed there in error!).

That isn't something that can be done in a single (nor in more) regexp, nor using simple-minded string manipulations. You _need_ a table of all possible country prefixes.

If you need to process _general_ phone numbers I can provide you with such a table (yet incomplete for rare regions) but it comes without any formal guaranty!

BTW I also took "some" pain to build a table or regexp for validating the format of international zip codes.

Edited by jchd

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Share this post


Link to post
Share on other sites

Hi jchd,

i understand what you mean, but in my case the formular from melba works fine and served its purpose.

I will solve the Problem with another national numbers in an other Topic, its a very intresting idea. I will follow these.

Did you have an proposal for me why my buttons and Hotkeys not in all cases work?

I Press OK or CLOSE and nothing happend, i press it again and it works, same issue with Hotkeys!

Thank you

Bronko

Share this post


Link to post
Share on other sites

About phone numbers:

I happen to have bitten this bullet some time ago and found that it wasn't as trivial as one would say. That's why I warned you in case you had to process random intl phone numbers.

About GUIs, hotkeys and other points:

Sorry I'm being distracted elsewhere currently and it's 02:30 my time...

Be a bit patient and I'm sure someone else will help you there.


This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Share this post


Link to post
Share on other sites

#18 ·  Posted (edited)

my time too... :) thank you for your Help.

Edited by dabronko1

Share this post


Link to post
Share on other sites

dabronko1,

The Login dabronko can delete, its created by Facebook, thanks

The "dabronko" account has now been deleted. :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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