Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Create a special folder
#1
I am wondering whether a QM user can create a special folder?
#2
File folder?
Or like new System folder in QM items list. It is not possible.

To change special file folder path use SHSetFolderPath.

Macro
Code:
Copy      Help
dll shell32 [232]#SHSetFolderPathW csidl hToken dwFlags @*pszPath

;show current "$my pictures$" path and remember it
out _s.expandpath("$my pictures$") ;;current
str savymypict.expandpath("$my pictures$")

;create new folder and set it as "$my pictures$"
str f.expandpath("$desktop$\My Pictures2")
mkdir f
SHSetFolderPathW CSIDL_MYPICTURES 0 0 @f
out _s.expandpath("$my pictures$") ;;changed

;restore
SHSetFolderPathW CSIDL_MYPICTURES 0 0 @savymypict
out _s.expandpath("$my pictures$") ;;restored

;CSIDL constants are in MSDN library.
;Also read about SHSetFolderPath there.
#3
Dear Gintaras,

Many thanks for a very prompt reply. Yes, I mean a file folder and your example code was extremely clear and helpful.

Best regards
#4
When I run this macro I get

Error:
Error in c:\program files\quick macros 2\winapi.txt: function not found

dll shell32 [SHSetFolderPathA]#SHSetFolderPath csidl hToken dwFlags $pszPath

I am using QM 3.2.0.8

Why am I getting this error?
#5
The function on older OS is not exported by name, only by ordinal. I changed the code.
#6
Is this because I am an i386 emulator?
#7
It depends on Windows version. On Vista the function is exported by name, on some other OS - only by ordinal.

in
dll shell32 [232]#SHSetFolderPathW csidl hToken dwFlags @*pszPath
232 is ordinal.
#8
Dear Gintaras,

I understand that there exists a QM special folder named $Drive$. My question is : Is it likely that this special folder is used somewhere internally, something that I cannot detect? The reason of this question is that I need for my applications a special folder and I intend to change special file folder $Drive$ path using SHSetFolderPath.

Many thanks, Best regards.
#9
$Drive$ cannot be changed with SHSetFolderPath. It is QM-specific, like $qm$, $my qm$ and $temp qm$.

Quote:I need for my applications a special folder
Use environment variables.
SetEnvVar "aSpecFolder" "Z:\path"
_s.getfile("%aSpecFolder%\file.txt")
#10
Many thanks once more!

However, I thought about using a special folder because an environment variable it seeme that it does not unexpand as I though ti would be. I would appreciate it if you comment on the following example :

Function tempf11
Code:
Copy      Help
SetEnvVar "aSpecFolder" "Z:\path"

str s="Z:\path\tam.txt"
_s.expandpath(s 2)
out _s

s="c:\windows\system32\file.exe" ;; s will be "$system$\file.exe".
_s.expandpath(s 2)
out _s

Unless, I do some kind of mistake or misunderstanding.
#11
Can only unexpand to $...$, not to %...%.


Forum Jump:


Users browsing this thread: 1 Guest(s)