Jump to content

Saving multiple explorer folder sizes and positions on Windows 10 desktop - (Moved)

Recommended Posts

I have only just been able to test my AutoIt solution on the actual computer it needs to be run on, and only the first folder is opened when the compiled executable is run. On my laptop, the example folders I set up worked fine. I have checked the folder definitions in the text file I use, and they are all correct.

I suspect this problem is because I might need to set the codepage to be 1252 for the folder definitions text file, because when I originally just had the folders opening using a simple .bat file that ran explorer for each folder, some of the folders didn't open due to the use of em dashes in the folder names. A combination of the codepage settings and ANSI encoding on the .bat file got that half-solution working. Unfortunately, I have no control over the folder names on the network drive, and so am unable to rename them and I suspect that is the problem I need to fix.

If it isn't codepage that is causing the problem, then I'm not sure where else to look.

Link to post
Share on other sites
Posted (edited)

Hmm. I highly doubt that you need to change your code page to 1252.  I am currently under code page 850 without problem using many french characters in my folder names.  Since you have not put any error handling nor any logging, it is hard for you (and moreover for us) to determine what is the source of the issue.  Like I told you before, put some ConsoleWrite (or FileWrite if not in Scite) in your code to know what is going on.  Check return values and @error after each statement.  Use FileExists to make sure the folder is accessible to the script (and user).

The more information you can gather, the more efficient will be your debug effort...

ps.  Check Debug UDF.  It will facilitate your effort.

Edited by Nine
Link to post
Share on other sites
  • 1 month later...

Not been able to look at this for a while, but I have tried reading up on the whole debug topic in Autoit and so much of it makes no sense to me at all, that I don't even know where to start. It seems that it's people who don't understand programming too well who could do with the debug info to see what's going on, yet to use it you need to be a competent programmer/experienced user in AutoIt....

So, to recap - the code below works fine on a local laptop using local networked folder locations, but in situ (at work) it displays the first networked folder and then AutoIt 'pauses' and it fails to open any other folders. if I specify non-networked drives in my text file then the folders all open fine using the very same compiled exe program on the very same work computer. Really frustrating!!

#cs ----------------------------------------------------------------------------

 AutoIt Version:
 Author:         myName

 Script Function:
    Template AutoIt script.

#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here
; OU DIP folders v2 22/06/2022

#include <Debug.au3>
#include <File.au3>
Local $aFolder

_FileReadToArray ("C:.\folders1.txt", $aFolder, Default, "|")
If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Error", "File read failed on error " & @error)
For $i = 1 to $aFolder[0][0]
   If WinExists("[TITLE:" & $aFolder[$i][0] & "; CLASS:CabinetWClass;]") Then
;      WinActivate($aFolder[$i][0])
;      WinMove("[CLASS:CabinetWClass]", "",$aFolder[$i][1],$aFolder[$i][2],$aFolder[$i][3],$aFolder[$i][4])
      Run("explorer.exe " & $aFolder[$i][0])
      WinWait("[CLASS:CabinetWClass]", "", $aFolder[$i][5])
      WinMove("[CLASS:CabinetWClass]", "", $aFolder[$i][1],$aFolder[$i][2],$aFolder[$i][3],$aFolder[$i][4])
      Send("^!" & $aFolder[$i][6])

Oh, the text file that defines the windows also only works if I add a \ to the end of the path of the networked drive within that file, so folders1.txt contains multiple entries similar to this:

\\network-folder1\test forms\|1684|8|228|300|2|5

So, I am none the wiser as to why it isn't working beyond the first folder it opens up.


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...