Jump to content

Simple Script Gen (double quotes problem)


Giggo
 Share

Recommended Posts

Hello Forum!

why add double double quotes, can I do it differently?   Thanks!

Code:

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

#Region
$Form1 = GUICreate("Create Example .au3 Script", 615, 437, 192, 124)
$Button1 = GUICtrlCreateButton("Simple", 15, 16, 571, 161)
GUICtrlSetFont(-1, 20, 800, 0, "MS UI Gothic")
$Button2 = GUICtrlCreateButton("Whit Button", 15, 254, 571, 161)
GUICtrlSetFont(-1, 20, 800, 0, "MS UI Gothic")
GUISetState(@SW_SHOW)
#EndRegion 

$a_File  = "NewForm.au3"
$a_File2 = "NewForm_Button.au3"

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
Case $Button1
filedelete($a_File)
FileOpen($a_File)
$a_File = FileOpen(@ScriptDir & '\NewForm_Simple.au3', 128 + 1)         
FileWrite($a_File, "#include <ButtonConstants.au3>" & @CRLF)
FileWrite($a_File, "#include <GUIConstantsEx.au3>" & @CRLF)
FileWrite($a_File, "#include <WindowsConstants.au3>" & @CRLF)
FileWrite($a_File,""  & @CRLF)
FileWrite($a_File, "#Region ### START Koda GUI section ### Form=" & @CRLF)
FileWrite($a_File,"$Form1 = GUICreate(" & """" & "Form1" & """" & " , 615, 437, -1, -1) "  & @CRLF)
FileWrite($a_File,"GUISetState(@SW_SHOW)"  & @CRLF)
FileWrite($a_File, "#EndRegion ### END Koda GUI section ###" & @CRLF)
FileWrite($a_File,""  & @CRLF)
FileWrite($a_File,""  & @CRLF)
FileWrite($a_File,""  & @CRLF)
FileWrite($a_File,"While 1"  & @CRLF)
FileWrite($a_File,"         $nMsg = GUIGetMsg()"  & @CRLF)
FileWrite($a_File,"         Switch $nMsg"  & @CRLF)
FileWrite($a_File,"                   Case $GUI_EVENT_CLOSE"  & @CRLF)
FileWrite($a_File,"                            Exit"  & @CRLF)
FileWrite($a_File,"         EndSwitch"  & @CRLF)
FileWrite($a_File,"WEnd"  & @CRLF)

Case $Button2
filedelete($a_File2)
FileOpen($a_File2)
$a_File2 = FileOpen(@ScriptDir & '\NewForm_Button.au3', 128 + 1)    
FileWrite($a_File2, "#include <ButtonConstants.au3>" & @CRLF)
FileWrite($a_File2, "#include <GUIConstantsEx.au3>" & @CRLF)
FileWrite($a_File2, "#include <WindowsConstants.au3>" & @CRLF)
FileWrite($a_File2, "#include <MsgBoxConstants.au3>" & @CRLF)
FileWrite($a_File2,""  & @CRLF)
FileWrite($a_File2, "#Region ### START Koda GUI section ### Form=" & @CRLF)
FileWrite($a_File2,"$Form1 = GUICreate(" & """" & "Form1" & """" & " , 615, 437, -1, -1) "  & @CRLF)
FileWrite($a_File2,"$Button1 = GUICtrlCreateButton(" & """" & "Button1" & """" & " , 272, 168, 75, 25) "  & @CRLF)
FileWrite($a_File2,"GUISetState(@SW_SHOW)"  & @CRLF)
FileWrite($a_File2, "#EndRegion ### END Koda GUI section ###" & @CRLF)
FileWrite($a_File2,""  & @CRLF)
FileWrite($a_File2,""  & @CRLF)
FileWrite($a_File2,""  & @CRLF)
FileWrite($a_File2,"While 1"  & @CRLF)
FileWrite($a_File2,"         $nMsg = GUIGetMsg()"  & @CRLF)
FileWrite($a_File2,"         Switch $nMsg"  & @CRLF)
FileWrite($a_File2,"                   Case $GUI_EVENT_CLOSE"  & @CRLF)
FileWrite($a_File2,"                   Case $Button1"  & @CRLF)
FileWrite($a_File2,"         MsgBox($MB_OK + $MB_TOPMOST," & """" & "Test" & """" & " , "" Hello World! "")"  & @CRLF)
FileWrite($a_File2,"                            Exit"  & @CRLF)
FileWrite($a_File2,"         EndSwitch"  & @CRLF)
FileWrite($a_File2,"WEnd"  & @CRLF)
EndSwitch
WEnd

example problem

possible type:
FileWrite($a_File,"$Form1 = GUICreate(" & """" & "Form1" & """" & " , 615, 437, -1, -1) "  & @CRLF)
to
$Rep = """"
FileWrite($a_File,"$Form1 = GUICreate(" & $Rep & "Form1" & $Rep & " , 615, 437, -1, -1) "  & @CRLF)

my solution is $Rep = """"

but I don't know if it's good

Edited by Giggo
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...