Ivan808 Posted December 6, 2009 Posted December 6, 2009 I have two checkboxes with If statements. Here is the code: expandcollapse popupCase $button If BitAND(GUICtrlRead($1_Checkbox), $GUI_CHECKED) Then MsgBox(64, "Gui Checked!", "Gui Checked1") If $DB2_FARM = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf If $computer_coordinates_DB = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf $1_1 = FileReadLine($DB2_FARM, 1) $1_2 = FileReadLine($DB2_FARM, 2) Opt("WinWaitDelay",100) Opt("WinTitleMatchMode",4) Opt("WinDetectHiddenText",1) Opt("MouseCoordMode",0) WinWait("None - Mozilla Firefox","") If Not WinActive("None - Mozilla Firefox","") Then WinActivate("None - Mozilla Firefox","") WinWaitActive("None - Mozilla Firefox","") MouseMove(935,418) MouseDown("left") MouseUp("left") MouseMove(852,178) MouseDown("left") MouseUp("left") MouseMove(810,206) MouseDown("left") MouseUp("left") Send("{BACKSPACE}{BACKSPACE}{DEL}" & $1_1) MouseMove(848,206) MouseDown("left") MouseUp("left") Send("{BACKSPACE}{BACKSPACE}{DEL}" & $1_2 & "{ENTER}") MouseMove(563,395) MouseDown("left") MouseUp("left") MouseMove(675,447) MouseDown("left") MouseUp("left") MouseMove(550,440) MouseDown("left") MouseUp("left") Send("{DEL}{DEL}{DEL}425") MouseMove(397,441) MouseDown("left") MouseUp("left") Send("{DEL}{DEL}{DEL}425") MouseMove(728,303) MouseDown("left") MouseUp("left") MouseMove(726,337) MouseDown("left") MouseUp("left") MouseMove(799,556) MouseDown("left") MouseUp("left") MouseMove(570,426) MouseDown("left") MouseUp("left") MouseMove(844,215) MouseDown("left") MouseUp("left") Else MsgBox(64, "Not Checked!", "You did not select 1") ;If it is NOT CHECKED do this after the msg box!!!!! EndIf ;THIS IS CHECKBOX 2 IF STATEMENT If BitAND(GUICtrlRead($2_Checkbox), $GUI_CHECKED) Then If $DB2_FARM = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf If $computer_coordinates_DB = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf $2_1 = FileReadLine($DB2_FARM, 3) $2_2 = FileReadLine($DB2_FARM, 4) Opt("WinWaitDelay",100) Opt("WinTitleMatchMode",4) Opt("WinDetectHiddenText",1) Opt("MouseCoordMode",0) WinWait("None - Mozilla Firefox","") If Not WinActive("None - Mozilla Firefox","") Then WinActivate("None - Mozilla Firefox","") WinWaitActive("None - Mozilla Firefox","") MouseMove(935,418) MouseDown("left") MouseUp("left") MouseMove(852,178) MouseDown("left") MouseUp("left") MouseMove(810,206) MouseDown("left") MouseUp("left") Send("{BACKSPACE}{BACKSPACE}{DEL}" & $2_1) MouseMove(848,206) MouseDown("left") MouseUp("left") Send("{BACKSPACE}{BACKSPACE}{DEL}" & $2_2 & "{ENTER}") MouseMove(563,395) MouseDown("left") MouseUp("left") MouseMove(675,447) MouseDown("left") MouseUp("left") MouseMove(550,440) MouseDown("left") MouseUp("left") Send("{DEL}{DEL}{DEL}425") MouseMove(397,441) MouseDown("left") MouseUp("left") Send("{DEL}{DEL}{DEL}425") MouseMove(728,303) MouseDown("left") MouseUp("left") MouseMove(726,337) MouseDown("left") MouseUp("left") MouseMove(799,556) MouseDown("left") MouseUp("left") MouseMove(570,426) MouseDown("left") MouseUp("left") MouseMove(844,215) MouseDown("left") MouseUp("left") Else MsgBox(64, "Not Checked!", "You did not select 2") ;If it is NOT CHECKED do this after the msg box!!!!! EndIf as you can see the mouse movements and "sends" are EXACTLY the same. Why would the coordinates (mousemove) be off by millimeters on the second attempt? its the exact same coordinates. Ive also attempted in changing out the mouse coordinates with variables and have succeeded, but again my problem is that the mouse moves to different spots than where I am trying to send it. Why? I have ruled out my wireless mouse, as I unplugged it from my laptop. I dont understand why it keeps doing this. It's really annoying, especially when I have another eight more If statements to make exactly like this. But my first goal is to get these two to work first. Just to reiterate: The FIRST "If" works flawlessly. Its the second that is giving me trouble. Thanks.
somdcomputerguy Posted December 6, 2009 Posted December 6, 2009 Try MouseCoordMode 2 (2 = relative coords to the client area of the active window), and adjust the coords in the code if necc., also, while this probably has nothing to do with the situation, the MouseUp and MouseDown statements can probably be replaced with a MouseClick. - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change.
skyboy Posted December 6, 2009 Posted December 6, 2009 it's probably because of some windows bug (moving the mouse left moves it two pixels (1 pixel is about 2mm) at a time, moving up does the same but down and right is only 1 pixel) related to the mouse position or not; i don't remotely understand some of the things windows does, or why
Ivan808 Posted December 6, 2009 Author Posted December 6, 2009 Try MouseCoordMode 2 (2 = relative coords to the client area of the active window), and adjust the coords in the code if necc., also, while this probably has nothing to do with the situation, the MouseUp and MouseDown statements can probably be replaced with a MouseClick.Ill try the Mousecoordmode.As for the MouseUp and MouseDown statements, they were from me using ScriptWriter.
weezypenguin Posted December 6, 2009 Posted December 6, 2009 Ill try the Mousecoordmode.As for the MouseUp and MouseDown statements, they were from me using ScriptWriter. would tis method in thos tread help me witha previous issue?I need to either send a set of keypresses or key commands (F1 o ctrl+C) or even make mouse press but the machine is pogged of or locked?Thanks
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