Jump to content
Sign in to follow this  
torels

Get Scite text in Au3 - how to ?

Recommended Posts

torels

Hi all!

I was Wondering how to get the text written in the scite...

does somebody know ?

thanks in advance

:)


Some Projects:[list][*]ZIP UDF using no external files[*]iPod Music Transfer [*]iTunes UDF - fully integrate iTunes with au3[*]iTunes info (taskbar player hover)[*]Instant Run - run scripts without saving them before :)[*]Get Tube - YouTube Downloader[*]Lyric Finder 2 - Find Lyrics to any of your song[*]DeskBox - A Desktop Extension Tool[/list]indifference will ruin the world, but in the end... WHO CARES :P---------------http://torels.altervista.org

Share this post


Link to post
Share on other sites
Dickb

Hi all!

I was Wondering how to get the text written in the scite...

does somebody know ?

thanks in advance

:)

There is a device developed for that. It is called a "Keyboard". :)

Share this post


Link to post
Share on other sites
monoceres

Using ControlSend:

ControlSend(@ScriptDir,"","[ID:350]",@CRLF&"hello")

The @ScriptDir is just there because I found it to be the easiest way to find the SciTE window :)


Broken link? PM me and I'll send you the file!

Share this post


Link to post
Share on other sites
NELyon

And I bet I'm the only one who noticed that he says he wants to Get the text written in SciTe :)

Share this post


Link to post
Share on other sites
PsaltyDS

I was Wondering how to get the text written in the scite...

does somebody know ?

SciTE draws its own edit control "[CLASS:Scintilla]", which is not a standard Windows API control. Therefore the text is not directly visible to AutoIt. But, it was coded with standard shortcuts for select all, copy, and paste. So this works:
Opt("WinTitleMatchMode", 4)

; Read text from SciTE (already open)
WinWait("[CLASS:SciTEWindow; INSTANCE:1]")
$hSciTE = WinGetHandle("[CLASS:SciTEWindow; INSTANCE:1]")
WinActivate($hSciTE)
WinWaitActive($hSciTE)
ControlFocus($hSciTE, "", "[CLASS:Scintilla; INSTANCE:1]")
ControlSend($hSciTE, "", "[CLASS:Scintilla; INSTANCE:1]", "^a")
ControlSend($hSciTE, "", "[CLASS:Scintilla; INSTANCE:1]", "^c")

; Paste text to Notepad
Run("Notepad.exe")
WinWait("[TITLE:Untitled - Notepad]")
$hNotepad = WinGetHandle("[TITLE:Untitled - Notepad]")
WinActivate($hNotepad)
WinWaitActive($hNotepad)
ControlSend($hNotepad, "", "[CLASS:Edit; INSTANCE:1]", "^v")

The Scintilla Text Editor (SciTE) is an open source project, and maybe there is more elegant way to read the text using some automation interface, but the brute-force hack above gets the job done.

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites
Jos

Just an alternative with less "hacking" :)

SendSciTE_Command("insert:text to insert at cursor replacing possible selected text.")
;
;
Func SendSciTE_Command($sCmd)
    Opt("WinSearchChildren", 1)
; Get SciTE DirectorHandle
    $SciTE_hwnd = WinGetHandle("DirectorExtension")
    Local $WM_COPYDATA = 74
    Local $CmdStruct = DllStructCreate('Char[' & StringLen($sCmd) + 1 & ']')
    DllStructSetData($CmdStruct, 1, $sCmd)
    Local $COPYDATA = DllStructCreate('Ptr;DWord;Ptr')
    DllStructSetData($COPYDATA, 1, 1)
    DllStructSetData($COPYDATA, 2, StringLen($sCmd) + 1)
    DllStructSetData($COPYDATA, 3, DllStructGetPtr($CmdStruct))
    DllCall('User32.dll', 'None', 'SendMessage', 'HWnd', $SciTE_hwnd, _
            'Int', $WM_COPYDATA, 'HWnd', 0, _
            'Ptr', DllStructGetPtr($COPYDATA))
EndFunc  ;==>SendSciTE_Command

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
torels

And I bet I'm the only one who noticed that he says he wants to Get the text written in SciTe :)

:)

thanks PsaltyDS & JOS!


Some Projects:[list][*]ZIP UDF using no external files[*]iPod Music Transfer [*]iTunes UDF - fully integrate iTunes with au3[*]iTunes info (taskbar player hover)[*]Instant Run - run scripts without saving them before :)[*]Get Tube - YouTube Downloader[*]Lyric Finder 2 - Find Lyrics to any of your song[*]DeskBox - A Desktop Extension Tool[/list]indifference will ruin the world, but in the end... WHO CARES :P---------------http://torels.altervista.org

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  

×