Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to make a simple dialog box for an existing script?
#1
Hi, I wrote the script below to change the names of files within a folder:
Code:
Copy      Help
int i
ARRAY(str) a
GetFilesInFolder a "C:\Users\EMERSON\Desktop\test\" ""
a.sort(8)

for i 0 a.len
,str& s1=a[i]
,str s2
,s2=s1
,s2.insert(F"{i+1}_" findcr(s2 '\')+1)
,ren s1 s2

int j
for j 1 (a.len)+1
,str s3 s4 s5
,s3.expandpath("C:\Users\EMERSON\Desktop\test\")
,lpstr filename=dir(F"{s3}{j}_*" ); if(!filename) break
,s4=F"{s3}{filename}"
,s5=F"{s3}{j}.png"
,ren s4 s5
Now I would like to have a small dialog-box with two fields:
1) ENTER THE PATH: (in this particular case it would be: C:\Users\EMERSON\Desktop\test\)
2) ENTER FORMAT: (in this particular case it would be: png)
so that I don't need to open type inside the code anymore.

Thanks in advance for your help

Emerson
#2
Create new dialog. Then add the ShowDialog code from QM output to the macro. Use the variables in the macro.

Function Dialog123
Code:
Copy      Help
;\Dialog_Editor


;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 223 135 "Dialog"
;3 Static 0x54000000 0x0 4 6 28 12 "Path"
;4 Edit 0x54030080 0x200 34 4 186 14 "Path"
;5 Static 0x54000000 0x0 4 24 28 12 "Format"
;6 Edit 0x54030080 0x200 34 22 38 14 "Format"
;1 Button 0x54030001 0x4 120 116 48 14 "OK"
;2 Button 0x54030000 0x4 170 116 48 14 "Cancel"
;END DIALOG
;DIALOG EDITOR: "" 0x2030502 "" "" "" ""
Macro Macro2001
Code:
Copy      Help
str controls = "4 6"
str e4Pat e6For
if(!ShowDialog("Dialog123" 0 &controls)) ret

int i
ARRAY(str) a
GetFilesInFolder a e4Pat ""
;...


Forum Jump:


Users browsing this thread: 1 Guest(s)