 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Guest
|
Posted: Thu Nov 19, 2009 11:52 am Post subject: Search string in a windows |
|
|
Hi
I'm newby in AutoHotkey programming.
After searching in the documentation and the forum should I ask for your help.
I'm trying to write a function that searches a string in a screen session of an emulator IBM personal comunication 5.8.
This emulator does not have an integrated search function. (available only from the lastone version)
There are functions that can help me to do that?
For example how to search a string in a notepad windows without using CTRL+T.
Thanks
Mauro |
|
| Back to top |
|
 |
engunneer
Joined: 30 Aug 2005 Posts: 7698 Location: Germany (but I only speak English)
|
Posted: Thu Nov 19, 2009 12:51 pm Post subject: |
|
|
the problem is that the IBM emulator is probably not showing you text, but instead is showing you a picture of the text. AHK probably can't read it directly, unless the program gives you some copy/paste function. _________________
Unless noted, all code is UNTESTED.
Answers Here: 1.(Loops, Viruses, etc.) 2.Search 3.RTFM 4.Ask for Help.
PMs will be ignored unless you are hiring me. |
|
| Back to top |
|
 |
M8
Joined: 19 Nov 2009 Posts: 1
|
Posted: Thu Nov 19, 2009 1:36 pm Post subject: |
|
|
Thanks for the quick response;
I'm not sure because I have try this example
| Code: | ; http://www.autohotkey.com/forum/viewtopic.php?t=39120
#NoEnv
#SingleInstance Ignore
#Persistent
SendMode Input
Gui 1: Add, Button, x9 y5 w46 h23 gFindString Default, Search
Gui 1: Add, Edit, x9 y34 w100 h21 vfind,
Gui 1: Add, Edit, x9 y61 w330 h64 r3 vContent HSCROLL,
Gui 1: Add, Text, x116 y37 w200 h20 , <----- Enter 'Search String' here
Gui 1: Add, StatusBar,, Copy text to search, enter Search String and click 'Search'
SB_SetParts(300)
Gui 1: Show,, Simple Text search
WinGet ControlID, ID, Simple Text search
searchText = Initializing...
Guicontrol,,Edit2, %searchText%
Return
OnClipboardChange:
if A_EventInfo = 1
{
If searchText = Initializing...
{
sleep, 1000
searchText = Ready...`nCopy text to search here.
}
else
{
searchText = %clipboard%
}
GuiControl,,Content,%searchText%
Gui, Show
}
Return
FindString:
Gui, Submit, Nohide
if (find != lastFind) {
offset = 0
hits = 0
}
GuiControl 1:Focus, Content
SendMessage 0xB6, 0, -999, Edit2, ahk_id %ControlID%
StringGetPos pos, Content, %find% ,,offset
if (pos = -1) {
if (offset = 0) {
SB_SetText("'" . find . "' not found", 1)
SB_SetText("", 2)
}
else {
SB_SetText("No more occurrences of '" . find . "'")
SB_SetText("", 2)
offset = 0
hits = 0
}
Return
}
StringLeft __s, Content, %pos%
StringReplace __s,__s,`n,`n,UseErrorLevel
addToPos=%Errorlevel%
SendMessage 0xB1, pos + addToPos, pos + addToPos + Strlen(find), Edit2, ahk_id %ControlID%
SendMessage, EM_SCROLLCARET := 0xB7, 0, 0, Edit2, ahk_id %ControlID%
offset := pos + addToPos + Strlen(find)
lastFind = %find%
hits++
SB_SetText("'" . find . "' found in line " . addToPos + 1, 1)
SB_SetText(hits . (hits = 1 ? " hit" : " hits"), 2)
Return
GuiClose:
ExitApp |
I use the select all button and the copy button of the IBM emulator (the hotkey don't exist) and the search in the copy of the clipboard works well.
Unfortunately I must do the search in the emulator windows. |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|