TheReveller Posted April 2, 2009 Posted April 2, 2009 Hello, Is there a way to know what's the currently selected text ? Thanks.
Authenticity Posted April 2, 2009 Posted April 2, 2009 heh, where? like when double clicking or selecting text with the mouse? You can use AdlibEnable function to call some function that will use Send("^c") and use ClipGet, restore the clipboard with ClipSet or something...
TheReveller Posted April 2, 2009 Author Posted April 2, 2009 (edited) I want to show a tooltip when you select a number in any application. I wish I wouldn't have to tweak it by using the clipboard... That's buggy if you keep doing Ctrl-C while running applications. In Javascript web programming, you can get the selected text so I guess there should be a way to know what's the selected text in any application by Windows. Edited April 2, 2009 by TheReveller
Hawkwing Posted April 2, 2009 Posted April 2, 2009 This should work. HotKeySet ("^{F1}", "gettext") Local $clipboard While 1 WEnd Func gettext () $clipboard = ClipGet () Send ("^c") ToolTip (ClipGet ()) Sleep (5000) ToolTip ("") ClipPut ($clipboard) EndFunc The Wheel of Time turns, and Ages come and pass, leaving memories that become legend. Legend fades to myth, and even myth is long forgotten when the Age that gave it birth comes again.
TheReveller Posted April 7, 2009 Author Posted April 7, 2009 Isn't there something to do like this which doesn't need to send the copy to clipboard action :http://support.microsoft.com/kb/163434Sub GetSelectedText() On Error Resume Next Err.Clear Dim oText As TextRange ' Get an object reference to the selected text range. Set oText = Activewindow.Selection.TextRange ' Check to see whether error occurred when getting text object ' reference. If Err.Number <> 0 Then MsgBox "Invalid Selection. Please highlight some text " _ & "or select a text frame and run the macro again.", _ vbExclamation End End If ' Display the selected text in a message box. If oText.Text = "" Then MsgBox "No Text Selected.", vbInformation Else MsgBox oText.Text, vbInformation End If End SubThe info about the currently selected text can be retrieved, so can AutoIt also retrieve it ?Thanks.
TheReveller Posted April 13, 2009 Author Posted April 13, 2009 Example with IE : #include<IE.au3> Global $oText, $oIE $oIE = _IECreate("http://www.autoitscript.com/forum/index.php?showtopic=92459") While 1 $oText = $oIE.document.selection.createrange.text ToolTip($oText, Default, Default, Default, Default, 4) WEnd Is there a way to get the ActiveWindow object so I could use VBA directly ? Thanks, TheReveller
MAS Posted March 22, 2012 Posted March 22, 2012 (edited) hello if you want the selected text in edit control you can use these functions to process on selection _GUICtrlEdit_GetSel _GUICtrlEdit_SetSel _GUICtrlEdit_ReplaceSel you can find more info on the help file Good luck Edited March 22, 2012 by MAS
PhoenixXL Posted April 20, 2012 Posted April 20, 2012 Hey TheReveller you can use _WinAPI_GetActiveWindow() to get the active window and then use the VBA My code: Reveal hidden contents PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners. MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.
hiepxuan2008 Posted May 29, 2013 Posted May 29, 2013 (edited) continue discuss, http://support.microsoft.com/kb/163434 Edited May 29, 2013 by hiepxuan2008
guinness Posted May 29, 2013 Posted May 29, 2013 A bit late to the party, don't you think hiepxuan2008? Please refrain from unnecessarily necroing old threads if you can. Thanks. UDF List: Reveal hidden contents _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now