Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
dialog input box,saving inserted infoto txt
#1
im making a macro which has a myspace/facebook account storer '' a function to store my ids and passes...ive made the dialog....now im stuck in what to do i use to create these functions..ive been playing with the floating toolbar on QM & trying to use the ''files,web'' icon on QM toolbar,sum1 has pointed me to the write or read file,but all i can manage is to create a tx document,write the text and save it....but im lost on how to link the input forms to the txt document for when my id information is entered it re-writes the saved document ''updates'' & saves.

can some please give me some more pointers?or a link to information on QM forum as i cant find any information on what im looking for ....im stuck

i want to save my login details to a txt document that will be saved to lets say my documents or desktop...it also has to be able to update the text document with new submissions.

i need a brain storm of idears please!
Thanks
VεRiTλS
#2
Here is an example using XML...You can incorporate dialogs to write the information. XML is pretty cool! Thanks to G. we can use it in QM now!


.qml   Login to websites.qml (Size: 2.52 KB / Downloads: 467)

Hopefully this works for you!
Jimmy Vig
#3
Thanks for the reply but im not looking for a macro to log me in..i just want to be able to type my email & password into a box and save it to a txt document......and to be able to update the txt document (emails & passwords) every time i enter in new a new email or password.
like...
firstly the mac has to create a folder on the 'desktop' or 'my documents'
secondly when the information is typed in the dialog:email & password it stores the information in a text document in the above directory.
thirdly whenever a new ''email or password''is entered it updates to the list in the directory.
VεRiTλS
#4
Here is an example of a dialog that uses .ini files.

I know you said txt, but this should do the trick for you, I think?!?
You can update information in the dialog. If you have more than one account, you can create MySpace1, MySpace2,etc...

Function Password2
Code:
Copy      Help
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages

;BEGIN DIALOG
;0 "" 0x90C80A44 0x100 0 0 223 57 "Passwords"
;1 Button 0x54030001 0x4 0 36 48 14 "OK"
;2 Button 0x54030000 0x4 50 36 48 14 "Cancel"
;3 Edit 0x54030080 0x200 100 6 120 12 ""
;4 Edit 0x54030080 0x200 100 22 120 13 ""
;5 Edit 0x54030080 0x200 100 38 120 12 ""
;7 Button 0x54032000 0x0 0 20 98 14 "Save"
;6 ComboBox 0x54230243 0x0 0 6 96 213 ""
;END DIALOG
;DIALOG EDITOR: "" 0x2030001 "" "" ""

str controls = "3 4 5 6"
str e3 e4 e5 cb6

if(dir("$desktop$\passwords\*"))
,goto Load
else
,mkdir "$Desktop$\passwords"

;Load
Dir d
foreach(d "$desktop$\passwords\*" FE_Dir)
,cb6.addline(d.FileName)
,cb6.getfilename(cb6)

str Data Name Web User Pass Hive


if(!ShowDialog("Password2" &Password2 &controls)) ret

ret
;messages
sel message
,case WM_INITDIALOG
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case CBN_DROPDOWN<<16|6
,_i=CB_SelectedItem(lParam)
,RefreshCombo(id(6 hDlg))
,case 7
,Name.getwintext(id(3 win("Passwords" "#32770")))
,Hive.format("$desktop$\passwords\%s.ini" Name)
,rset Name "Name" Name Hive
,User.getwintext(id(4 win("Passwords" "#32770")))
,rset User "User" Name Hive    
,Pass.getwintext(id(5 win("Passwords" "#32770")))
,rset Pass "Pass" Name Hive
,
,case CBN_SELENDOK<<16|6
,_i=CB_SelectedItem(lParam)
,Name.getwintext(id(6 win("Passwords" "#32770")))
,Web="Web"
,User="User"
,Pass="Pass"
,Hive.format("$desktop$\passwords\%s.ini" Name)
,rget Name "Name" Name Hive
,Name.setwintext(id(3 win("Passwords" "#32770")))
,rget User "User" Name Hive
,User.setwintext(id(4 win("Passwords" "#32770")))
,rget Pass "Pass" Name Hive
,Pass.setwintext(id(5 win("Passwords" "#32770")))
,
,case IDOK
,,Name.getwintext(id(6 win("Passwords" "#32770")))
,Web="Web"
,User="User"
,Pass="Pass"
,Hive.format("$desktop$\passwords\%s.ini" Name)
,rget Name "Name" Name Hive
,Name.setwintext(id(3 win("Passwords" "#32770")))
,rget User "User" Name Hive
,User.setwintext(id(4 win("Passwords" "#32770")))
,rget Pass "Pass" Name Hive
,Pass.setwintext(id(5 win("Passwords" "#32770")))
,case IDCANCEL
ret 1

Function RefreshCombo
Code:
Copy      Help
\
function lis

str tmp
SendMessage(lis CB_RESETCONTENT 0 0)

Dir d
foreach(d "$desktop$\passwords\*" FE_Dir)
,tmp.getfilename(d.FileName)
,SendMessage(lis CB_INSERTSTRING 0 tmp)


CB_SelectItem(lis 0)

Hopefully this is like what you want!
#5
Another example. Again xml, sorry.
Requires QM 2.3.0 or later.

Function Dialog67
Code:
Copy      Help
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages

str controls = "5 6"
str e5 e6
if(!ShowDialog("Dialog67" &Dialog67 &controls)) ret

;BEGIN DIALOG
;0 "" 0x90C80A44 0x100 0 0 223 135 "Dialog"
;3 Static 0x54000000 0x0 4 6 48 12 "user"
;4 Static 0x54000000 0x0 4 22 48 12 "password"
;5 Edit 0x54030080 0x200 54 6 96 14 ""
;6 Edit 0x54030080 0x200 54 22 96 14 ""
;7 Button 0x54032000 0x0 4 42 48 14 "Add"
;8 Button 0x54032000 0x0 4 58 48 14 "Remove"
;9 ListBox 0x54230103 0x200 54 42 96 90 ""
;END DIALOG
;DIALOG EDITOR: "" 0x2030001 "" "" ""

ret
;messages
lpstr xfolder="$personal$\x493" ;;change this
lpstr xfile="$personal$\x493\x493.xml" ;;and this

sel message
,case WM_INITDIALOG
,;when opening the dialog, make sure that the folder and the file exist
,if(!dir(xfile))
,,mkdir xfolder
,,_s="<x />"
,,_s.setfile(xfile)
,else
,,;if already exists, populate listbox
,,update_listbox_from_xml hDlg xfile
,,
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case 7 ;;Add
,;get text from edit boxes
,str u p
,u.getwintext(id(5 hDlg))
,p.getwintext(id(6 hDlg))
,if(empty(u) or empty(p)) ret
,;save to file
,IXml x=CreateXml; x.FromFile(xfile)
,IXmlNode n=x.RootElement.Add("i")
,n.Add("u" u)
,n.Add("p" p)
,x.ToFile(xfile)
,;update listbox
,update_listbox_from_xml hDlg xfile
,
,case 8 ;;Remove
,int i=LB_SelectedItem(id(9 hDlg)); if(i<0) ret
,i=SendMessage(id(9 hDlg) LB_GETITEMDATA i 0)
,;remove from file
,x=CreateXml; x.FromFile(xfile)
,n=x.RootElement.Child("i" i+i)
,x.Delete(n)
,x.ToFile(xfile)
,update_listbox_from_xml hDlg xfile
,
,case IDOK
,case IDCANCEL
ret 1

Function update_listbox_from_xml
Code:
Copy      Help
;/
function hDlg $xfile

;clear listbox
int h=id(9 hDlg)
SendMessage h LB_RESETCONTENT 0 0
;load file and get all <i> nodes
IXml x=CreateXml; x.FromFile(xfile)
ARRAY(IXmlNode) a; int i
x.Path("x/i" a)
;populate listbox
for i 0 a.len
,LB_Add h a[i].ChildValue("u") i
#6
I had a feeling that an XML version would get posted. Thanks for the combobox update populated by XML nodes! I hadn't figured that one out yet.
#7
just what i was looking for thanks The Vig and Gintaras both examples were alot of help!

kudos to you both
Big Grin
#8
Hi vig and Gint!

Im back on another account to restart this topic haha Its quite funny actually as i forgot my logins on the old veritas account and im back asking for help with the password mac. :lol:

Anyway I have not been using Quick Mac for awhile now and i need some help with Vigs code.

TheVig Wrote:Here is an example of a dialog that uses .ini files.

I know you said txt, but this should do the trick for you, I think?!?
You can update information in the dialog. If you have more than one account, you can create MySpace1, MySpace2,etc...

Function Password2
Code:
Copy      Help
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages

;BEGIN DIALOG
;0 "" 0x90C80A44 0x100 0 0 223 57 "Passwords"
;1 Button 0x54030001 0x4 0 36 48 14 "OK"
;2 Button 0x54030000 0x4 50 36 48 14 "Cancel"
;3 Edit 0x54030080 0x200 100 6 120 12 ""
;4 Edit 0x54030080 0x200 100 22 120 13 ""
;5 Edit 0x54030080 0x200 100 38 120 12 ""
;7 Button 0x54032000 0x0 0 20 98 14 "Save"
;6 ComboBox 0x54230243 0x0 0 6 96 213 ""
;END DIALOG
;DIALOG EDITOR: "" 0x2030001 "" "" ""

str controls = "3 4 5 6"
str e3 e4 e5 cb6

if(dir("$desktop$\passwords\*"))
,goto Load
else
,mkdir "$Desktop$\passwords"

;Load
Dir d
foreach(d "$desktop$\passwords\*" FE_Dir)
,cb6.addline(d.FileName)
,cb6.getfilename(cb6)

str Data Name Web User Pass Hive


if(!ShowDialog("Password2" &Password2 &controls)) ret

ret
;messages
sel message
,case WM_INITDIALOG
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case CBN_DROPDOWN<<16|6
,_i=CB_SelectedItem(lParam)
,RefreshCombo(id(6 hDlg))
,case 7
,Name.getwintext(id(3 win("Passwords" "#32770")))
,Hive.format("$desktop$\passwords\%s.ini" Name)
,rset Name "Name" Name Hive
,User.getwintext(id(4 win("Passwords" "#32770")))
,rset User "User" Name Hive    
,Pass.getwintext(id(5 win("Passwords" "#32770")))
,rset Pass "Pass" Name Hive
,
,case CBN_SELENDOK<<16|6
,_i=CB_SelectedItem(lParam)
,Name.getwintext(id(6 win("Passwords" "#32770")))
,Web="Web"
,User="User"
,Pass="Pass"
,Hive.format("$desktop$\passwords\%s.ini" Name)
,rget Name "Name" Name Hive
,Name.setwintext(id(3 win("Passwords" "#32770")))
,rget User "User" Name Hive
,User.setwintext(id(4 win("Passwords" "#32770")))
,rget Pass "Pass" Name Hive
,Pass.setwintext(id(5 win("Passwords" "#32770")))
,
,case IDOK
,,Name.getwintext(id(6 win("Passwords" "#32770")))
,Web="Web"
,User="User"
,Pass="Pass"
,Hive.format("$desktop$\passwords\%s.ini" Name)
,rget Name "Name" Name Hive
,Name.setwintext(id(3 win("Passwords" "#32770")))
,rget User "User" Name Hive
,User.setwintext(id(4 win("Passwords" "#32770")))
,rget Pass "Pass" Name Hive
,Pass.setwintext(id(5 win("Passwords" "#32770")))
,case IDCANCEL
ret 1

Function RefreshCombo
Code:
Copy      Help
\
function lis

str tmp
SendMessage(lis CB_RESETCONTENT 0 0)

Dir d
foreach(d "$desktop$\passwords\*" FE_Dir)
,tmp.getfilename(d.FileName)
,SendMessage(lis CB_INSERTSTRING 0 tmp)


CB_SelectItem(lis 0)

Hopefully this is like what you want!

Im using this code again to create my ini files. But how can i make it so it only saves to a single INI file and not duplicate? Also once the INI is saved, which is the best way to make the mac email me the INI File for a backup (I use Gmail). I see alot of posts regarding send mail including the post i made, however this was over 3-4 years ago.
#9
...And its nice to be back Smile
#10
If i use.....

Code:
Copy      Help
str s=
;smtp_server smtp.gmail.com
;smtp_port 465
;smtp_user xxxxxx@gmail.com
;smtp_password xxxxxxxxxxxxxxxxxxxx
;smtp_auth 2
;smtp_secure 1
;smtp_timeout 30
;smtp_email xxxxxx@gmail.com
;smtp_displayname "xxxxxxxxxxxxxxxxxxxxxx"
;smtp_replyto ""
SendMail "xxxxxx@xxxxxxxxxxxxx.com" "test" "test" 0 "" "" "" "" "" s

How would i add the attachemnt $Desktop$\passwords\backup.ini to the email
#11
Also please take into account i will run this as an exe and QML, my other 3 systems does not have QM installed.
#12
SendMail 5-th argument can be attachment file path.

Do you still need dialog with single ini?
#13
Hi Gin,

Im actually having trouble just navigation Quick Macros its been so long should their be a floating toolbar or such? I dont see any of the old icons like it use to have?
#14
Yes, should be floating toolbar, like before.
If you don't see it: open Options dialog and click 'Check extensions'.
#15
Thanks It worked i have toolbars not visible. I am running Version 2.3.2.8 is this an ok build to still work on?

I can reinstall a newer revision but i wont need to buy another license will i? Ive already purchased 2 times lost one serial haha This is why i need this Macro my memory is slowly falling into the abyss Confusedhock:
#16
And yes sorry "Do you still need dialog with single ini?" - that is correct. I had it before on the old system but all my macs have gone since then. I think QM Expert helped me put all the functions together, from saving data to INI to sending via send Mail. By the looks of it hes not so active here now.
#17
All this works with any QM version.
Don't need to buy new version, just download and install.
#18
Not perfect but works. Saves to 1 ini file.
Function Password2
Code:
Copy      Help
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages

;BEGIN DIALOG
;0 "" 0x90C80A44 0x100 0 0 223 57 "Passwords"
;3 Edit 0x54030080 0x200 100 6 120 12 ""
;4 Edit 0x54030080 0x200 100 22 120 13 ""
;5 Edit 0x54030080 0x200 100 38 120 12 ""
;7 Button 0x54032000 0x0 0 20 98 14 "Save"
;6 ComboBox 0x54230243 0x0 0 6 96 213 ""
;END DIALOG
;DIALOG EDITOR: "" 0x2030001 "" "" ""

str- t_file="$desktop$\passwords447.ini"
str Data Name Web User Pass Hive

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

ret
;messages
sel message
,case WM_INITDIALOG
,RefreshCombo(id(6 hDlg))
,
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case [7,IDOK] ;;Save
,Name.getwintext(id(3 hDlg))
,User.getwintext(id(4 hDlg))
,Pass.getwintext(id(5 hDlg))
,rset User "User" Name t_file
,rset Pass "Pass" Name t_file
,RefreshCombo(id(6 hDlg) Name)
,
,case CBN_SELENDOK<<16|6
,CB_SelectedItem lParam Name
,rget User "User" Name t_file
,rget Pass "Pass" Name t_file
,Name.setwintext(id(3 hDlg))
,User.setwintext(id(4 hDlg))
,Pass.setwintext(id(5 hDlg))
ret 1
Function RefreshCombo
Code:
Copy      Help
;\
function lis [$name]

str- t_file
if(!dir(t_file)) ret
str s sd.getfile(t_file)

SendMessage(lis CB_RESETCONTENT 0 0)
foreach s sd
,if s.beg("[")
,,s.get(s 1 s.len-2)
,,SendMessage(lis CB_ADDSTRING 0 s)

if(!empty(name)) CB_SelectItem lis CB_FindItem(lis name 0 1)
#19
Thank You Gin much appreciated!, I should be ok for the email, Ive just remembered how to setup the mail function aswell i was lost without the toolbar haha which is why it so confusing :lol:
#20
ok so i have setup the email, tested and success.

how can i combine them 2 functions (email and save) so as soon as save is hit, the backup email is sent to my email. Can you also confirm if i remember that triggers do not work in exe is correct?
#21
Call your email function from dialog, above case CBN_SELENDOK.
Triggers don't work in exe.
#22
I dont get the part it creates the file? i dont see setfile anywhere :?
#23
rset is doing it Big Grin didnt know it could do that.


Forum Jump:


Users browsing this thread: 1 Guest(s)