akorx Posted February 5, 2014 Share Posted February 5, 2014 (edited) Hi guys, I've got a little problem, and perhaps a big if I don't find a solution ! At work we have to change ours screen's settings to use big resolution but one of our application runs very bad if we don't use a resolution of 1024x768. I've tried to find a way on google but I've found nothing. So I've decided to create a little autoit script that will load this program in a windows (that has got the good size) but I don't know where I should start... perhaps use GUIcreate() ? Have you got an idea ? The best way should be something like that : loader.exe -w 1024 -h 768 "my program" PS : - computer are one Windows XP SP3 and I've to do this on 300 computers. - sorry for my bad english, I hope you will understand my query. Edited February 10, 2014 by akorx AkorxMail akorx@yahoo.fr Link to comment Share on other sites More sharing options...
somdcomputerguy Posted February 5, 2014 Share Posted February 5, 2014 This function may do it for you - http://www.autoitscript.com/autoit3/docs/functions/WinMove.htm - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change. Link to comment Share on other sites More sharing options...
akorx Posted February 5, 2014 Author Share Posted February 5, 2014 (edited) Thx for your somdcomputerguy but I think that WinMove() function is to "light" because it won't forbid a resize by the user... I think a good way is to do something like that : expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $prg='c:\Program Files\InfraRecorder\InfraRecorder.exe' $hGUI = GUICreate("Loader", 1024, 768, 5, 5 ,BitOR($WS_SYSMENU,$WS_CLIPCHILDREN)) GUISetState(@SW_SHOW) $pid=Run($prg,"",@SW_HIDE) Sleep(1000) While ProcessExists($pid) = 0 Sleep(100) WEnd $title=_WinGetByPID($pid,1) ;msgbox(4096,"DEBUG",$title) ;Exit WinWaitActive($title) $hPRG= WinGetHandle($title) _SetParent($hPRG, $hGUI) WinSetState($hPRG, "", @SW_SHOWMAXIMIZED) Do Sleep(10) Until GuiGetMsg() =-3 Func _SetParent($id_child, $h_parent) If Not IsHWnd($h_parent) Then $h_parent = HWnd($h_parent) If Not IsHWnd($id_child) Then $id_child = GUICtrlGetHandle($id_child) If DllCall("user32.dll", "hwnd", "SetParent", "hwnd", $id_child, "hwnd", $h_parent) <> 0 Then Return 1 Else seterror(1) Return 0 EndIf EndFunc Func _WinGetByPID($iPID, $iArray = 1) ; 0 Will Return 1 Base Array & 1 Will Return The First Window. Local $aError[1] = [0], $aWinList, $sReturn If IsString($iPID) Then $iPID = ProcessExists($iPID) EndIf $aWinList = WinList() For $A = 1 To $aWinList[0][0] If WinGetProcess($aWinList[$A][1]) = $iPID And BitAND(WinGetState($aWinList[$A][1]), 2) Then If $iArray Then Return $aWinList[$A][1] EndIf $sReturn &= $aWinList[$A][1] & Chr(1) EndIf Next If $sReturn Then Return StringSplit(StringTrimRight($sReturn, 1), Chr(1)) EndIf Return SetError(1, 0, $aError) EndFunc ;==>_WinGetByPID 1- This is a first step and just with infrarecorder.exe... now the next step is to delete this : Sleep(1000) While ProcessExists($pid) = 0 Sleep(100) WEnd ... because I don't know how many time will take infrarecorder to start completely and perhaps it will never start so I must integrate à timeout. 2- There will be a big bug if the program called (here infrarecorder) opens a second window just after the start (for example if it ask for a password or if it gives tips at startup), because the name of the windows given by $title won't be the good one ! It must the PARENT windows ! perpahs with _WinAPI_GetAncestor() ? How can I do ? 3- The last step will to use $cmdline to give in arguments the size of the window and the name of the program that must be called, like this : loader.exe -w 1024 -h 768 "my program". But there will have a problem with ProcessWait() if there is 2 instances of the program (example we have load infrarecorder twice) how will I do ? Edited February 6, 2014 by akorx AkorxMail akorx@yahoo.fr Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted February 5, 2014 Moderators Share Posted February 5, 2014 akorx, you posted this in the Examples forum - you know, the one that states THIS IS NOT A GENERAL SUPPORT FORUM at the top?? Might be wise to ask a Mod to move the post to the correct forum, and be aware of where you're posting in the future. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
akorx Posted February 5, 2014 Author Share Posted February 5, 2014 I understand MVPs, but if my script works, it will become an example, so it's the reason why I've choiced to publish my question here... that's not a good choice ? AkorxMail akorx@yahoo.fr Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted February 5, 2014 Moderators Share Posted February 5, 2014 This forum is for people who would like to show their work as an Example, not for someone who is asking for help to get it to work, so it can someday become an example...If you need help with the script, which it appears you do, we are happy to assist. But you will get more eyes on the subject if you post in the right spot. Once you get the bugs worked out, you're more than welcome to post the working script here as an example to others. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
akorx Posted February 5, 2014 Author Share Posted February 5, 2014 Ok I've understood ! who can help me to move it in the good place ? AkorxMail akorx@yahoo.fr Link to comment Share on other sites More sharing options...
akorx Posted February 6, 2014 Author Share Posted February 6, 2014 (edited) I've send a message to "contact" to move this post is the good forum. Now, I'm waiting for a solution for my 3 questions (points "1-" , "2-" and "3-") , who can help me ? Edited February 6, 2014 by akorx AkorxMail akorx@yahoo.fr Link to comment Share on other sites More sharing options...
akorx Posted February 6, 2014 Author Share Posted February 6, 2014 Developpers, I need your help ! I put some beers in the fridge for the winner... He must come to France to take them ! AkorxMail akorx@yahoo.fr Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 6, 2014 Moderators Share Posted February 6, 2014 akorx,Please do not bump your own threads within 24 hours. Remember that this is not a 24/7 support forum - those who answer are only here because they like helping others and have some time to spare. Although the problem might be urgent to you, it is not to anyone else. You just have to wait until someone who knows something about your particular problem, and is willing to help, comes online. Be patient and someone will answer eventually. 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...
akorx Posted February 10, 2014 Author Share Posted February 10, 2014 Hi, I've send a message to admins to close this topic and re opened one in the good place here : '?do=embed' frameborder='0' data-embedContent>> AkorxMail akorx@yahoo.fr 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