alex OF DEATH Posted July 9, 2006 Share Posted July 9, 2006 I need the command "DirCreate" to read 2 GuiCtrlReads instead of one. If I use 2 DirCreate's, It'll create 2 folders. I need this for a name and a path which are 2 seperate input boxes. I really dont want to make it 1 input box, it would make my script more confusing and less professional seeming. Any help? Link to comment Share on other sites More sharing options...
gamepin126 Posted July 9, 2006 Share Posted July 9, 2006 (edited) $1 AND $2 Edited July 9, 2006 by gamepin126 Link to comment Share on other sites More sharing options...
MHz Posted July 9, 2006 Share Posted July 9, 2006 I need this for a name and a path which are 2 seperate input boxes. I really dont want to make it 1 input box, it would make my script more confusing and less professional seeming. Any help?Well, I would be less confused if you had 1 input control and had a button next to it so I could browse to a folder and create a new folder as needed. FileSelectFolder can browse and create the new folder. GuiCtrlSetData can update the chosen folder into the input control. If the input control is filled in manually, then, if the folder does not exist, then a warning can happen, perhaps using the FileSelectFolder to give the message. I did up some code to explore you 2 input method and it is looking perhaps illogical to follow? Here is some test code I have been toying with, and see for yourself. expandcollapse popup#include <GUIConstants.au3> GUICreate(" My GUI input", 320, 120, 300, 200) GUICtrlCreateLabel('Folder name', 10, 5) $foldername = GUICtrlCreateInput("", 10, 20, 300, 20) GUICtrlCreateLabel('Path to the folder', 10, 50) $folderpath = GUICtrlCreateInput("", 10, 65, 300, 20) $btn = GUICtrlCreateButton("Ok", 120, 95, 60, 20) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = -3 Exit Case $msg = $btn $folder = GUICtrlRead($foldername); Read input control(1) $path = GUICtrlRead($folderpath); Read input control(2) ; Check the path to the folder If Not FileExists($path) Then $path = FileSelectFolder('Choose a folder', '') If Not FileExists($path) Then GUICtrlSetData($folderpath, 'Supply a path to the folder') ContinueLoop Else GUICtrlSetData($folderpath, $path) EndIf EndIf If Not FileExists($path & '\' & $folder) Then ; Fake DirCreate MsgBox(0, '', 'DirCreate(' & $path & '\' & $folder & ') done now', 5) Else GUICtrlSetData($foldername, 'Supply a name to the folder') EndIf EndSelect WEnd Link to comment Share on other sites More sharing options...
alex OF DEATH Posted July 9, 2006 Author Share Posted July 9, 2006 Gamepin, there were no errors this time, but it still did not set the file name correctly, or put it in the correct place. MHz: That's not what I really want in my script. This is just a simple File mover and Folder creater. Just type in the name of the folder, where you want it, and bang. Then you can use the file send to move files from a specific folder to another. Im using it for my USB drive. Download a few files to a folder on my desktop, make a folder for it on my drive, move the files in 2 clicks. ---- Also, im having trouble with the actual file sending thing. func SendFiles() DirMove ( GuiCtrlRead ($FileFrom), GuiCtrlRead ($FileTo) ) endfunc That shouldn't not work. But it does(nt?) Heres the whole script if yall wanna take a whack at it. expandcollapse popup#include <GUIConstants.au3> ; == GUI generated with Koda == Opt("GUIOnEventMode", 1) $Form1 = GUICreate("Folder2Folder", 539, 136, 228, 283) $FileFrom = GUICtrlCreateInput(IniRead ( "SavedFields", "", "FileFrom", "default" ), 72, 24, 153, 21, -1, $WS_EX_CLIENTEDGE) $FileTo = GUICtrlCreateInput(IniRead ( "SavedFields", "", "Fileto", "default" ), 72, 56, 153, 21, -1, $WS_EX_CLIENTEDGE) GUICtrlCreateLabel("To:", 16, 56, 20, 17) GUICtrlCreateLabel("From:", 16, 32, 30, 17) $SendFile = GUICtrlCreateButton("Send Files", 64, 88, 177, 33) guictrlsetonevent ($SendFile, "SendFiles") $CreateFolder = GUICtrlCreateButton("Create Folder", 312, 88, 177, 33) GuiCtrlSetOnEvent ($CreateFolder, "FolderCreate") $FolderName = GUICtrlCreateInput("", 320, 24, 153, 21, -1, $WS_EX_CLIENTEDGE) GUICtrlSetData ( $Foldername, guictrlread ($Foldername ) ) $CreateWhere = GUICtrlCreateInput(IniRead ( "SavedFields", "", "CreateWhere", "default" ), 320, 56, 153, 21, -1, $WS_EX_CLIENTEDGE) GUICtrlCreateLabel("Folder Name", 240, 32, 64, 17) GUICtrlCreateLabel("Create where?", 240, 64, 73, 17) $Save = GUICtrlCreateButton("Save", 88, 0, 113, 17) guictrlsetonevent ($Save, "Save") GUISetOnEvent ($GUI_EVENT_CLOSE, "Exit1") GUISetState(@SW_SHOW) While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case Else ;;;;;;; EndSelect WEnd Exit func Save() IniWrite ( "SavedFields", "", "FileFrom", Guictrlread ($Filefrom) ) IniWrite ( "SavedFields", "", "FileTo", Guictrlread ($FileTo) ) IniWrite ( "SavedFields", "", "CreateWhere", Guictrlread ($CreateWhere) ) endfunc func FolderCreate() DirCreate (GuiCtrlRead ($CreateWhere) and GuiCtrlRead ($Foldername) ) endfunc func SendFiles() DirMove ( GuiCtrlRead ($FileFrom), GuiCtrlRead ($FileTo) ) endfunc func Exit1() Exit endfunc Line 14 and the spaces after it were an experiment. Link to comment Share on other sites More sharing options...
alex OF DEATH Posted July 10, 2006 Author Share Posted July 10, 2006 Bump, I still can't get it to work :\ Link to comment Share on other sites More sharing options...
evilertoaster Posted July 10, 2006 Share Posted July 10, 2006 (edited) Try this- expandcollapse popup#include <GUIConstants.au3> ; == GUI generated with Koda == Opt("GUIOnEventMode", 1) $Form1 = GUICreate("Folder2Folder", 539, 136, 228, 283) $FileFrom = GUICtrlCreateInput(IniRead ( "SavedFields", "", "FileFrom", "default" ), 72, 24, 153, 21, -1, $WS_EX_CLIENTEDGE) $FileTo = GUICtrlCreateInput(IniRead ( "SavedFields", "", "Fileto", "default" ), 72, 56, 153, 21, -1, $WS_EX_CLIENTEDGE) GUICtrlCreateLabel("To:", 16, 56, 20, 17) GUICtrlCreateLabel("From:", 16, 32, 30, 17) $SendFile = GUICtrlCreateButton("Send Files", 64, 88, 177, 33) guictrlsetonevent ($SendFile, "SendFiles") $CreateFolder = GUICtrlCreateButton("Create Folder", 312, 88, 177, 33) GuiCtrlSetOnEvent ($CreateFolder, "FolderCreate") $FolderName = GUICtrlCreateInput("", 320, 24, 153, 21, -1, $WS_EX_CLIENTEDGE) GUICtrlSetData ( $Foldername, guictrlread ($Foldername ) ) $CreateWhere = GUICtrlCreateInput(IniRead ( "SavedFields", "", "CreateWhere", "default" ), 320, 56, 153, 21, -1, $WS_EX_CLIENTEDGE) GUICtrlCreateLabel("Folder Name", 240, 32, 64, 17) GUICtrlCreateLabel("Create where?", 240, 64, 73, 17) $Save = GUICtrlCreateButton("Save", 88, 0, 113, 17) guictrlsetonevent ($Save, "Save") GUISetOnEvent ($GUI_EVENT_CLOSE, "Exit1") GUISetState(@SW_SHOW) While 1 Sleep(1000) WEnd Exit func Save() IniWrite ( "SavedFields", "", "FileFrom", Guictrlread ($Filefrom) ) IniWrite ( "SavedFields", "", "FileTo", Guictrlread ($FileTo) ) IniWrite ( "SavedFields", "", "CreateWhere", Guictrlread ($CreateWhere) ) endfunc func FolderCreate() DirCreate (GuiCtrlRead ($CreateWhere) &"\"& GuiCtrlRead ($Foldername) ) endfunc func SendFiles() DirMove ( GuiCtrlRead ($FileFrom), GuiCtrlRead ($FileTo) ) endfunc func Exit1() Exit EndFunc Remeber in the 'where' input box make sure to NOT have a trailing backslash (ex. C:\Documents and Settings not C:\Documents and Settings\) Edited July 10, 2006 by evilertoaster Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted July 10, 2006 Moderators Share Posted July 10, 2006 Guys, you can't use GUIOnEventMode with GUIGetMsg(). Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
alex OF DEATH Posted July 10, 2006 Author Share Posted July 10, 2006 (edited) I love you.I didn't think to have a slash addedNow everything works. But I had to sacrifice Moving the files for just copying and pasting.edit: SmOke, I don't see any problems with my script, It's working perfectly, so should I care or do something about it? Edited July 10, 2006 by alex OF DEATH Link to comment Share on other sites More sharing options...
evilertoaster Posted July 10, 2006 Share Posted July 10, 2006 (edited) nah he's right i forgot to take that part out when i fixed it... gimme a sec (it works with it also just useless) Edited July 10, 2006 by evilertoaster Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now