kantaki Posted February 12, 2010 Posted February 12, 2010 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 ?
kantaki Posted February 12, 2010 Author Posted February 12, 2010 (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 February 12, 2010 by kantaki
PsaltyDS Posted February 12, 2010 Posted February 12, 2010 _IsPressed("43") 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
Moderators Melba23 Posted February 12, 2010 Moderators Posted February 12, 2010 (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: #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)M23P.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 February 12, 2010 by Melba23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
kantaki Posted February 12, 2010 Author Posted February 12, 2010 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 ^^. So firefox doesnt interrest if any windows have a higher priority than itself. good to know^^
PsaltyDS Posted February 12, 2010 Posted February 12, 2010 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. 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
Moderators Melba23 Posted February 12, 2010 Moderators Posted February 12, 2010 PsaltyDS, My turn to learn. 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 Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now