Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Dialog Box
#1
We do word processing work, get paid by time and by document generated. We have been trying to be a little bit more sophisticated Big Grin And so QM have helped us so much.

We need to add computer time to our billing and right now is is manually done. Please don't laugh, but I sit here, start the macro, write down the time and file size, when the macro is finished, I do the same and manually use the calculator.

I was hoping you can show me how to use a dialog box that we can incorporate into our existing macros. A simple dialog box with 4 edit controls, showing the time the macro started, number of minutes the macro has been running, the original file size and the ending file size.

Thank you
Denise
#2
Show dialog when macro ends? Why dialog?
#3
Is there another way to do it?

Was hoping to show it while the macro is running.

Tongue

I am open for ideas lol
#4
Can you post the macro? It would be easier to me to choose the best way to show the dialog.
#5
I cleaned it up to make it easier to read. Simple macro really, just searches and replaces many tags:

Code:
Copy      Help
spe
run "c:\clients\drres\1103_ori.txt"
act "1103_ori "
0 WV "1103_ori "

; top of doc
'CH

;begin search and replace
rep
    ;search and replace codes here
    err
        break

; top of doc
'CH

;begin search and replace
rep
    ;search and replace codes here
    err
        break

; top of doc
'CH

;begin search and replace
rep
    ;search and replace codes here
    err
        break

;end of macro
'CH


Thanks so much!
Denise
#6
Function dlg_Denise
Code:
Copy      Help
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages

str controls = "3 4 5 6"
str e3 e4 e5 e6
if(!ShowDialog("dlg_Denise" &dlg_Denise &controls)) ret

;BEGIN DIALOG
;0 "" 0x90C80A44 0x100 0 0 220 132 "Form"
;1 Button 0x54030001 0x4 120 116 48 14 "OK"
;2 Button 0x54030000 0x4 170 116 48 14 "Cancel"
;3 Edit 0x54030800 0x20000 54 2 94 12 ""
;4 Edit 0x54030800 0x20000 54 18 94 12 ""
;5 Edit 0x54030800 0x20000 54 36 94 13 ""
;6 Edit 0x54030800 0x20000 54 52 94 13 ""
;7 Static 0x54000000 0x0 4 2 48 12 "Time started"
;8 Static 0x54000000 0x0 4 18 48 12 "Time running"
;9 Static 0x54000000 0x0 4 36 48 13 "Initial file size"
;10 Static 0x54000000 0x0 4 52 48 13 "File size now"
;11 Static 0x54000000 0x0 4 76 48 13 "Status"
;12 Static 0x54000000 0x0 56 76 48 13 "Running"
;END DIALOG
;DIALOG EDITOR: "" 0x2010901 "" ""


ret
;messages
int-- t_hThread
DATE-- t_date
Dir d
sel message
,case WM_INITDIALOG
,DT_Init(hDlg lParam) ;;not necessary in QM >= 2.1.9
,
,t_hThread=mac("Macro353")
,t_date.getclock
,SetDlgItemText hDlg 3 _s.time(t_date "%H:%M:%S")
,if(d.dir("$desktop$\test.txt" 0)) SetDlgItemInt hDlg 5 d.FileSize 0
,SetTimer hDlg 1 1000 0
,goto info
,
,case WM_TIMER
,sel wParam
,,case 1
,,if(WaitForSingleObject(t_hThread 0)!=258) ;;def WAIT_TIMEOUT 258
,,,SetDlgItemText hDlg 12 "Finished"
,,,KillTimer hDlg 1
,,goto info
,
,case WM_DESTROY DT_DeleteData(hDlg) ;;not necessary in QM >= 2.1.9
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,DT_Ok hDlg ;;not necessary in QM >= 2.1.9
,case IDCANCEL DT_Cancel hDlg ;;not necessary in QM >= 2.1.9
ret 1
;info
DATE d2.getclock
d2=d2-t_date
SetDlgItemText hDlg 4 iif(d2.date _s.time(d2 "%H:%M:%S") "00:00:00")
if(d.dir("$desktop$\test.txt" 0)) SetDlgItemInt hDlg 6 d.FileSize 0

Run this function. It starts macro "Macro353" and displays progress info. You only need to change macro name and file name in this code.
#7
Thank you so much your highness Tongue I will give it a try and let you know.

By the way, I downloaded 2.1.9 to make exe files but read that the command DIS will not work. I use this command to enable/disable functions. Any ideas on a workaround?
#8
dis would not be useful in exe because there are no triggers. Do you want to control QM from exe?
#9
Most of the macros we use have triggers, what are my options to make this work?
#10
Option 1 - create the macro without using triggers. Option 2 - learn Windows programming, and use RegisterHotKey, hooks, winevents, etc. Here in forum are several examples.

Currently I don't have plans to make possible using usual QM triggers in exe.
#11
Hi, Denise. I too, create documents (graphics) by the hour. I used the database access functions to add the a date, time and a short note of what I had done to an Access database everytime I clock in and out. I have 2 hot keys to clock in and out. Once the data is in Access it is easy to create reports showing my hours worked for a given month. It works great. It wouldn't be too hard to add the other fields you need. I would like to add a running total in a toolbar but I can't seem to find the example to do that. I know its on here
Matt B


Forum Jump:


Users browsing this thread: 3 Guest(s)