mr-es335 Posted January 31 Posted January 31 (edited) Good day, I have had this "issue" previously...[Click_Me] - and apparently, this issue has returned! Though the solution provided in the earlier posting did resolve [....apparently...anyhow]...the issue at that time, the very same issues is occurring again!! And, "Man!!" "This is really, REALLY...frustrating!!!" Here is the script: ; ----------------------------------------------- Opt("MustDeclareVars", 1) ; ----------------------------------------------- ExitFolder() LaunchFolder() LaunchTxt() ; ----------------------------------------------- Func ExitFolder() Local $sSrcPath = "D:\" Local $iFileExists = FileExists($sSrcPath) ; ----------------------------------------------- If $iFileExists Then WinClose($sSrcPath) EndIf EndFunc ;==>ExitFolder ; ----------------------------------------------- Func LaunchFolder() Local $sSrcPath = "D:\Initial_Prep" ; ----------------------------------------------- ShellExecute($sSrcPath) WinWait($sSrcPath, "") WinMove($sSrcPath, "", 406, 100, 550, 650) EndFunc ;==>LaunchFolder ; ----------------------------------------------- Func LaunchTxt() Local $sSrcPath = "D:\Initial_Prep\Procedure_Initial_Prep.txt" ; ----------------------------------------------- ShellExecute($sSrcPath) WinWait($sSrcPath, "") WinMove($sSrcPath, "", 964, 100, 550, 650) EndFunc ;==>LaunchTxt ; ----------------------------------------------- Observations 1) Employing AutoIt Info, it notes that the title of the text file is "Procedure_Initial_Prep.txt - metapad". 2) However, employing this title, generates and file not found error - and script is left "handing" - I would assume, because the file is NOT found! • Please understand, that "Display the full path in the title bar" IS ENABLED!! 3) As can be observed, the folder view is positioned on the left, whilst the text view is positioned on the right. Interestingly, the folder view is always is positioned correctly...and therefore, it is the text view that I am presently have an issue with. 4) In order to "fix" this anomaly, I have to manually position the text view - via AutoIt Info, and then - for whatever reason, the subsequent text views appear to work as expected. 5) However, up on a logoff or a reboot, the issue re-occurs!! Main Observation The issue appears to be only with the text view and not the folder view!! Two Questions Question #1: "Is there a way-and-means of programmatically positioning these views so that it just works?" Question #2: "Why is AutoIt Info displaying the incorrect Title of the text files?" "Help!!!" Edited January 31 by mr-es335 Updates mr-es335 Sentinel Music Studios
mr-es335 Posted January 31 Author Posted January 31 So, I have done this...from the HelpFile: #include <MsgBoxConstants.au3> Example() Func Example() Local $sFilePath = "D:\Initial_Prep\Procedure_Initial_Prep.txt" Local $iFileExists = FileExists($sFilePath) If $iFileExists Then MsgBox($MB_SYSTEMMODAL, "", "The file exists.") ShellExecute($sFilePath) WinMove($sFilePath, "", 964, 100, 550, 650) Else MsgBox($MB_SYSTEMMODAL, "", "The file doesn't exist.") EndIf EndFunc ;==>Example ...the text file is still not positioned correctly!! mr-es335 Sentinel Music Studios
RichardL Posted January 31 Posted January 31 Hi @mr-es335, Here's part of something I've been using for years (see comment re XP). It opens and positions notepad. I think the main difference is I'm using WinWaitActive, and you have WinWait. ShellExecute("Notepad", $sInf1) $sTitle = $sInf1 & " - Notepad" ; XP $sTitle = $sInf & " - Notepad" ; W7 If WinWaitActive($sTitle, "", 5) Then ; Continue Else $sMsg = StringFormat("Can't find %s.\nCurrent %s.", $sTitle, WinGetTitle("[Active]")) $Ans = MsgBox($MB_OKCANCEL, Default, $sMsg) If $Ans = $IDCANCEL Then Exit EndIf WinMove($sTitle, "", 250, 0, 595, 900)
pixelsearch Posted January 31 Posted January 31 (edited) @mr-es335 hello Did you try to use 2 different variables, the 1st one for ShellExecute, the 2nd one for WinWait/WinMove ? 1) ShellExecute => "D:\Initial_Prep\Procedure_Initial_Prep.txt" 2) WinWait/WinMove => "D:\Initial_Prep\Procedure_Initial_Prep.txt - metapad" (or is it Metapad with a capital M ?) For this reason, you should also use the following Opt() so the match will be Case insensitive (have a loop at Opt in the help file) Opt("WinTitleMatchMode", -2) ;1=start, 2=subStr, 3=exact, 4=advanced, -1 to -4=Nocase Hope it helps Edit: I'm using often Opt("WinTitleMatchMode", -2) but in your case you could also use -1 Edited January 31 by pixelsearch "I think you are searching a bug where there is no bug... don't listen to bad advice."
mr-es335 Posted January 31 Author Posted January 31 There are two users, "Dell" and "RML_User"...have a peep: Even both user have the "Display full path..." enabled, the full path is NOWT being displayed with RML_User?!? I have been unable - thus far, to rectify this situation!! Any ideas? mr-es335 Sentinel Music Studios
pixelsearch Posted January 31 Posted January 31 I read "Classic theme only" in your pic, maybe both users don't have the Classic Theme ? Anyway, if you want your script to run, no matter the user, just match the window title for WinWait/WinMove with the following substring : "Procedure_Initial_Prep.txt - metapad" or "Procedure_Initial_Prep.txt" Just add the following line at the beginning of your script and you're done : Opt("WinTitleMatchMode", -2) ; 2 = match on substring , minus sign for a non-sensitive title match Good luck "I think you are searching a bug where there is no bug... don't listen to bad advice."
mr-es335 Posted January 31 Author Posted January 31 What I am getting regardless...is "Windows cannot find the text file...." error! mr-es335 Sentinel Music Studios
pixelsearch Posted January 31 Posted January 31 After creating the mandatory folder & file, the following script works fine on my computer with a correct display. Does it work correctly on yours ? ; ----------------------------------------------- Opt("MustDeclareVars", 1) Opt("WinTitleMatchMode", -2) ; 2 = match on substring , minus sign for a non-sensitive title match ; ----------------------------------------------- ExitFolder() LaunchFolder() LaunchTxt() ; ----------------------------------------------- Func ExitFolder() Local $sSrcPath = "D:\" Local $iFileExists = FileExists($sSrcPath) ; ----------------------------------------------- If $iFileExists Then WinClose($sSrcPath) ; close what ? EndIf EndFunc ;==>ExitFolder ; ----------------------------------------------- Func LaunchFolder() Local $sSrcPath = "D:\Initial_Prep" ; ----------------------------------------------- ShellExecute($sSrcPath) WinWait($sSrcPath, "") WinMove($sSrcPath, "", 406, 100, 550, 650) EndFunc ;==>LaunchFolder ; ----------------------------------------------- Func LaunchTxt() Local $sSrcPath = "D:\Initial_Prep\Procedure_Initial_Prep.txt" Local $sWinName = "Procedure_Initial_Prep.txt" ; ----------------------------------------------- ShellExecute($sSrcPath) WinWait($sWinName, "") WinMove($sWinName, "", 964, 100, 550, 650) EndFunc ;==>LaunchTxt ; ----------------------------------------------- "I think you are searching a bug where there is no bug... don't listen to bad advice."
mr-es335 Posted January 31 Author Posted January 31 (edited) The folder and text launch...but the text is not positioned correctly!! What of the above images? Edited January 31 by mr-es335 mr-es335 Sentinel Music Studios
pixelsearch Posted January 31 Posted January 31 (edited) Do you mean both windows are horizontally aligned correctly, but the text is not positioned correctly inside the metapad window ? Maybe you should provide a pic of the display, in case a user got an idea why it happens (DPI settings or something else...) Edited January 31 by pixelsearch "I think you are searching a bug where there is no bug... don't listen to bad advice."
mr-es335 Posted January 31 Author Posted January 31 (edited) Only the folder view is positioned correctly. The text view will be positioned wherever that view was last moved....thus the WInMove command is not working at all!! Look at the path in the text Windows Title Bar!! Edited January 31 by mr-es335 mr-es335 Sentinel Music Studios
pixelsearch Posted January 31 Posted January 31 l 6 minutes ago, mr-es335 said: The text view will be positioned wherever that view was last moved.... This is a normal behavior : if you close NotePad (or your metapad) at a certain position, then when you open it again, its window will be placed at the same position where it was last closed. Apart from that, if you resize its window manually, then close it again, it will remember the last position where it was closed etc... But that doesn't explain the behavior you describe : WinMove should (on your computer) do its job and place the text window at the right coords found in the script. I just did a test on my computer, e.g. resizing the text window before closing it, then when I run the script again, the text window appears 1ms at the position where it was last closed, but WinMove does immediately its job by moving the text window correctly at the coords found in the script, for the following result (smaller coords in my script, no big deal) and a perfect horizontal alignment : So I really don't know why it doesn't work for you, let's hope a reader will be able to help (maybe a DPI setting or something else...) "I think you are searching a bug where there is no bug... don't listen to bad advice."
pixelsearch Posted January 31 Posted January 31 (edited) 1 hour ago, mr-es335 said: Look at the path in the text Windows Title Bar!! Well you got some choices to do on your computer : 1) By default, open text files with Notepad or metapad ? 2) Why is the extension .txt not visible on your Notepad ? If you look at the pic in my preceding post, it shows clearly the extension ".txt" visible on my Notepad ! IIRC there is a setting in Windows Explorer to "Hide extensions for known file types" but I never checked it since day 1, so any extension for any file appear everywhere on my computer (Windows Explorer, Notepad etc...) If I check it temporarily (just to mimic the title of your NotePad) then this is what happens, which is bad for me because the extension ".txt" just vanished : In case you uncheck this setting, then the window title in your NotePad will show the ".txt" extension and the script should work, at last ! Anyway, all this should be easy to solve, depending on the program you use by default to open your text files (Notepad or metapad) and the fact that the extension ".txt" doesn't show on your Notepad... unless you remove the check from "Hide extensions for known file types" in Windows Explorer Edit: if you don't want to remove the check from "Hide extensions for known file types", then just use this line in the script, it should do it in all cases : ; Local $sWinName = "Procedure_Initial_Prep.txt" Local $sWinName = "Procedure_Initial_Prep" Edited January 31 by pixelsearch "I think you are searching a bug where there is no bug... don't listen to bad advice."
ioa747 Posted January 31 Posted January 31 (edited) 4 hours ago, mr-es335 said: Even both user have the "Display full path..." enabled, the full path is NOWT being displayed with RML_User?!? this setting is for windows of file explorer. For the metapad, you will go to the settings in the metapad. make this procedure for both user Dell, RML_User metapad>options>settings If you want the fullpath in title to be visible, uncheck the check box that says hide directory in caption. also make sure the checkbox that says save window placements is checked, since you had an issue with that too then go to the advance tab and make sure the checkbox that says use fixed windows position is unchecked I would like to know if the metapad is your choice or it's just up to you. Edit: I tested the @pixelsearch script and it works as expected. Edited January 31 by ioa747 I know that I know nothing
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