StavenCross

Untitled

May 16th, 2021
713
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
  2. ; #Warn  ; Enable warnings to assist with detecting common errors.
  3. SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
  4. SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
  5. ; Include the Neutron library
  6. #Include Neutron.ahk
  7.  
  8. ; Create a new NeutronWindow and navigate to our HTML page
  9. neutron := new NeutronWindow()
  10. neutron.Load("index.html")
  11.  
  12. neutron.Gui("+LabelNeutron")
  13.  
  14. ; Show the GUI at its default size.
  15. neutron.Show()
  16. return
  17.  
  18. FileInstall, index.html, index.html
  19. FileInstall, bootstrap.min.css, bootstrap.min.css
  20. FileInstall, bootstrap.bundle.min.js, bootstrap.bundle.min.js
  21. FileInstall, jquery.min.js, jquery.min.js
  22.  
  23.  
  24. NeutronClose:
  25. ExitApp
  26. return
  27.  
  28.  
  29. Button(neutron, event)
  30. {
  31.     MsgBox, % "You clicked " event.target.innerText
  32. }
  33.  
  34. Submit(neutron, event)
  35. {
  36.     ; Some events have a default action that needs to be prevented. A form will
  37.     ; redirect the page by default, but we want to handle the form data ourself.
  38.     event.preventDefault()
  39.    
  40.     ; Use Neutron's GetFormData method to process the form data into a form that
  41.     ; is easily accessed. Fields that have a 'name' attribute will be keyed by
  42.     ; that, or if they don't they'll be keyed by their 'id' attribute.
  43.     formData := neutron.GetFormData(event.target)
  44.    
  45.     ; You can access all of the form fields by iterating over the FormData
  46.     ; object. It will go through them in the order they appear in the HTML.
  47.     out := "Access all fields by iterating:`n"
  48.     for name, value in formData
  49.         out .= name ": " value "`n"
  50.     out .= "`n"
  51.    
  52.     ; You can also get field values by name directly. Use object dot notation
  53.     ; with the field name/id.
  54.     out .= "Or access individual fields directly:`n"
  55.     out .= "Email: " formData.inputEmail "`n"
  56.     out .= "Password: " formData.inputPassword "`n"
  57.     if formData.gridCheck
  58.         out .= "You checked the box!"
  59.     else
  60.         out .= "You didn't check the box."
  61.    
  62.     ; Show the output
  63.     MsgBox, %out%
  64. }
  65.  
RAW Paste Data