Sign in to follow this  
Followers 0
kantaki

WinActivate Problem

8 posts in this topic

Hey,

i have a problem with my sctipt

#include <Misc.au3>

While 1

If _IsPressed(43) Then

WinActivate("pickup.listchecker v1.0.592 (01/07/2008)")

sLeep(50)

$clip = CLipGet()

ClipPut("/hb "&$clip)

sLeep(50)

send("^v")

EndIf

WEnd

evertime i press "c" it should activate the window "pickup.listchecker v1.0.592 (01/07/2008)"

but it doesent and i dont know why.

if i solo the script

WinActivate("pickup.listchecker v1.0.592 (01/07/2008)")

it works . maybe u can help me ?

Share this post


Link to post
Share on other sites



_IsPressed("43") :mellow:


Best Regards BugFix  

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

doesnt work either. :/

if the window is open the script works fine but it doesnt open the windows if i press the letter c i dont know why

is there an other way to solve my problem ?

maybe the script can react on my cache ?

$clip = CLipGet()

If $clip then

but its endless beacuse my cache is always full, maybe i can change this so that the script is only true if i copy a new text to my cache

Edited by kantaki

Share this post


Link to post
Share on other sites

_IsPressed("43") :mellow:

That's the correct syntax in the help file, but if you test it either the string or actual integer works. Which is weird because the native number format is decimal and _IsPressed() expects a Hex string. It works because there is a string conversion (not a dec-to-hex conversion) happening in the UDF:
Local $a_R = DllCall($vDLL, "short", "GetAsyncKeyState", "int", '0x' & $sHexKey)

This operation does the trick: '0x' & $sHexKey

Interesting.

:(


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

#5 ·  Posted (edited)

kantaki,

You need the second parameter for _IsPressed - it is not optional. I was wrong - see below.

So as you are using _IsPressed in a loop, you should open the DLL first, then use the handle in the _IsPressed call, and finally close it as you exit: :mellow:

#include <Misc.au3>

$dll = DllOpen("user32.dll")

While 1

    If _IsPressed("43", $dll) Then
        ; Code
    EndIf
WEnd

; Do not forget to clos the dll when you quit like this:
; DllClose($dll)

M23

P.S. When you post code please use Code tags. Put [autoit ] before and [/autoit ] after your posted code (but omit the trailing space - it is only there so the tags display here). Or press the blue button just under the BOLD toolbar button.

Edit: Did not want to leave incorrect information in the post.

Edited by Melba23

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

P.S. When you post code please use Code tags. Put [autoit ] before and [/autoit ] after your posted code (but omit the trailing space - it is only there so the tags display here). Or press the blue button just under the BOLD toolbar button.

ah ok ,

thanks but i know now why it didnt work. Funny but im using firefox and it is ignoring the winactivate command. If i use the ie it works fine :mellow: ^^.

So firefox doesnt interrest if any windows have a higher priority than itself.

good to know^^

Share this post


Link to post
Share on other sites

You need the second parameter for _IsPressed - it is not optional.

So as you are using _IsPressed in a loop, you should open the DLL first, then use the handle in the _IsPressed call, and finally close it as you exit: :(

Not quite:
#include <Misc.au3>

HotKeySet("{ESC}", "_Quit")

While 1
    If _IsPressed(43) Then
        ConsoleWrite("You hit c." & @LF)
        Sleep(100)
    EndIf
    Sleep(10)
WEnd

Func _Quit()
    Exit
EndFunc   ;==>_Quit

The syntax in the UDF does make it optional.

The thing is, there are certain DLLs that must be running already in a functional Windows environment, like kernel32.dll and user32.dll. There is no need to open/close those as DllCall() gets the handle just as quickly from the existing instance as if you passed it. I believe there was a Valik post about this a long time ago.

:mellow:


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

PsaltyDS,

My turn to learn. :mellow:

Fun this, isn't it! :(

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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  
Followers 0