AutoHotkey Community

It is currently May 27th, 2012, 1:20 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: November 19th, 2009, 12:52 pm 
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


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: November 19th, 2009, 1:51 pm 
Offline
User avatar

Joined: August 30th, 2005, 8:43 pm
Posts: 8666
Location: Salem, MA
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.

_________________
Image
(Common Answers) - New Tutorials Forum - Humongous FAQ


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 19th, 2009, 2:36 pm 
Offline

Joined: November 19th, 2009, 12:44 pm
Posts: 1
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.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bing [Bot], iDrug, Ohnitiel and 23 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group