1. Open your project 2. Add a new module, let's say "Sudo" 3. Paste these lines in: ' Gambas class file PUBLIC wins AS Form PUBLIC black AS Button PUBLIC szoveg1 AS TextBox PUBLIC hProcess AS Process
PUBLIC SUB ReadPassword() DIM black AS Button DIM labi, labi2 AS Label wins = NEW Form wins.Width = 200 wins.Height = 140 wins.Title = "Update: 'locate'" labi = NEW Label(wins) labi.X = 20 labi.Y = 10 labi.Width = 160 labi.Height = 25 labi.Text = "Enter the root password:" szoveg1 = NEW TextBox(wins) szoveg1.Width = 160 szoveg1.Height = 25 szoveg1.X = 20 szoveg1.Y = 40 szoveg1.Password = TRUE labi2 = NEW Label(wins) labi2.X = 20 labi2.Y = 70 labi2.Width = 160 labi2.Height = 25 labi2.Text = "Shell: su -c 'updatedb'" black = NEW Button(wins) black.Width = 100 black.Height = 25 black.X = 50 black.Y = 105 black.Text = "Update" Object.Attach(black, ME, "runty") wins.Center wins.Show() hProcess = SHELL "su -c 'updatedb'" FOR INPUT OUTPUT END PUBLIC SUB runty_Click() PRINT #hProcess, szoveg1.Text wins.Delete() END ' PUBLIC SUB Process_read() DIM sOutput AS String LINE INPUT #LAST, sOutput PRINT sOutput END 4. Customize the commands you want to execute 5. Call the module with reference Sudo.ReadPassword() from the main program. ------------------------------------------------------------------------------ Beautiful is writing same markup. Internet Explorer 9 supports standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3. Spend less time writing and rewriting code and more time creating great experiences on the web. Be a part of the beta today. http://p.sf.net/sfu/beautyoftheweb _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user