sandin Posted March 15, 2008 Share Posted March 15, 2008 The problem is following: If I launch script, and activate the prog (it can be activated on Num2, and stopped on Num0, try launching Notepad, maximize it, and launch the script, and activate it with num2), and when I press ALT on my keyboard, the script starts pressing ALT constantly, and when I stop the prog. with Num0, ALT "clicking" stops aswell, but now it HOLDS down ALT button, so when I press ESC for example, it's like I pressed ALT+ESC, etc... Why? Why doesn't this script colide with ALT pressed during it's work? this is the script: expandcollapse popup#NoTrayIcon #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_outfile=pinnacle.exe #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <GUIConstants.au3> #Include <Constants.au3> Opt ("WinTitleMatchMode", 3) Opt ("MouseClickDownDelay", 55) Opt ("MouseClickDelay", 1) Opt ("SendKeyDownDelay", 10) Opt ("SendKeyDelay", 1) Opt("MouseCoordMode", 1) Opt("TrayMenuMode", 1) Opt("GUIOnEventMode", True) $leviklik1 = 0 $x_mouse = 400 $y_mouse = 265 $NOVA_punjenje = 8.2 $nazivbota = "Nova Bot" dim $NOVA_i = 0, $NOVA_timer, $NOVA_novo_vreme #Region ### START Koda GUI section ### Form= $NOVA_GUI = GUICreate($nazivbota, 168, 160, 193, 115) $NOVA_Spawn_time = GUICtrlCreateInput("5", 90, 30, 35, 20, $ES_READONLY) GuiCtrlCreateUpDown(-1) GUICtrlSetLimit(-1,60,0) $NOVA_dot_label = GUICtrlCreateLabel(".", 125, 35, 5, 17) $NOVA_Spawn_time_milisec = GUICtrlCreateInput("0", 130, 30, 30, 20, $ES_READONLY) GuiCtrlCreateUpDown(-1) GUICtrlSetLimit(-1,9,0) $NOVA_spell_number = GUICtrlCreateInput("4", 90, 10, 35, 20, $ES_READONLY) GuiCtrlCreateUpDown(-1) GUICtrlSetLimit(-1,9,1) $NOVA_Spawn_time_label = GUICtrlCreateLabel("Spawn time", 10, 30, 60, 17) $NOVA_spell_number_label = GUICtrlCreateLabel("NOVA spell No.", 10, 10, 80, 17) $NOVA_AP = GUICtrlCreateCheckbox("Auto Pickup Items", 15, 55, 120, 25) GUICtrlSetState(-1, $GUI_CHECKED) $NOVA_start_label = GUICtrlCreateLabel("Start = Num2", 15, 110, 65, 17) $Nova_stop_label = GUICtrlCreateLabel("Stop = Num0", 15, 130, 65, 17) $Nova_ON_OFF_input = GUICtrlCreateInput("OFF", 110, 120, 40, 20, $ES_READONLY) GUICtrlSetState(-1, $GUI_CHECKED) GUISetState(@SW_SHOW) GUISetOnEvent($GUI_EVENT_CLOSE, "_EXIT") #EndRegion ### END Koda GUI section ### #region Tray $NOVA__tray_exit = TrayCreateItem("Exit") TraySetState() #endregion WinWait($nazivbota) hotkeyset("{NUMPAD1}", "leviklik") hotkeyset("{NUMPAD2}", "Start_nove") hotkeyset("{NUMPAD0}", "STOPP") func _EXIT() Exit EndFunc func leviklik () $NOVA_i = 0 $leviklik1 = 1 Return EndFunc func Start_nove() $leviklik1 = 0 if WinExists("MU") Then $size = WinGetPos("MU") $xkoordinata = $size[0]+3 $ykoordinata = $size[1]+29 Else $xkoordinata = 0 $ykoordinata = 0 EndIf send("{" & guictrlread($NOVA_spell_number) & "}") $NOVA_novo_vreme = ((GUICtrlRead($NOVA_Spawn_time)*1000)+(GUICtrlRead($NOVA_Spawn_time_milisec)*100)+($NOVA_punjenje*1000)) GUICtrlSetData($Nova_ON_OFF_input, "ON") $NOVA_i = 1 MouseMove($x_mouse+$xkoordinata, $y_mouse+$ykoordinata, 1 ) $NOVA_timer = TimerInit() MouseDown("Right") EndFunc func STOPP() $NOVA_i = 0 $leviklik1 = 0 MouseUp("Right") GUICtrlSetData($Nova_ON_OFF_input, "OFF") EndFunc While 1 if $NOVA_i = 1 Then do If $NOVA_i = 0 then ExitLoop if GUICtrlRead($NOVA_AP) = $GUI_CHECKED Then Send("{SPACE}") until TimerDiff($NOVA_timer)>$NOVA_novo_vreme MouseUp("Right") if $NOVA_i = 1 Then $NOVA_timer = TimerInit() if $NOVA_i = 1 Then MouseDown("Right") EndIf if $leviklik1 = 1 then mouseclick("Left") sleep(200) EndIf $tMsg = TrayGetMsg() Switch $tMsg case $NOVA__tray_exit Exit EndSwitch WEnd Some cool glass and image menu | WinLIRC remote controler | Happy Holidays to all... | Bounce the sun, a game in which you must save the sun from falling by bouncing it back into the sky | Hook Leadtek WinFast TV Card Remote Control Msges | GDI+ sliding toolbar | MIDI Keyboard (early alpha stage, with lots of bugs to fix) | Alt+Tab replacement | CPU Benchmark with pretty GUI | Ini Editor - Edit/Create your ini files with great ease | Window Manager (take total control of your windows) Pretty GUI! | Pop-Up window from a button | Box slider for toolbar | Display sound volume on desktop | Switch hotkeys with mouse scroll Link to comment Share on other sites More sharing options...
martin Posted March 15, 2008 Share Posted March 15, 2008 The problem is following: If I launch script, and activate the prog (it can be activated on Num2, and stopped on Num0, try launching Notepad, maximize it, and launch the script, and activate it with num2), and when I press ALT on my keyboard, the script starts pressing ALT constantly, and when I stop the prog. with Num0, ALT "clicking" stops aswell, but now it HOLDS down ALT button, so when I press ESC for example, it's like I pressed ALT+ESC, etc... Why? Why doesn't this script colide with ALT pressed during it's work?I'm having a similar problem with a script where the Alt key is apparently help down and I don't see any similarity with your script. Can you tell me what version of AutoIt you using to run the script? Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
cal Posted March 16, 2008 Share Posted March 16, 2008 I'm wondering if the Alt key detection has changed somehow in the last couple versions. I have a script that just sends some simple text in response to an Alt-d key press. (hotkeyed to Alt-d obviously) In the last couple versions of autoit sometimes the Alt key gets held down for several strokes and sometimes not. If I compile the same script under an old version it works fine and only sends the text its supposed to. This is being used in Lotus Notes but its repeatable in Notepad or any app were the Alt key can activate the menu. Try running your script on another computer with an older autoit version and see if the Alt still gets held down. I'm running the current version and have this issue, the previous one had the same issue. I'll have to check Monday at work what version I have on the other laptop where I know I kept the older version of autoit for this very reason. And no. I don't mean really old. Its still a ver 3 something. I'll check on monday. Link to comment Share on other sites More sharing options...
martin Posted March 16, 2008 Share Posted March 16, 2008 I'm wondering if the Alt key detection has changed somehow in the last couple versions.I have a script that just sends some simple text in response to an Alt-d key press. (hotkeyed to Alt-d obviously)In the last couple versions of autoit sometimes the Alt key gets held down for several strokes and sometimes not. If I compile the same script under an old version it works fine and only sends the text its supposed to. This is being used in Lotus Notes but its repeatable in Notepad or any app were the Alt key can activate the menu.Try running your script on another computer with an older autoit version and see if the Alt still gets held down.I'm running the current version and have this issue, the previous one had the same issue. I'll have to check Monday at work what version I have on the other laptop where I know I kept the older version of autoit for this very reason.And no. I don't mean really old. Its still a ver 3 something. I'll check on monday.If you respond to a key combination by sending characters using Send then you have to be careful. At least with the shift key you can get problems and I would expect it's the same with the Alt key. If the shift key is held down when Send starts but released before Send finishes then afterwards the shift key is permanently down. In my tests this always happens. My explanation for this was that Send sees that the shift key is down so it sends SHIFTUP, then sends the key sequence, then sends SHIFTDOWN to leave things as they were. I concluded that because holding the shift key down before the start of the send sequence and releasing it during doesn't appear to alter the keys actually sent. The fix is to put a delay in your script using "while _Ispressed" to test until the key is released.You might think this feature is a bug, as I did, but Valik says it is not a bug, so presumably my explanation is wrong, although the 'fix' still works. Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
cal Posted March 17, 2008 Share Posted March 17, 2008 Version on the laptop where it works. is 3.2.2.0. Version on my other systems is the current 3.2.10.0 The _Ispressed comment above makes sense. I'll give that a try sometime in the next few days when I can have a look at this. Thanks. Link to comment Share on other sites More sharing options...
FreeFry Posted March 18, 2008 Share Posted March 18, 2008 Try just running Send("{alt down}{alt up}") after/before whatever you're doing.. that's how I've solved problems like these... Link to comment Share on other sites More sharing options...
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