Najeebsk

DRAG&DROP-TEXT.ahk

Jan 23rd, 2022 (edited)
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;- NAJEEB DRAG & DROP-TEXT-Files and see content and modified-time
  2. #NoEnv
  3. SendMode Input
  4. SetWorkingDir %A_ScriptDir%
  5. edcol1=white
  6. edcol2=yellow
  7. edcol3=red
  8.  
  9. GUI,2:+AlwaysOnTop
  10. Gui,2: Color, ControlColor, Black
  11. Gui,2: Font, CDefault, FixedSys
  12.  
  13. Gui,2:Add, Edit, x5     y10  w800 h45  c%edcol1% vF1,
  14. Gui,2:Add, Edit, x5     y60  w800 h800 c%edcol2% vUpc,
  15.  
  16. GUI,2:show, NA W820 H600 X20 Y0, Drag & Drop Text-Files
  17. Gui,2: Font, s12 CDefault, Lucida Console
  18. ;Gui,2: Font, s16 CDefault, Times New Roman
  19. Gui,2:add, Text, vT1    x10 y870 w490  c%edcol3%,
  20. return
  21. ;----------------------------------------------------------
  22.  
  23. 2GuiDropFiles:
  24. Loop, parse, A_GuiEvent, `n
  25.    GuiControl,2:,F1,%A_LoopField%
  26. goto,showText2
  27. return
  28.  
  29. 2GuiClose:
  30. ExitApp
  31.  
  32. ;-----------------------------------------------
  33.  
  34. ShowText2:
  35. Gui,2:submit,nohide
  36. F1=%f1%
  37. Extx := "txt,ahk,ahl,csv,bas,htm,html,ini,hta,bat,log,py,au3,ls,md,fm,mf"
  38. SplitPath,F1,name, dir, ext, name_no_ext, drive
  39. if ext in %extx%
  40.   fileread, content, %F1%
  41. else
  42.   {
  43.   GuiControl,2:,upc,
  44.   GuiControl,2:,T1,
  45.   GuiControl,2:,upc,Not allowed`nExtension Not in %extx%
  46.   FileGetTime, ft,%f1%,M
  47.   GuiControl,2:,T1,MODIFIED=%ft%
  48.   return
  49.   }
  50. FileGetTime, ft,%f1%,M
  51. GuiControl,2:,T1,MODIFIED=%ft%
  52. GuiControl,2:,upc, %content%
  53. return
  54. ;========== END script ==================================
Add Comment
Please, Sign In to add comment