Sign in to follow this  
Followers 0
MeepZero

Newbie attempting to access user profile and editing properties, could use some pointers

4 posts in this topic

My goal is to create a script that will take the individual folders living in the currently logged in user profile and change the location fields to another source. Doing this by hand creates additional folders that Windows leaves behind in the remapping process, so I need to delete the folders that are left behind.

The first problem I am running into is how to operate the macro for @UserProfileDir, I'm running something like this...

ShellExecute("","@UserProfileDir","","OPEN")

This pulls up the current user's My Docs folder instead of the parent folder. Is there another way to get to the location I am trying to access?

Secondly, is there a better way to access the properties box for each of these files? I was going to go in the direction of mapping out mouse and keyboard commands to right click the icons and pull up their properties, but that sounds kinda...sloppy. Is there a command that I can run that pulls up that properties box?

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Hi, MeepZero, welcome to the forum. Macros exist outside quotation marks, so you would do something like this to open the user's profile:

ShellExecute(@UserProfileDir)

Regarding changing folders, I would suggest taking a look at DirMove in the help file, or the Registry functions in the help file if you're looking to change what directory these folders point to by default. Take some time to try some things out, and definitely come back if you get stuck :)

Edited by JLogan3o13

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

I don't think DIRMOVE will do what I want. And digging around in the registry looks like its going to create a big headache for modifying what I wnat. So I've been poking around with this some more and found something that might help me along with what I'm trying to accomplish.

Global Const $SHOP_PRINTERNAME=1 ; $sObjName = printer friendly name
Global Const $SHOP_FILEPATH=2 ; $sObjName = full pathname to file
Global Const $SHOP_VOLUMEGUID=4 ; $sObjName = Drive Path ("C:") or Volume GUID ("?Volume{2eca078d-5cbc-43d3-aff8-7e8511f60d0e})")

Func _FilePropertiesDialog($sObjName,$sPropPage="",$iObjType=0x02,$hWnd=0)
Local $sPropPageType="ptr"
If IsString($sPropPage) And $sPropPage<>"" Then
$sPropPageType="wstr"
Else
$sPropPage=0
EndIf
Local $aRet=DllCall("shell32.dll","bool","SHObjectProperties","hwnd",$hWnd,"dword",$iObjType,"wstr",$sObjName,$sPropPageType,$sPropPage)
If @error Then Return SetError(2,@error,False)
If Not $aRet[0] Then Return SetError(3,0,False)
Return True
EndFunc

_FilePropertiesDialog(@UserProfileDir & "My Pictures","Location",2) ; File
ConsoleWrite("@error="&@error&", @extended="&@extended&@CRLF)
Sleep(5000)

(Found the function at )

If you look at the 4th line from the bottom, I'm trying to invoke a folder inside the user profile to pop up the properties box at the Location tab. Is my syntax incorrect here? I can't seem to get it to actually open what I want it to open.

Share this post


Link to post
Share on other sites

I've figured out that my syntax is correct in those last few lines there...

_FilePropertiesDialog(@UserProfileDir & "My Pictures","Location",2) ; File

I did this by creating another folder at this location (named "test 1") and then pointed the script to it. It worked! So the new problem is why can't I pull up a properties dialogue box on the other items that are in this folder by default. Anyone know a way to pull properties for items in the user profile folder?

Share this post


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
Sign in to follow this  
Followers 0