For example I have this simple dialog:
Code: Select all
Dialog>Dialog1
Caption=File Name
Width=370
Height=114
Top=CENTER
Left=CENTER
Edit=msEdit1,16,29,321,
EndDialog>Dialog1
Show>Dialog1,res1
Moderators: JRL, Dorian (MJT support)
Code: Select all
Dialog>Dialog1
Caption=File Name
Width=370
Height=114
Top=CENTER
Left=CENTER
Edit=msEdit1,16,29,321,
EndDialog>Dialog1
Show>Dialog1,res1
Code: Select all
Dialog>Dialog1
Caption=File Name
Width=450
Height=114
Top=CENTER
Left=CENTER
Button=Browse,350,24,65,25,0
Edit=msEdit1,16,29,321,
FileBrowse=Browse,msEdit1,|*.*|,open
EndDialog>Dialog1
Show>Dialog1,res1
Code: Select all
FileBrowse=Browse,msEdit1,|*.*|,open,dir,C:\Myuser\CurrentFolder\*.*
How do you propose easily getting the directory. If I had the directory I could append the file name on to it and I have a workable solution.Gale wrote:It is easy to get the Windows Explorer current directory.
Code: Select all
//constants
Let>GWL_EXSTYLE=-20
Let>WS_EX_LAYERED=524288
Let>LWA_ALPHA=2
//opacity
Let>byteOpacity=1
//run notepad and get its handle
Let>RP_WINDOWMODE=0
Run>notepad.exe
WaitWindowOpen>notepad*
MoveWindow>notepad*,-100000,0
SetFocus>NotePad*
GetActiveWindow>TestTitle,NotePadX,NotePadY,NotePadW,NotePadH
GetWindowHandle>notepad*,nphwnd
//get style attributes of notepad's window
LibFunc>user32,GetWindowLongA,attribs,nphwnd,GWL_EXSTYLE
Let>attribs={%attribs% OR %WS_EX_LAYERED%}
//make notepad transparent
LibFunc>user32,SetWindowLongA,swl,nphwnd,GWL_EXSTYLE,attribs
LibFunc>user32,SetLayeredWindowAttributes,res,nphwnd,0,byteOpacity,LWA_ALPHA
Let>DialogTitle=Drag Icon to this Window
Let>DialogWidth=445
Let>DialogHeight=100
Dialog>Dialog1
Caption=%DialogTitle%
Width=%DialogWidth%
Height=%DialogHeight%
Top=CENTER
Left=CENTER
resize=0
Edit=msEdit1,47,32,338,
EndDialog>Dialog1
Show>dialog1
Label>GetInfoLoop
Let>WIN_USEHANDLE=1
GetWindowPos>dialog1.handle,DialogX,DialogY
MoveWindow>nphwnd,DialogX,DialogY
ResizeWindow>nphwnd,%DialogWidth%,%DialogHeight%
Wait>0.01
setfocus>nphwnd
Let>WIN_USEHANDLE=0
GetActiveWindow>dialog1.msedit1,winX,winY
If>%dialog1.msedit1%=%TestTitle%
Goto>GetInfoLoop
EndIf
StringReplace>dialog1.msedit1, - Notepad,,dialog1.msedit1
ResetDialogAction>dialog1
Let>WIN_USEHANDLE=1
MoveWindow>nphwnd,NotePadX,NotePadY
ResizeWindow>nphwnd,NotePadW,NotePadH
CloseWindow>nphwnd
Label>Loop
GetDialogAction>dialog1,res1
If>res1=2
Exit>0
EndIf
Wait>0.1
Goto>Loop
Code: Select all
// Setup:
// 1) assign a Hot Key in Macro Scheduler to trigger this macro, I used F11
// 2) open Windows Explorer and select the desired file
// 3) use the Hot Key to run this macro
Let>STEP_DELAY=20
//open File menu
Press ALT
Send>f
Release ALT
//activate Rename
Send>m
//copy filename to Windows clipboard
Press CTRL
Send>c
Release CTRL
//load filename from clipboard
GetClipBoard>filename
//set focus on Address field and highlight current directory path
Press ALT
Send>d
Release ALT
//copy path to Windows clipboard
Press CTRL
Send>c
Release CTRL
//load initialdir from clipboard
GetClipBoard>initialdir
Let>full_path=%initialdir%\%filename%
Dialog>Dialog1
Caption=File Name
Width=450
Height=136
Top=CENTER
Left=CENTER
Button=Browse,350,24,65,25,0
Edit=msEdit1,16,29,321,
Button=Process the file,115,68,122,25,3
Button=Exit,350,68,65,25,2
FileBrowse=Browse,msEdit1,|*.*|,open
EndDialog>Dialog1
//show dialog non modal
Show>Dialog1
Wait>1
CloseDialog>Dialog1
Let>Dialog1.msEdit1=%full_path%
ResetDialogAction>Dialog1
Label>MainLoop
//show dialog modal
Show>Dialog1,res1
If>res1=2,End
If>res1=3,Process
Goto>MainLoop
SRT>Process
MDL>full path to that file: %Dialog1.msEdit1%
End>Process
Label>End
Code: Select all
//Click on filename to activate Windows Explorer
//Hold mouse on filename
wait>10
GetCursorPos>nX,nY
LClick
wait>1
//Get Text from Address Bar
GetActiveWindow>strWinTitle,nXPos,nYPos,,
MDL>strWinTitle:%strWinTitle%
SetFocus>%strWinTitle%
wait>1
//This works on Windows XP
SetFocus>%strWinTitle%
GetControlText>%strWinTitle%,ComboBoxEx32,1,strFolder
MDL>strFolder:%strFolder%
//So does thisSetFocus>%strWinTitle%
GetControlText>%strWinTitle%,Edit,1,strFolder
MDL>strFolder:%strFolder%
//Find file, hope user does not obsure it.
//Will need to parse out filename if extra text on line
SetFocus>%strWinTitle%
GetTextAtPoint>%nX%,%nY%,strText,nCharPos
MDL>strText:%strText%