Jump to content

Global context menu for change case


 Share

Go to solution Solved by Terenz,

Recommended Posts

#include <GUIConstantsEx.au3>
#include <GuiMenu.au3>
#include <Misc.au3>

Global Enum $e_idOpen = 1000, $e_idSave, $e_idInfo
Global $hMenu, $hGUI, $iContextMenuItem

While 1
    If _IsPressed("10") And _IsPressed("2") Then
        ContextMenu()
    EndIf
    Sleep(100)
WEnd

Func ContextMenu()
    $hGUI = GUICreate("", 0, 0)

    $hMenu = _GUICtrlMenu_CreatePopup()
    _GUICtrlMenu_InsertMenuItem($hMenu, 0, "Open", $e_idOpen)
    _GUICtrlMenu_InsertMenuItem($hMenu, 1, "Save", $e_idSave)
    _GUICtrlMenu_InsertMenuItem($hMenu, 3, "", 0)
    _GUICtrlMenu_InsertMenuItem($hMenu, 3, "Info", $e_idInfo)

    Local $iMouseX = MouseGetPos(0), $iMouseY = MouseGetPos(1)

    $iContextMenuItem = _GUICtrlMenu_TrackPopupMenu($hMenu, $hGUI, $iMouseX, $iMouseY, 0, 0, 2)
    MsgBox(0, "Selected Context Menu Item Selected", $iContextMenuItem)

    _GUICtrlMenu_DestroyMenu($hMenu)
EndFunc   ;==>ContextMenu

Hi,

For work i need a tool for change case of the selected text (Uppercase, lowercase etc) when i SHIFT + Left click with the mouse.

Two questions:

1) How to destroy the context menu if i click outside from the context menu?

2) How to get the selected text and change for example to UPPERCASE?

Thanks! ;)

Edited by Terenz

Nothing is so strong as gentleness. Nothing is so gentle as real strength

 

Link to comment
Share on other sites

#include <GUIConstantsEx.au3>
#include <GuiMenu.au3>
#include <Misc.au3>

Global Enum $e_idOpen = 1000, $e_idSave, $e_idInfo
Global $hMenu, $hGUI, $iContextMenuItem

While 1
    If _IsPressed("10") And _IsPressed("2") Then
        ContextMenu()
    EndIf
    Sleep(100)
WEnd

Func ContextMenu()
    $hGUI = GUICreate("", 0, 0)

    $hMenu = _GUICtrlMenu_CreatePopup()
    _GUICtrlMenu_InsertMenuItem($hMenu, 0, "Open", $e_idOpen)
    _GUICtrlMenu_InsertMenuItem($hMenu, 1, "Save", $e_idSave)
    _GUICtrlMenu_InsertMenuItem($hMenu, 3, "", 0)
    _GUICtrlMenu_InsertMenuItem($hMenu, 3, "Info", $e_idInfo)

    GUISetState(@SW_SHOW, $hGUI)
    
    Local $iMouseX = MouseGetPos(0), $iMouseY = MouseGetPos(1)
    $iContextMenuItem = _GUICtrlMenu_TrackPopupMenu($hMenu, $hGUI, $iMouseX, $iMouseY, 0, 0, 2)
    MsgBox(0, "Selected Context Menu Item Selected", StringUpper(_GUICtrlMenu_GetItemText($hMenu, $iContextMenuItem, False)))
    _GUICtrlMenu_DestroyMenu($hMenu)
    GUIDelete($hGUI)

EndFunc   ;==>ContextMenu

Current window must be the foreground window before the application calls TrackPopupMenu or TrackPopupMenuEx so you have to show the window even if width and height are 0 pixels.

When the words fail... music speaks.

Link to comment
Share on other sites

@Andreik i think you don't have understand. This is a complete example:

#include <GUIConstantsEx.au3>
#include <GuiMenu.au3>
#include <Misc.au3>

Global Enum $e_idOpen = 1000, $e_idSave, $e_idInfo, $e_idUppercase, $e_idLowercase, $e_idCapitalize, $e_idinvertCase, $e_idExit

Global $hMenu, $hGUI, $iContextMenuItem, $GetCursorInfo

While 1
    If _IsPressed("10") And _IsPressed("04") Then
        ContextMenu()
    EndIf
    Sleep(10)
WEnd

Func ContextMenu()
    $hGUI = GUICreate("", 0, 0)
    $hMenu = _GUICtrlMenu_CreatePopup()
    _GUICtrlMenu_InsertMenuItem($hMenu, 0, "UPPERCASE", $e_idUppercase)
    _GUICtrlMenu_InsertMenuItem($hMenu, 1, "lowercase", $e_idLowercase)
    _GUICtrlMenu_InsertMenuItem($hMenu, 2, "Capitalize Function", $e_idCapitalize)
    _GUICtrlMenu_InsertMenuItem($hMenu, 3, "iNVERT cASE", $e_idinvertCase)
    _GUICtrlMenu_InsertMenuItem($hMenu, 4, "", 0)
    _GUICtrlMenu_InsertMenuItem($hMenu, 5, "Undo", $e_idExit)

    Local $iMouseX = MouseGetPos(0), $iMouseY = MouseGetPos(1)
    $iContextMenuItem = _GUICtrlMenu_TrackPopupMenu($hMenu, $hGUI, $iMouseX, $iMouseY, 0, 0, 2)

    Switch $iContextMenuItem
        Case $e_idUppercase
            UppercaseFunction()
        Case $e_idLowercase
            LowerCaseFunction()
        Case $e_idCapitalize
            CapitalizeFunction()
        Case $e_idinvertCase
            InvertCaseFunction()
        Case $e_idExit
            ExitFunction()
    EndSwitch

    _GUICtrlMenu_DestroyMenu($hMenu)
    GUIDelete($hGUI)
EndFunc   ;==>ContextMenu

Func ExitFunction()
    _GUICtrlMenu_DestroyMenu($hMenu)
    GUIDelete($hGUI)
EndFunc   ;==>CloseMenu


Func UppercaseFunction()
    ClipPut("")
    Send("^c")
    Sleep(100)
    ClipPut(StringUpper(ClipGet()))
    Send("^v")
EndFunc   ;==>UppercaseFunction

Func LowerCaseFunction()
    ClipPut("")
    Send("^c")
    Sleep(100)
    ClipPut(StringLower(ClipGet()))
    Send("^v")
EndFunc   ;==>UppercaseFunction

Func CapitalizeFunction()
    ClipPut("")
    Send("^c")
    Sleep(100)
    ClipPut(CapitalizeWords(ClipGet()))
    Send("^v")
EndFunc   ;==>CapitalizeFunction

Func InvertCaseFunction()
    ClipPut("")
    Send("^c")
    Sleep(100)
    ClipPut(InvertCase(ClipGet()))
    Send("^v")
EndFunc   ;==>CapitalizeFunction

Func CapitalizeWords($sInput)
    Local $aWords = StringSplit($sInput, " ")
    Local $sResult = ""
    For $i = 1 To $aWords[0]
        $sResult &= StringUpper(StringLeft($aWords[$i], 1)) & StringLower(StringTrimLeft($aWords[$i], 1)) & " "
    Next
    Return StringTrimRight($sResult, 1)
EndFunc

Func InvertCase($sInput)
    Local $sResult = ""
    For $i = 1 To StringLen($sInput)
        Local $sChar = StringMid($sInput, $i, 1)
        If StringIsLower($sChar) Then
            $sResult &= StringUpper($sChar)
        ElseIf StringIsUpper($sChar) Then
            $sResult &= StringLower($sChar)
        Else
            $sResult &= $sChar
        EndIf
    Next
    Return $sResult
EndFunc

Still missing the possibility to destroy the context menu if i click outside from the context menu. The combination is SHIFT + Middle Mouse Click for the menu. The selected text will be converted to one of the possibility

Still open to improve

Nothing is so strong as gentleness. Nothing is so gentle as real strength

 

Link to comment
Share on other sites

It's you who don't understand that window must be visible before the application calls TrackPopupMenu or TrackPopupMenuEx.

#include <GUIConstantsEx.au3>
#include <GuiMenu.au3>
#include <Misc.au3>

Global Enum $e_idOpen = 1000, $e_idSave, $e_idInfo, $e_idUppercase, $e_idLowercase, $e_idCapitalize, $e_idinvertCase, $e_idExit

Global $hMenu, $hGUI, $iContextMenuItem, $GetCursorInfo

While 1
    If _IsPressed("10") And _IsPressed("04") Then
        ContextMenu()
    EndIf
    Sleep(10)
WEnd

Func ContextMenu()
    $hGUI = GUICreate("", 0, 0, -1, -1, 0x80000000)
    GUISetState(@SW_SHOW, $hGUI)    ; <<< ------ You need this

    $hMenu = _GUICtrlMenu_CreatePopup()
    _GUICtrlMenu_InsertMenuItem($hMenu, 0, "UPPERCASE", $e_idUppercase)
    _GUICtrlMenu_InsertMenuItem($hMenu, 1, "lowercase", $e_idLowercase)
    _GUICtrlMenu_InsertMenuItem($hMenu, 2, "Capitalize Function", $e_idCapitalize)
    _GUICtrlMenu_InsertMenuItem($hMenu, 3, "iNVERT cASE", $e_idinvertCase)
    _GUICtrlMenu_InsertMenuItem($hMenu, 4, "", 0)
    _GUICtrlMenu_InsertMenuItem($hMenu, 5, "Undo", $e_idExit)

    Local $iMouseX = MouseGetPos(0), $iMouseY = MouseGetPos(1)
    $iContextMenuItem = _GUICtrlMenu_TrackPopupMenu($hMenu, $hGUI, $iMouseX, $iMouseY, 0, 0, 2)

    Switch $iContextMenuItem
        Case $e_idUppercase
            UppercaseFunction()
        Case $e_idLowercase
            LowerCaseFunction()
        Case $e_idCapitalize
            CapitalizeFunction()
        Case $e_idinvertCase
            InvertCaseFunction()
        Case $e_idExit
            ExitFunction()
    EndSwitch

    _GUICtrlMenu_DestroyMenu($hMenu)
    GUIDelete($hGUI)
EndFunc   ;==>ContextMenu

Func ExitFunction()
    _GUICtrlMenu_DestroyMenu($hMenu)
    GUIDelete($hGUI)
EndFunc   ;==>CloseMenu


Func UppercaseFunction()
    ClipPut("")
    Send("^c")
    Sleep(100)
    ClipPut(StringUpper(ClipGet()))
    Send("^v")
EndFunc   ;==>UppercaseFunction

Func LowerCaseFunction()
    ClipPut("")
    Send("^c")
    Sleep(100)
    ClipPut(StringLower(ClipGet()))
    Send("^v")
EndFunc   ;==>UppercaseFunction

Func CapitalizeFunction()
    ClipPut("")
    Send("^c")
    Sleep(100)
    ClipPut(CapitalizeWords(ClipGet()))
    Send("^v")
EndFunc   ;==>CapitalizeFunction

Func InvertCaseFunction()
    ClipPut("")
    Send("^c")
    Sleep(100)
    ClipPut(InvertCase(ClipGet()))
    Send("^v")
EndFunc   ;==>CapitalizeFunction

Func CapitalizeWords($sInput)
    Local $aWords = StringSplit($sInput, " ")
    Local $sResult = ""
    For $i = 1 To $aWords[0]
        $sResult &= StringUpper(StringLeft($aWords[$i], 1)) & StringLower(StringTrimLeft($aWords[$i], 1)) & " "
    Next
    Return StringTrimRight($sResult, 1)
EndFunc

Func InvertCase($sInput)
    Local $sResult = ""
    For $i = 1 To StringLen($sInput)
        Local $sChar = StringMid($sInput, $i, 1)
        If StringIsLower($sChar) Then
            $sResult &= StringUpper($sChar)
        ElseIf StringIsUpper($sChar) Then
            $sResult &= StringLower($sChar)
        Else
            $sResult &= $sChar
        EndIf
    Next
    Return $sResult
EndFunc

 

Edited by Andreik

When the words fail... music speaks.

Link to comment
Share on other sites

I applied two strokes

#include <GUIConstantsEx.au3>
#include <GuiMenu.au3>
#include <Misc.au3>

Global Enum $e_idOpen = 1000, $e_idSave, $e_idInfo, $e_idUppercase, $e_idLowercase, $e_idCapitalize, $e_idinvertCase, $e_idExit
Global $hMenu, $hGUI, $iContextMenuItem, $GetCursorInfo, $hActiveWin

While 1
    If _IsPressed("10") And _IsPressed("04") Then
        ContextMenu()
    EndIf
    Sleep(10)
WEnd

Func ContextMenu()
    $hActiveWin = WinGetHandle("[ACTIVE]")
    $hGUI = GUICreate("", 0, 0, -1, -1, 0x80000000)
    GUISetState(@SW_SHOW, $hGUI)    ; <<< ------ You need this

    $hMenu = _GUICtrlMenu_CreatePopup()
    _GUICtrlMenu_InsertMenuItem($hMenu, 0, "UPPERCASE", $e_idUppercase)
    _GUICtrlMenu_InsertMenuItem($hMenu, 1, "lowercase", $e_idLowercase)
    _GUICtrlMenu_InsertMenuItem($hMenu, 2, "Capitalize Function", $e_idCapitalize)
    _GUICtrlMenu_InsertMenuItem($hMenu, 3, "iNVERT cASE", $e_idinvertCase)
    _GUICtrlMenu_InsertMenuItem($hMenu, 4, "", 0)
    _GUICtrlMenu_InsertMenuItem($hMenu, 5, "Undo", $e_idExit)

    Local $iMouseX = MouseGetPos(0), $iMouseY = MouseGetPos(1)
    $iContextMenuItem = _GUICtrlMenu_TrackPopupMenu($hMenu, $hGUI, $iMouseX, $iMouseY, 0, 0, 2)

    Switch $iContextMenuItem
        Case $e_idUppercase
            UppercaseFunction()
        Case $e_idLowercase
            LowerCaseFunction()
        Case $e_idCapitalize
            CapitalizeFunction()
        Case $e_idinvertCase
            InvertCaseFunction()
        Case $e_idExit
            ExitFunction()
    EndSwitch

    _GUICtrlMenu_DestroyMenu($hMenu)
    GUIDelete($hGUI)
EndFunc   ;==>ContextMenu

Func ExitFunction()
    _GUICtrlMenu_DestroyMenu($hMenu)
    GUIDelete($hGUI)
EndFunc   ;==>ExitFunction

Func UppercaseFunction()
    Local $ClipBack = ClipGet() ; backup clip data
    ClipPut("<Empty>") ; <Empty>
    WinActivate($hActiveWin)
    Send("^c")
    Sleep(200)
    Local $sWord = ClipGet()
    If $sWord = "<Empty>" Then
        ConsoleWrite("- Clipboard: " & $sWord & @CRLF)
    Else
        ClipPut(StringUpper($sWord))
        Send("^v")
    EndIf
    ClipPut($ClipBack) ; Restore clip data
EndFunc   ;==>UppercaseFunction

Func LowerCaseFunction()
    Local $ClipBack = ClipGet() ; backup clip data
    ClipPut("<Empty>") ; <Empty>
    WinActivate($hActiveWin)
    Send("^c")
    Sleep(200)
    Local $sWord = ClipGet()
    If $sWord = "<Empty>" Then
        ConsoleWrite("- Clipboard: " & $sWord & @CRLF)
    Else
        ClipPut(StringLower($sWord))
        Send("^v")
    EndIf
    ClipPut($ClipBack) ; Restore clip data
EndFunc   ;==>LowerCaseFunction

Func CapitalizeFunction()
    Local $ClipBack = ClipGet() ; backup clip data
    ClipPut("<Empty>") ; <Empty>
    WinActivate($hActiveWin)
    Send("^c")
    Sleep(200)
    Local $sWord = ClipGet()
    If $sWord = "<Empty>" Then
        ConsoleWrite("- Clipboard: " & $sWord & @CRLF)
    Else
        ClipPut(CapitalizeWords($sWord))
        Send("^v")
    EndIf
    ClipPut($ClipBack) ; Restore clip data
EndFunc   ;==>CapitalizeFunction

Func InvertCaseFunction()
    Local $ClipBack = ClipGet() ; backup clip data
    ClipPut("<Empty>") ; <Empty>
    WinActivate($hActiveWin)
    Send("^c")
    Sleep(200)
    Local $sWord = ClipGet()
    If $sWord = "<Empty>" Then
        ConsoleWrite("- Clipboard: " & $sWord & @CRLF)
    Else
        ClipPut(InvertCase($sWord))
        Send("^v")
    EndIf
    ClipPut($ClipBack) ; Restore clip data
EndFunc   ;==>InvertCaseFunction

Func CapitalizeWords($sInput)
    Local $aWords = StringSplit($sInput, " ")
    Local $sResult = ""
    For $i = 1 To $aWords[0]
        $sResult &= StringUpper(StringLeft($aWords[$i], 1)) & StringLower(StringTrimLeft($aWords[$i], 1)) & " "
    Next
    Return StringTrimRight($sResult, 1)
EndFunc   ;==>CapitalizeWords

Func InvertCase($sInput)
    Local $sResult = ""
    For $i = 1 To StringLen($sInput)
        Local $sChar = StringMid($sInput, $i, 1)
        If StringIsLower($sChar) Then
            $sResult &= StringUpper($sChar)
        ElseIf StringIsUpper($sChar) Then
            $sResult &= StringLower($sChar)
        Else
            $sResult &= $sChar
        EndIf
    Next
    Return $sResult
EndFunc   ;==>InvertCase

 

Edited by ioa747
give more time

I know that I know nothing

Link to comment
Share on other sites

5 hours ago, Terenz said:

Did you try it? In this case not work anymore (the menu part, i mean the UPPERCASE etc)

Your question was why your popup don't disappear when you click outside and you got the answer. Don't think anyone it's going to spend time to understand the entire logic of your application without a proper context. All I can see in your functions is copy/paste operations through clipboard. Give a proper context about what and from where do you copy/paste and you will get better answers.

 

@ioa747 gave you an example about how to save the active window for further operations, if this is what do you expect.

When the words fail... music speaks.

Link to comment
Share on other sites

@Andreik  I completely agree with you.
Moreover, it seems from your labeling

GUISetState(@SW_SHOW, $hGUI)    ; <<< ------ You need this

I read the post, saw the script, drew a conclusion, completed the puzzle and added some touches, how would I do it

In no case should it be considered that I gave the solution

just point out what's missing  (in my perception)  :)

Edited by ioa747

I know that I know nothing

Link to comment
Share on other sites

Entire logic lol, is just a popup menu.

I have explained:

For work i need a tool for change case of the selected text (Uppercase, lowercase etc)

I need to explain more? Okay.

 

1) Take your mouse

2) Select a text with the left mouse click (example inside notepad or whatever ide) and this text contain the phrase "i like autoit"

3)  SHIFT + right click of the mouse will open a menu

4) Select the option menu "UPPERCASE"

5) The selected text will become "I LIKE AUTOIT"

6) Profit

 

Now the code of third post work:

Still have two problems:

1) If i click outside the menu, the menu will not disappear. If i add GUISetState and the WS_POPUP the "logic" of the software will not work anymore, so i can't change the case of the text.

2) Click again SHIFT + right click of the mouse (if the menu is already open) will not open a new menu in a new position, since seems TrackPopupMenu is a blocking function so stop the loop and i can't destroy it

If isn't clear tell me, remember that english isn't my mother language ;)

Edited by Terenz

Nothing is so strong as gentleness. Nothing is so gentle as real strength

 

Link to comment
Share on other sites

Lol @ioa747 you are so funny, you don't have any idea of what i have write (probably my english isn't prefect, but your understanding of the language is worse than mine). I'm part of this forum from 2013, not the first guy passed here with one post asking for game automation.

I'll write my solution with ALL the problems resolved.

Edited by Terenz

Nothing is so strong as gentleness. Nothing is so gentle as real strength

 

Link to comment
Share on other sites

  • Solution
#include <WindowsConstants.au3>
#include <GuiMenu.au3>
#include <WinAPI.au3>
#include <Misc.au3>
#NoTrayIcon

If _Singleton("ContextMenu", 1) = 0 Then Exit

Global $hMouseHook, $fShow = False, $MenuID = False

While 1
    If _IsPressed("04") Then
        If Not $fShow Then
            $ContextMenu = GUICreate("", 0, 0)

            $hMod = _WinAPI_GetModuleHandle(0)
            $Callback = DllCallbackRegister("WH_MOUSE_LL", "int", "int;ptr;ptr")
            $hHook = _WinAPI_SetWindowsHookEx($WH_MOUSE_LL, DllCallbackGetPtr($Callback), $hMod, 0)

            $MainContextMenu = GUICtrlCreateContextMenu()
            GUICtrlCreateMenuItem("Normal", $MainContextMenu)
            GUICtrlCreateMenuItem("lowercase", $MainContextMenu)
            GUICtrlCreateMenuItem("UPPERCASE", $MainContextMenu)
            GUICtrlCreateMenuItem("Capitalize Words", $MainContextMenu)
            GUICtrlCreateMenuItem("iNVERT cASE", $MainContextMenu)
            GUICtrlCreateMenuItem("", $MainContextMenu)
            GUICtrlCreateMenuItem("Exit", $MainContextMenu)

            GUIRegisterMsg($WM_MENUSELECT, "WM_MENUSELECT")

            ControlClick($ContextMenu, "", $ContextMenu, "Right", 1)
            $fShow = True
        Else
            GUIDelete($ContextMenu)
            $fShow = False
        EndIf
    EndIf
    Sleep(10)
WEnd

Func WH_MOUSE_LL($nCode, $wParam, $lParam)
    #forceref $nCode, $wParam, $lParam
    If $nCode < 0 Then
        Return _WinAPI_CallNextHookEx($hMouseHook, $nCode, $wParam, $lParam)
    EndIf
    Switch $wParam
        Case $WM_LBUTTONUP
            Local $tMOUSE = DllStructCreate("uint x;uint y", $lParam)
            If Not (_WinAPI_GetClassName(_WinAPI_WindowFromPoint($tMOUSE)) = "#32768") Then
                $MenuID = False
                GUIDelete($ContextMenu)
            EndIf
    EndSwitch
    Return _WinAPI_CallNextHookEx($hMouseHook, $nCode, $wParam, $lParam)
EndFunc   ;==>WH_MOUSE_LL

Func WM_MENUSELECT($hWnd, $Msg, $wParam, $lParam)
    #forceref $hWnd, $Msg, $wParam, $lParam
    If Not $lParam Then
        Switch $MenuID
            Case 4
                SentenceCaseFunction()
            Case 5
                LowerCaseFunction()
            Case 6
                UppercaseFunction()
            Case 7
                CapitalizeFunction()
            Case 8
                InvertCaseFunction()
            Case 10
                ExitFunction()
        EndSwitch
        GUIDelete($ContextMenu)
    Else
        $wParam = BitAND($wParam, 0xFFFF)
        $MenuID = _GUICtrlMenu_GetItemID($lParam, $wParam, False)
    EndIf
EndFunc   ;==>WM_MENUSELECT

Func SentenceCaseFunction()
    ClipPut("")
    Send("^c")
    Sleep(100)
    ClipPut(SentenceCase(ClipGet()))
    Send("^v")
EndFunc   ;==>SentenceCaseFunction

Func LowerCaseFunction()
    ClipPut("")
    Send("^c")
    Sleep(100)
    ClipPut(StringLower(ClipGet()))
    Send("^v")
EndFunc   ;==>LowerCaseFunction

Func UppercaseFunction()
    ClipPut("")
    Send("^c")
    Sleep(100)
    ClipPut(StringUpper(ClipGet()))
    Send("^v")
EndFunc   ;==>UppercaseFunction

Func CapitalizeFunction()
    ClipPut("")
    Send("^c")
    Sleep(100)
    ClipPut(CapitalizeWords(ClipGet()))
    Send("^v")
EndFunc   ;==>CapitalizeFunction

Func InvertCaseFunction()
    ClipPut("")
    Send("^c")
    Sleep(100)
    ClipPut(InvertCase(ClipGet()))
    Send("^v")
EndFunc   ;==>InvertCaseFunction

Func ExitFunction()
    GUIDelete($ContextMenu)
    Exit
EndFunc   ;==>ExitFunction

Func CapitalizeWords($sInput)
    Local $aWords = StringSplit($sInput, " ")
    Local $sResult = ""
    For $i = 1 To $aWords[0]
        $sResult &= StringUpper(StringLeft($aWords[$i], 1)) & StringLower(StringTrimLeft($aWords[$i], 1)) & " "
    Next
    Return StringTrimRight($sResult, 1)
EndFunc   ;==>CapitalizeWords

Func InvertCase($sInput)
    Local $sResult = ""
    For $i = 1 To StringLen($sInput)
        Local $sChar = StringMid($sInput, $i, 1)
        If StringIsLower($sChar) Then
            $sResult &= StringUpper($sChar)
        ElseIf StringIsUpper($sChar) Then
            $sResult &= StringLower($sChar)
        Else
            $sResult &= $sChar
        EndIf
    Next
    Return $sResult
EndFunc   ;==>InvertCase

Func SentenceCase($sInput)
    Local $OutputString = ""
    Local $CapitalizeNext = True
    For $i = 1 To StringLen($sInput)
        Local $char = StringMid($sInput, $i, 1)
        If $char == "." Or $char == "?" Or $char == "!" Then
            $OutputString &= $char
            $CapitalizeNext = True
        ElseIf $CapitalizeNext And StringIsAlpha($char) Then
            $OutputString &= StringUpper($char)
            $CapitalizeNext = False
        Else
            $OutputString &= StringLower($char)
        EndIf
    Next
    Return $OutputString
EndFunc   ;==>SentenceCase

 

Nothing is so strong as gentleness. Nothing is so gentle as real strength

 

Link to comment
Share on other sites

You can keep talking shit but don't forget that you are in help and support forum since you couldn't figured your issues. Go and read the damn Win32 API documentation and help file if your english is so good so you don't have to ask noob questions on forum.

When the words fail... music speaks.

Link to comment
Share on other sites

  • Developers

ah ... kindergarden stuff....  All: get a life and walk away when emotions get heated!
*click*

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

Link to comment
Share on other sites

  • Jos locked this topic
Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...