Jump to content

send selected text prob - newbie


twelo
 Share

Recommended Posts

hi i m newbie i have some problem.

1st problem

i m using this code to read and send whole text from edit field

its working fine

ControlSend("command prompt", "", "", GUICtrlRead($EditField))
MsgBox(0, "all sent", GUICtrlRead($EditField))

how to send only selected text from edit field to "command prompt" window ?

2nd problem

ctrl+a(select all) shortcut not working in my edit field

how to enable this ?

3rd problem

when i drag & drop text file in my edit field only files path inserted not files content

how to drag & drop text files contents & selected text from other windows to edit field ?

4th problem

how to open file by default program in windows ?

i m using this but when test.txt not present in working directory, untitled notepad opens how to avoid this ?

Run ("notepad.exe test.txt")

sory for bad english

Link to comment
Share on other sites

First problem: _GUICtrlEdit_GetSel

Second problem: _GUICtrlEdit_SetSel

Fourth problem : ShellExecute

Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the Universe
trying to produce bigger and better idiots.
So far, the Universe is winning.

Link to comment
Share on other sites

3rd problem

If FileExists(GUICtrlRead($myEdit)) Then GUICtrlSetData($myEdit, FileRead(GUICtrlRead($myEdit)))

EDIT: This will work for a single file only. If you need it to do multiple files then I'm reasonably sure I can work out a StringRegExp() that will do it.

Edited by GEOSoft

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

thanks all for reply

i sorted out 4th problem by "ShellExecute" command

but i unable to solve other problems, help me to rectify this

here my sample code, please correct it so i can understand practically

#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 161, 189, 192, 124)
$Send = GUICtrlCreateMenu("Send")
$All = GUICtrlCreateMenuItem("ALL", $Send)
$Selected = GUICtrlCreateMenuItem("Selected", $Send)
$About = GUICtrlCreateMenuItem("About", $Send)
$EditField = GUICtrlCreateEdit("", 8, 0, 145, 161)
GUICtrlSetData(-1, "Edit1")
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Select
        Case $nMsg = $All
        WinWaitActive("Untitled")
        ControlSend("Untitled", "", "", GUICtrlRead($EditField))
        MsgBox(0, "all sent", GUICtrlRead($EditField))
        Case $nMsg = $Selected
        WinWaitActive("Untitled")
        ControlSend("Untitled", "", "", GUICtrlRead($EditField))
        MsgBox(0, "selection sent", GUICtrlRead($EditField))
        Case $nMsg = $About
        ShellExecute("about.txt")
        Case $GUI_EVENT_CLOSE
    EndSelect
WEnd

text will be copied to untitled notepad when active

another question is any way to send unicode characters ? ie chiness, russian text ?

i played with send & controlsend command but no luck

Link to comment
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
 Share

  • Recently Browsing   0 members

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