Jump to content

A Script To Make Another Script! [ReSolved]


Swift
 Share

Recommended Posts

Nothing Works...I Cant Get It To Write Basically This:

GUICreate("")

GUISetState()

While1

WEnd

It wont write that!! Grr...Im making a installer. And I need to write...then compile...so...Any help would be nice...heres what I got so far...tell me if you like it :)

#include <GUIConstants.au3>
$Form1 = GUICreate("Install Creator", 416, 235, 192, 145)
GUISetBkColor(0x0000FF)
$Button2 = GUICtrlCreateButton("Next", 304, 200, 89, 25, 0)
GUICtrlSetBkColor(-1, 0xFFFF00)
$Button3 = GUICtrlCreateButton("Back", 216, 200, 81, 25, 0)
GUICtrlSetState($Button3, $GUI_DISABLE)
GUICtrlSetBkColor(-1, 0xFFFF00)
$Label1 = GUICtrlCreateLabel("                   File Installer.", 16, 8, 387, 33)
GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif")
GUICtrlSetBkColor(-1, 0xFFFF00)
GUICtrlSetCursor (-1, 2)
$Input1 = GUICtrlCreateInput("Choose Folder With All Programs", 16, 48, 289, 21)
GUICtrlSetBkColor(-1, 0xFFFF00)
$Button4 = GUICtrlCreateButton("Browse...", 320, 48, 81, 25, 0)
GUICtrlSetBkColor(-1, 0xFFFF00)
GUICtrlSetCursor (-1, 2)
$Button1 = GUICtrlCreateButton("Homepage", 14, 200, 97, 25, 0)
GUICtrlSetBkColor(-1, 0xFFFF00)
GUISetState(@SW_SHOW)
$Form2 = GUICreate("Install Creator", 416, 235, 192, 145)
GUISetBkColor(0x0000FF)
$Form2Label1 = GUICtrlCreateLabel("                File Installer.", 16, 8, 383, 33)
GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif")
GUICtrlSetBkColor(-1, 0xFFFF00)
$Form2Checkbox1 = GUICtrlCreateCheckbox("Create A Start Menu Folder", 16, 56, 145, 17)
$Form2Checkbox2 = GUICtrlCreateCheckbox("Create A Program Files Folder", 16, 80, 161, 17)
GUICtrlSetState($Form2Checkbox1, $GUI_CHECKED)
GUICtrlSetState($Form2Checkbox2, $GUI_CHECKED)
$Form2Input1 = GUICtrlCreateInput("Start Menu Name", 184, 56, 217, 21)
GUICtrlSetBkColor(-1, 0xFFFF00)
$Form2Input2 = GUICtrlCreateInput("Program Files Name", 184, 80, 217, 21)
GUICtrlSetBkColor(-1, 0xFFFF00)
$Form2Button1 = GUICtrlCreateButton("Homepage", 14, 200, 97, 25, 0)
GUICtrlSetBkColor(-1, 0xFFFF00)
$Form2Button2 = GUICtrlCreateButton("Back", 216, 200, 81, 25, 0)
GUICtrlSetBkColor(-1, 0xFFFF00)
$Form2Button3 = GUICtrlCreateButton("Next", 304, 200, 89, 25, 0)
GUICtrlSetBkColor(-1, 0xFFFF00)
GUISetState(@SW_HIDE)
$Form3 = GUICreate("Install Creator", 416, 235, 192, 145)
GUISetBkColor(0x0000FF)
$Form3Label1 = GUICtrlCreateLabel("                  File Installer.", 16, 8, 379, 33)
GUICtrlSetFont(-1, 18, 400, 0, "MS Sans Serif")
GUICtrlSetBkColor(-1, 0xFFFF00)
$Form3Label2 = GUICtrlCreateLabel("                        You Are Now Ready To Create The Installer.", 16, 56, 390, 17)
GUICtrlSetBkColor(-1, 0x00FF00)
$Form3Button1 = GUICtrlCreateButton("Add Something Else", 16, 88, 177, 33, 0)
GUICtrlSetBkColor(-1, 0xFFFF00)
$Form3Button2 = GUICtrlCreateButton("Create Installer Now", 208, 88, 185, 33, 0)
GUICtrlSetBkColor(-1, 0xFFFF00)
$Form3Button3 = GUICtrlCreateButton("Homepage", 16, 200, 105, 25, 0)
GUICtrlSetBkColor(-1, 0xFFFF00)
$Form3Button4 = GUICtrlCreateButton("Back", 168, 200, 233, 25, 0)
GUICtrlSetBkColor(-1, 0xFFFF00)
GUISetState(@SW_HIDE)
$gui1 = GuiCreate("Add New", 191, 157,(@DesktopWidth-191)/2, (@DesktopHeight-157)/2)
$Combo_2 = GuiCtrlCreateCombo("", 30, 60, 130, 21)
GuiCtrlSetData($combo_2, "License|Information|Startup")
$GUI1Button1 = GuiCtrlCreateButton("Add", 60, 90, 130, 20)
$GUI1Button2 = GUICtrlCreateButton("Cancel", 1, 90, 58, 20)
GUISetState(@SW_HIDE)


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button2
            If GUICtrlRead($Input1) = "" Or GUICtrlRead($Input1) = "Choose Folder With All Programs" Then
                MsgBox(0, "Please Choose A Folder", "Please Choose A File Folder")
                GUISetState(@SW_SHOW,$Form1)
                GUISetState(@SW_HIDE,$Form2)
            Else
                GUISetState(@SW_HIDE,$Form1)
            GUISetState(@SW_SHOW,$Form2)
            EndIf
        Case $Form2Button3
            GUISetState(@SW_HIDE,$Form2)
            GUISetState(@SW_SHOW,$Form3)
        Case $Form3Button4
            GUISetState(@SW_HIDE,$Form3)
            GUISetSTate(@SW_SHOW,$Form2)
        Case $Form2Button2
            GUISetState(@SW_HIDE,$Form2)
            GUISetState(@SW_SHOW,$Form1)
        Case $Form2Button1
            ShellExecute("http://www.autoitscript.com/forum/index.php?showuser=30516")
        Case $Button1
            ShellExecute("http://www.autoitscript.com/forum/index.php?showuser=30516")
        Case $Form3Button3
            ShellExecute("http://www.autoitscript.com/forum/index.php?showuser=30516")
        Case $Button4
            $file = FileSelectFolder("Choose a folder.", "")
            GUICtrlSetData($input1, "")
            GUICtrlSetData($Input1, $file)
        Case $Form3Button1
            GUISetState(@SW_HIDE, $Form3)
            GUISetState(@SW_SHOW, $gui1)
        Case $GUI1Button1
            MsgBox(0, "Add New", "Sorry, This Feature Isnt Added Yet")
            GUISetState(@SW_SHOW, $Form3)
            GUISetState(@SW_HIDE, $gui1)
        Case $GUI1Button2
            GUISetState(@SW_SHOW, $Form3)
            GUISetState(@SW_HIDE, $gui1)
        Case $Form3Button2
            $it = GUICtrlRead($Input1)
            DirCopy($it & "\", @ProgramFilesDir & "\" & GUICtrlRead($Form2Input2) & "\", 1)
            DirCopy($it & "\", @StartMenuDir & "\Programs\" & GUICtrlRead($Form2Input1) & "\", 1)
            
    EndSwitch
WEnd

For right now...its just coping files...but eventually...it will be creating an installer to that for itself!

Edited by Swift
Link to comment
Share on other sites

Does this work for you? it does for me...

Dim $Lines[6]

$Lines[0]= '#Include <GuiConstants.au3>'
$Lines[1]= 'GUICreate("")'
$Lines[2]= 'GUISetState()'
$Lines[3]= 'While 1'
$Lines[4]= '    Sleep(100)'
$Lines[5]= 'WEnd'

$File=FileOpen("TestDummy.au3", 2)
For $i = 0 to UBound($Lines)-1
    FileWriteLine($File, $lines[$i])
Next
FileClose($File)

Just be careful with quotes.

Link to comment
Share on other sites

You will get some problems by complex structures.

Like writing the line

MsgBox(0,"",'"My "' & $var1 & "'My '" & $var2)

Edit: First one is ' " M y " ' second the other way

You gotta code those lines realy ugly;)

Edited by Kademlia
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...