Asuramaru Posted February 23, 2016 Share Posted February 23, 2016 Hello! I have a script who "lock" my mouse on a position if i toggle on, moving the mouse every 1ms to the pos. "100, 100" Global $Paused Global $delay = 2 HotKeySet("{Pause}", "TogglePause") HotKeySet("{End}", "Kill") Sleep(100) While 1 If $delay = 2 Then MouseMove(100, 100, 0) $delay = 1 EndIf If $delay = 1 Then Sleep(1) $delay = 2 EndIf ToolTip("ON", 1, 1, "SCRIPT", 1) WEnd Func TogglePause() $Paused = not $Paused While $Paused ToolTip("OFF", 1, 1, "SCRIPT", 3) Sleep(500) WEnd EndFunc Func Kill() ToolTip("Exiting...", 1, 1, "SCRIPT", 3) Sleep (1000) Exit EndFunc But..I want to save information in a notebook called Position.txt (example), and get the information in that file and use into the script to move the mouse.Example: MouseMove ($xPos, $yPos, 0) I want to get $xPos and $yPos from a notepad saved on same folder as script.Inside the notepad I want something like: Then when i start, script will get the positions from "Position.txt" and "lock" my mouse on x position. I dont find anything like this on forums, anyone know how to? Link to comment Share on other sites More sharing options...
AutoBert Posted February 23, 2016 Share Posted February 23, 2016 Quote FileRead: Read in a number of characters from a previously opened file. StringSplit: Splits up a string into substrings depending on the given delimiters. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 23, 2016 Moderators Share Posted February 23, 2016 Asuramaru, An ini file would be just the thing - look at the Ini* functions in the help file. 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 Link to comment Share on other sites More sharing options...
Asuramaru Posted February 23, 2016 Author Share Posted February 23, 2016 I will try to read the ini function, its because i'm bad with english xD I try to learn putting some random codes and see what happens, Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 23, 2016 Moderators Share Posted February 23, 2016 Asuramaru, Explain why you want to force the mouse to that position every few milliseconds and, if I approve, I will offer some help with ini files. 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 Link to comment Share on other sites More sharing options...
Asuramaru Posted February 29, 2016 Author Share Posted February 29, 2016 I used only as a example, i want to learn this language too, only for knowledge XD Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 1, 2016 Moderators Share Posted March 1, 2016 Asuramaru, On reflection, an ini file is not what is wanted here - but this script should show you how to store and read coordinates. Click a few times within the GUI and then press the "Playback" button - the mouse will move to the previously clicked positions: expandcollapse popup#include <GUIConstantsEx.au3> #include <FileConstants.au3> ; Open file in which to write data $sFileName = "Record.txt" $hFile = FileOpen($sFileName, $FO_OVERWRITE) ; Create a GUI $hGUI = GUICreate("Test", 500, 500) $cPlayback = GUICtrlCreateButton("Playback", 10, 10, 80, 30) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $GUI_EVENT_PRIMARYDOWN ; Get mouse position $aMousePos = MouseGetPos() ; Save coordinates FileWriteLine($hFile, $aMousePos[0] & "x" & $aMousePos[1] & @CRLF) Case $cPlayback ; Close file for writing FileClose($hFile) ; Open file for reading $hFile = FileOpen($sFileName, $FO_READ) While 1 ; Read each line in turn $sLine = FileReadLine($hFile) ; Stop at EOF If @Error Then ExitLoop ; Read coordinates from line $aCoords = StringSplit($sLine, "x") ; Move mouse to that position MouseMove($aCoords[1], $aCoords[2]) ; Wait a moment Sleep(500) WEnd EndSwitch WEnd Please ask if you have any questions. 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 Link to comment Share on other sites More sharing options...
Asuramaru Posted March 3, 2016 Author Share Posted March 3, 2016 I did what i need already xd I used iniwrite and iniread, thanks for helping me! If need can close topic 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