Oni_Gabriel Posted January 27, 2021 Share Posted January 27, 2021 Good afternoon everyone, I am from San Jose de Mayo, Uruguay. I started two weeks ago with Autoit but I have already programmed some functional things. Now my question is me in one of the Scrpts I use MouseGetPos () to get the mouse coordinates and I save them in Variables something like this: func posmovimiento() ; seleccionar la posicion del boton teletransportar MsgBox(0, "Selecion de posicion", "Selecciona la posicion inicial del boton Teletrasportar en tu pc y presiona espacio para continuar") $mouse = MouseGetPos() $lockx1 = $mouse[0] $locky1 = $mouse[1] MsgBox(0, "Selecion de posicion", "Selecciona la posicion final del boton Teletrasportar en tu pc y presiona espacio para continuar") $mouse = MouseGetPos() $lockx2 = $mouse[0] $locky2 = $mouse[1] EndFunc Those variables are already declared as global at the beginning of the Script and the moment I do that they change, but when I close the program and reopen it I have to do it again because they return to the initial value of the declaration I gave them. My question is how can I save them in a .txt or .ini file that they are saved and that the next time I open the program, read them from that file? I would like if they were so kind they could guide me a little. Link to comment Share on other sites More sharing options...
Nine Posted January 27, 2021 Share Posted January 27, 2021 Look at documentation and examples in help file under IniRead / IniWrite “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
Oni_Gabriel Posted January 27, 2021 Author Share Posted January 27, 2021 1 minute ago, Nine said: Look at documentation and examples in help file under IniRead / IniWrite im looking your work in the forum you are great im glad why you are the first to aswer me. Maybe i see this IniWrite (@ScriptDir & "\ MyVars.ini", "Variables", "variable_a", $ variable_a) but I don't know how to implement it well Link to comment Share on other sites More sharing options...
Nine Posted January 27, 2021 Share Posted January 27, 2021 Quite simple. Every time you change the value of a variable that you want to keep in the ini file, you use IniWrite. Do that for every variables that you want to keep. “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
Oni_Gabriel Posted January 27, 2021 Author Share Posted January 27, 2021 you can showme some example? i need save the variable but read when i start the program. Link to comment Share on other sites More sharing options...
Nine Posted January 27, 2021 Share Posted January 27, 2021 Examples can be found in Help File under IniRead() “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
Oni_Gabriel Posted January 27, 2021 Author Share Posted January 27, 2021 i can solved but not for the guide. so declare the variables: Global $lockx1 = IniRead(@ScriptDir & "\ variables.ini", "teletransportar", "lockx1", "") Global $locky1 = IniRead(@ScriptDir & "\ variables.ini", "teletransportar", "locky1", "") Global $lockx2 = IniRead(@ScriptDir & "\ variables.ini", "teletransportar", "lockx2", "") Global $locky2 = IniRead(@ScriptDir & "\ variables.ini", "teletransportar", "locky2", "") func posmovimiento() ; seleccionar la posicion del boton teletransportar MsgBox(0, "Selecion de posicion", "Selecciona la posicion inicial del boton Teletrasportar en tu pc y presiona espacio para continuar") $mouse = MouseGetPos() $lockx1 = $mouse[0] $locky1 = $mouse[1] IniWrite (@ScriptDir & "\ variables.ini", "teletransportar", "lockx1", $lockx1) IniWrite (@ScriptDir & "\ variables.ini", "teletransportar", "locky1", $locky1) MsgBox(0, "Selecion de posicion", "Selecciona la posicion final del boton Teletrasportar en tu pc y presiona espacio para continuar") $mouse = MouseGetPos() $lockx2 = $mouse[0] $locky2 = $mouse[1] IniWrite (@ScriptDir & "\ variables.ini", "teletransportar", "lockx2", $lockx2) IniWrite (@ScriptDir & "\ variables.ini", "teletransportar", "locky2", $locky2) EndFunc Thank soo much ! Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 28, 2021 Moderators Share Posted January 28, 2021 Moved to the appropriate forum, as the Developer General Discussion forum very clearly states: Quote General development and scripting discussions. Do not create AutoIt-related topics here, use the AutoIt General Help and Support or AutoIt Technical Discussion forums. Moderation Team 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...
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