none
This Makes no Sense RRS feed

  • Question

  • GraphicsWindow.Show()
    GraphicsWindow.BrushColor = "Black"
    GraphicsWindow.FontSize = 12
    GraphicsWindow.Title = "Text Edit 1.0"
    GraphicsWindow.BackgroundColor = "Tan"
    GraphicsWindow.FontName = "Times New Roman"
    GraphicsWindow.CanResize = "False"
    GraphicsWindow.Width = 800
    GraphicsWindow.Height = 600
    GraphicsWindow.FontBold = "False"
    GraphicsWindow.FontItalic = "False"
    GraphicsWindow.CanResize = "False"
    GraphicsWindow.Top = 0
    GraphicsWindow.Left = 0
    
    GraphicsWindow.DrawText(40,5,"File Name & Directory")
    
    Controls.ButtonClicked = Q2
    Q1 = Controls.AddMultiLineTextBox(10,50)
    Q4 = Controls.AddButton("Save",0,0)
    Q6 = Controls.AddTextBox(0,20)
    Controls.AddButton("Font",165,0)
    Controls.SetSize(Q1 780,530)
    LDFocus.SetFocus(Q1)
    
    Sub Q2 
      Q3 = Controls.LastClickedButton
      If Q3 = Q4 Then 
        Q5 = Controls.GetTextBoxText(Q1)
        Q7 = Controls.GetTextBoxText(Q6)
      EndIf
    
      If Q7 = "" Then
        LDProcess.Start("C:\Text Edit\ObUser.bat","")
        Q9 = File.ReadLine("C:\Text Edit\user.txt",1)
        File.WriteContents("C:\Users\"+Q9+"\Desktop\MyNewText.txt",Q5)
      Else
        Q8 = File.WriteContents(Q7,Q5) 
      EndIf  
    EndSub

    Okay tell me if this makes any sense to you I click the font button and it opens the batch file that only the save button should open the font button had no code to make it work.

    and on a side note you must have the litdev extension to use this code below is the code for the batch file

    @echo off
    title ObUser
    echo %USERNAME% > user.txt


    • Edited by OKAY1234 Thursday, August 9, 2018 10:08 PM
    Thursday, August 9, 2018 10:05 PM

Answers

  • How about this?

    ObUser.bat gets "UserName".

    LdFile.Username returns  "UserName". 

    LDDialogs.SaveFile is useful to save a file to a folder of your choice. 

    GraphicsWindow.Show()
    GraphicsWindow.BrushColor = "Black"
    GraphicsWindow.FontSize = 12
    GraphicsWindow.Title = "Text Edit 1.0"
    GraphicsWindow.BackgroundColor = "Tan"
    GraphicsWindow.FontName = "Times New Roman"
    GraphicsWindow.CanResize = "False"
    GraphicsWindow.Width = 800
    GraphicsWindow.Height = 600
    GraphicsWindow.FontBold = "False"
    GraphicsWindow.FontItalic = "False"
    GraphicsWindow.CanResize = "False"
    GraphicsWindow.Top = 0
    GraphicsWindow.Left = 0

    GraphicsWindow.DrawText(40,5,"File Name & Directory")
    Controls.ButtonClicked = Q2
    Q1 = Controls.AddMultiLineTextBox(10,50)
    Q4 = Controls.AddButton("Save",0,0)
    'Q6 = Controls.AddTextBox(0,20)   '<--------
    Controls.AddButton("Font",165,0)
    Controls.SetSize(Q1 780,530)
    LDFocus.SetFocus(Q1)

    Sub Q2
      Q3 = Controls.LastClickedButton

      Q7=""

      If Q3 = Q4 Then
        Q5 = Controls.GetTextBoxText(Q1)
        Q7 = LDDialogs.SaveFile("txt","C:\") ' Controls.GetTextBoxText(Q6) '<--------
      EndIf

      If Q7 = "" Then
        ' LDProcess.Start("C:\Text Edit\ObUser.bat","")  '<--------
        Q9 = LdFile.UserName ' File.ReadLine("C:\Text Edit\user.txt",1) '<--------
        File.WriteContents("C:\Users\"+Q9+"\Desktop\MyNewText.txt",Q5)
      Else
        Q8 = File.WriteContents(Q7,Q5)
      EndIf 
    EndSub


    • Edited by NaochanONEditor Friday, August 10, 2018 1:24 AM add comment
    • Marked as answer by OKAY1234 Friday, August 10, 2018 7:31 PM
    Friday, August 10, 2018 1:21 AM
    Answerer

All replies

  • How about this?

    ObUser.bat gets "UserName".

    LdFile.Username returns  "UserName". 

    LDDialogs.SaveFile is useful to save a file to a folder of your choice. 

    GraphicsWindow.Show()
    GraphicsWindow.BrushColor = "Black"
    GraphicsWindow.FontSize = 12
    GraphicsWindow.Title = "Text Edit 1.0"
    GraphicsWindow.BackgroundColor = "Tan"
    GraphicsWindow.FontName = "Times New Roman"
    GraphicsWindow.CanResize = "False"
    GraphicsWindow.Width = 800
    GraphicsWindow.Height = 600
    GraphicsWindow.FontBold = "False"
    GraphicsWindow.FontItalic = "False"
    GraphicsWindow.CanResize = "False"
    GraphicsWindow.Top = 0
    GraphicsWindow.Left = 0

    GraphicsWindow.DrawText(40,5,"File Name & Directory")
    Controls.ButtonClicked = Q2
    Q1 = Controls.AddMultiLineTextBox(10,50)
    Q4 = Controls.AddButton("Save",0,0)
    'Q6 = Controls.AddTextBox(0,20)   '<--------
    Controls.AddButton("Font",165,0)
    Controls.SetSize(Q1 780,530)
    LDFocus.SetFocus(Q1)

    Sub Q2
      Q3 = Controls.LastClickedButton

      Q7=""

      If Q3 = Q4 Then
        Q5 = Controls.GetTextBoxText(Q1)
        Q7 = LDDialogs.SaveFile("txt","C:\") ' Controls.GetTextBoxText(Q6) '<--------
      EndIf

      If Q7 = "" Then
        ' LDProcess.Start("C:\Text Edit\ObUser.bat","")  '<--------
        Q9 = LdFile.UserName ' File.ReadLine("C:\Text Edit\user.txt",1) '<--------
        File.WriteContents("C:\Users\"+Q9+"\Desktop\MyNewText.txt",Q5)
      Else
        Q8 = File.WriteContents(Q7,Q5)
      EndIf 
    EndSub


    • Edited by NaochanONEditor Friday, August 10, 2018 1:24 AM add comment
    • Marked as answer by OKAY1234 Friday, August 10, 2018 7:31 PM
    Friday, August 10, 2018 1:21 AM
    Answerer
  • Thanks for your help. 
    Friday, August 10, 2018 7:32 PM