Posts: 1,000
Threads: 253
Joined: Feb 2008
I would like to have QM export it's entire current open project with one click of a button.
Right now I have to create a folder and then move every function, macro, folders, etc into that folder. Then export that folder. Moving files around in QM is very tedious...and I have to do it one by one...unless I missed something?
Usually from there I upload that file to an email composed to myself so I can easily access it from other computers.
It would be nice if I could just click a button that would export everything in my current QM straight to my default email account, or even a different specified account if I am sharing QM files with other people.
It would be helpful to export everything including the system folder because sometimes I make changes there or add in variations on existing functions. When the file is exported, I would like to have the "Open" option enabled. I often use multiple QM files to and open them so I can keep cross clutter down from multiple projects.
Thanks,
Jimmy Vig
Posts: 12,095
Threads: 142
Joined: Dec 2002
Macro Email qm files
str my_qml system_qml files tzip
rget my_qml "file" "software\gindi\qm2\settings"
system_qml="$qm$\system.qml"
;save qml and wait while saving
men 2003 _hwndqm ;;Save All Now
0.1
;g1
__HFile f.Create(my_qml OPEN_EXISTING)
err 0.1; goto g1
f.Close
files.from(my_qml "[]" system_qml)
tzip.from("$temp$\" _s.getfilename(my_qml) ".zip")
zip tzip files
SendMail "[email protected]" "" "" 0 tzip
Posts: 1,000
Threads: 253
Joined: Feb 2008
Absolutely perfect Gintaras!
Now I would like to add some stuff that I'm thinking about. What different pieces of information can you get from a qm file with QM?
Like can you get the number of functions...the names of functions? Or anything else?
I was just thinking about populating a the body of the email with information about the qm file so I can use searches in my email to find and organize QM files.
Thanks,
Jimmy Vig
Posts: 12,095
Threads: 142
Joined: Dec 2002
Function GetQmItemNames
;/
function $folder str&s [flags] ;;flags: currently not used
;Gets list of QM items in a QM folder and subfolders.
;Folders named "private" and "System" are excluded.
;folder - folder name or path ("\folder1\folder2"). Use "" to include all macros.
;s - variable that receives the list.
type __GQIN_DATA str*sp str'st level flags htv
__GQIN_DATA d.sp=&s
d.flags=flags
d.htv=id(2202 _hwndqm)
s.len=0
EnumQmFolder folder 1 &GQIN_Enum &d
Function GQIN_Enum
;/
function# iid QMITEM&q level __GQIN_DATA&d
int i r f=q.itype=5
;skip some folders
if(f)
,sel(q.name) case ["private","System"] r=1; goto g1
,if(!SendMessage(d.htv TVM_GETNEXTITEM TVGN_CHILD q.htvi)) r=1; goto g1
d.st.all(level 2 '.') ;;indentation
if(f) d.sp.formata("%s[%s][]" d.st q.name)
else d.sp.formata("%s%s[]" d.st q.name)
;g1
d.level=level
ret r
example
Macro Macro1288
out
str s
GetQmItemNames "" s
out s
Posts: 1,000
Threads: 253
Joined: Feb 2008
Wow...again absolutely beautiful.
Function QM_Export
ARRAY(str) QMfunctions
QMITEM q; int i
rep
,i=qmitem(-i 2 &q 1|16|128)
,if(i=0) break
,str date=q.datemod
,str name=q.name
,_s.format("%-30s %-30s" date name)
,QMfunctions[]=_s
out QMfunctions
Anyway you could tag the datemod at the end of your example. I can't figure out how the nitty gritty works for yours. I got it to work in mine, but I like how yours has the folder names in brackets and the level indicated by dots.
Thanks bunches,
jimmy Vig
Posts: 12,095
Threads: 142
Joined: Dec 2002
Your code is faster.
Macro Macro1293
out
ARRAY(str) QMfunctions
QMITEM q; int i j f
rep
,i=qmitem(-i 2 &q 1|16|128)
,if(i=0) break
,str date=q.datemod
,str name=q.name
,f=q.itype=5
,
,;indentation
,for(j 0 1000000000) if(!q.folderid or !qmitem(q.folderid 0 q 16)) break
,str si.all(j 2 '.')
,
,if(f) _s.format("%-30s %s[%s]" date si name)
,else _s.format("%-30s %s%s" date si name)
,QMfunctions[]=_s
out QMfunctions
Posts: 1,000
Threads: 253
Joined: Feb 2008
Here's what I've got worked up...works just how I want it to now. Thanks Gintaras!
Function QM_Export
Trigger @11
str email="[email protected]";;enter recieving email address
str my_qml system_qml files tzip subject body
rget my_qml "file" "software\gindi\qm2\settings"
system_qml="$qm$\system.qml"
;save qml and wait while saving
men 2003 _hwndqm ;;Save All Now
0.1
;g1
__HFile f.Create(my_qml OPEN_EXISTING)
err 0.1; goto g1
f.Close
files.from(my_qml "[]" system_qml)
tzip.from("$temp$\" _s.getfilename(my_qml) ".zip")
zip tzip files
_s=my_qml
_s.getfilename
subject.timeformat("{D} {TT}")
subject.from(_s " " subject)
ARRAY(str) QMfunctions
QMITEM q; int i j k
rep
,i=qmitem(-i 2 &q 1|16|128)
,if(i=0) break
,str date=q.datemod
,str name=q.name
,k=q.itype=5
,
,;indentation
,for(j 0 1000000000) if(!q.folderid or !qmitem(q.folderid 0 q 16)) break
,str si.all(j 2 '.')
,
,if(k) _s.format("[%s%s]" si name)
,else _s.format(" %-30s %s%s" date si name)
,QMfunctions[]=_s
body=QMfunctions
SendMail email subject body 0 tzip
Posts: 12,095
Threads: 142
Joined: Dec 2002
QM item/folder structure will be incorrect after adding new items.
Better use GetQmItemNames.
|