Type the file name after the shell initializes its suggested destination

This commit is contained in:
Codex committed 2026-11-30 18:35:58 +01:00
1 parent 2580039bd4
commit c376fcda95
1 file changed
+11 -2
+11 -2
View File
@@ -102,8 +102,17 @@ try:
field=next((c for c in edits if c[2]==1001),edits[0] if len(edits)==1 else None)
button=next((c for c in children if c[1]=="Button" and c[2]==1),None)
assert field and button, (edits,button)
name=ctypes.create_unicode_buffer(str(filename))
assert user.SendMessageW(field[0],12,0,ctypes.addressof(name))
def entered_name():
value=ctypes.create_unicode_buffer(1000)
user.SendMessageW(field[0],13,len(value),ctypes.addressof(value))
return value.value
wait(entered_name,"Shell did not initialize the suggested file name")
print("Suggested",entered_name(),flush=True)
user.SendMessageW(field[0],177,0,-1) # EM_SETSEL
for char in str(filename):
user.SendMessageW(field[0],258,ord(char),1) # WM_CHAR notifies the shell of the edit.
assert entered_name()==str(filename), entered_name()
time.sleep(.4)
assert user.PostMessageW(button[0],245,0,0)
time.sleep(.8)
def saved():