Jump to content
Sign in to follow this  
7121

ControlSend confusion

Recommended Posts

7121

i'm have a small problem understanding ControlSend.

I have notepad2 so this might a little bit harder.

What i want to do is copy a title of a certain window (ex: firefox) into the notepad file. Unfortunately, i do not want the notepad window to pop up, basically i do not want the window to be active during teh pasting.

KEEP IN MIND it's NOTEPAD2 so yeah =/.

Every time i do send it to the notepad, the window keeps popping back up so yeah.

Share this post


Link to post
Share on other sites
Nahuel

And... why not write directly to a txt file? ^_^ It needs to be on notepad?

Share this post


Link to post
Share on other sites
7121

well the thing is that the NOTEPAD or TXT file is already open and has to keep track on how the firefox title changes. Basically its recording a list of the firefox titles that pop up. So yeaah...

but please, do enlighten me by WRITING DIRECTLY?

do u mean actually writing to the txt file without opening it??? o_0?? is that possible???

*I still want to know how to use ControlSend though for future references

Share this post


Link to post
Share on other sites
Nahuel

You can find all this in the help file. It's 100% better to simply write the txt file.

Look at this code:

HotKeySet("{esc}",'_exit')

$FilePath = ''
$FirefoxClass = '[CLASS:FirefoxWindow]'
$sOldTitle = ''
$FileHandle = FileOpen($FilePath,1)

While 1
    $s_Title = WinGetTitle($FirefoxClass)
    If $s_Title <> $sOldTitle Then 
        FileWriteLine($FileHandle,$s_Title)
        $sOldTitle = $s_Title
    EndIf
    Sleep(500);
WEnd

Func _exit()
    FileClose($FileHandle)
    Exit
EndFunc

What you need to do before you run that, is check Firefox properties with Autoit Window Info. (You find it at Start->All programs->Autoit v3->Autoit Window Info). You need to check Firefox's class under Basic Window Info. Once you have it, replace 'FirefoxWindow' in $FirefoxClass, since I made that up.

Read the following in the help file:

FileOpen

FileWrite

FileWriteLine

Window Special Title Definition

Share this post


Link to post
Share on other sites
7121

You can find all this in the help file. It's 100% better to simply write the txt file.

Look at this code:

HotKeySet("{esc}",'_exit')

$FilePath = ''
$FirefoxClass = '[CLASS:FirefoxWindow]'
$sOldTitle = ''
$FileHandle = FileOpen($FilePath,1)

While 1
    $s_Title = WinGetTitle($FirefoxClass)
    If $s_Title <> $sOldTitle Then 
        FileWriteLine($FileHandle,$s_Title)
        $sOldTitle = $s_Title
    EndIf
    Sleep(500);
WEnd

Func _exit()
    FileClose($FileHandle)
    Exit
EndFunc

What you need to do before you run that, is check Firefox properties with Autoit Window Info. (You find it at Start->All programs->Autoit v3->Autoit Window Info). You need to check Firefox's class under Basic Window Info. Once you have it, replace 'FirefoxWindow' in $FirefoxClass, since I made that up.

Read the following in the help file:

FileOpen

FileWrite

FileWriteLine

Window Special Title Definition

hmmm, can it be consecutively??? as in , it can keep adding a NEW line of titles everytime....

Share this post


Link to post
Share on other sites
Authenticity

That is what it's doing, compares the old written title to the new title and if they're different write a line to the file. You may want to change the loop a little bit to get the title of the active FF window.

Edited by Authenticity

Share this post


Link to post
Share on other sites
7121

ooh i seee. THANKS ^__^. unfortunately this forum does not do REP =/.

OH, i manage to get the ControlSend to work =). Switched back to notepad though instead of notepad 2 ^_^.

I do however have a new question....

does anyone know if ControlClick work on firefox (minimized) ???

Share this post


Link to post
Share on other sites
FinalVersion

ooh i seee. THANKS ^__^. unfortunately this forum does not do REP =/.

OH, i manage to get the ControlSend to work =). Switched back to notepad though instead of notepad 2 ^_^.

I do however have a new question....

does anyone know if ControlClick work on firefox (minimized) ???

Go look in example scripts and look for FF.au3.

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  

×