J03Z Posted March 23, 2010 Share Posted March 23, 2010 (edited) I am writting a script that gives you the ability to select what programs you want to run on startup and saves that information to a text file. When the application is re-opened it remembers the saved programs. Im looking for a way to capture the window information for each program saved and save the window cordinates and size to like an .ini file and recall that information so that the next time the programs are opened they will go to the position saved in the .ini file I read the help file and I was thinking more along the lines of Func _SavePos() $winCords = WinGetPos("Name") IniWrite ("filename", "section", "key", "value") EndFunc I just want a clarification on whether im going down the right path in terms of thinking this out. Any help would be greatly appreciated. Edited March 23, 2010 by J03Z Link to comment Share on other sites More sharing options...
PsaltyDS Posted March 23, 2010 Share Posted March 23, 2010 You could use _WinAPI_GetWindowPlacement() to get the Min/Max/Normal placement for the window, and then reset it with _WinAPI_SetWindowPlacement(). 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 Link to comment Share on other sites More sharing options...
Fulano Posted March 23, 2010 Share Posted March 23, 2010 (edited) Very close, something like this might work (note: not tested or debugged)Func _SavePos($winName, $iniFileName) Local $winData = WinGetPos($winName) If Not IniWriteSection ($iniFileName, $winName, _ "X=" & $winData[0] & @LF & _ "Y=" & $winData[1] & @LF & _ "W=" & $winData[2] & @LF & _ "H=" & $winData[3]) And @error Then _SomeAlertFunction ("Invalid data passed to IniWrite for " & $winName") EndFunc Edit: forgot to mention _SomeAlertFunction would be replaced by your favorite way of letting yourself know when something has gone wrong (ie: ConsoleWrite, MsgBox, a log file, etc) Edited March 23, 2010 by Fulano #fgpkerw4kcmnq2mns1ax7ilndopen (Q, $0); while ($l = <Q>){if ($l =~ m/^#.*/){$l =~ tr/a-z1-9#/Huh, Junketeer's Alternate Pro Ace /; print $l;}}close (Q);[code] tag ninja! Link to comment Share on other sites More sharing options...
J03Z Posted March 23, 2010 Author Share Posted March 23, 2010 I'll take this usefull information into consideration when I finnish working on this today. Any way to get the window handles from the applications launched to use them in the functions you guys specified. It may be like 7 or 8 programs launched depending on the user preference. Whats the best method to get the handles or window titles for the programs saved in the data file. Im pretty sure I will be using a for loop to count items in the file but i am unsure about obtaining handles/names. Thanks Guys, Link to comment Share on other sites More sharing options...
martin Posted March 24, 2010 Share Posted March 24, 2010 I'll take this usefull information into consideration when I finnish working on this today. Any way to get the window handles from the applications launched to use them in the functions you guys specified.It may be like 7 or 8 programs launched depending on the user preference. Whats the best method to get the handles or window titles for the programs saved in the data file. Im pretty sure I will be using a for loop to count items in the file but i am unsure about obtaining handles/names.Thanks Guys,You can use WinGetHandle, but if this is for restarting the programs it won't help you because the handle is allocated when the window is created and will be different each time.Maybe you want the process so you can start the program again? If so you can use WinGetProcess to get the process ID, and ProcessList to get a list of all the process name and IDs. Then loop through the list to find the one that matches the process ID for the window.To get the full path so you can start the process again you will need something like this. 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...
J03Z Posted March 25, 2010 Author Share Posted March 25, 2010 Thanks guys, very useful information.. 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