Iain Posted June 21, 2011 Share Posted June 21, 2011 (edited) Afternoon All, I was recommended Autoit to help GUI my batch file and make it more user friendly. When Openeing my batch file with SciTE it finds several syntax issues eg - CD\ Does it have the capability of correcting these or can you suggest what the best way to convert to au3 would be so I can create my .exe? I have done a search on the site, but might be missing the obvious? Any help would be appreciated. All the best, Iain. Edited June 21, 2011 by Iain Link to comment Share on other sites More sharing options...
Iain Posted June 21, 2011 Author Share Posted June 21, 2011 (edited) This is my script expandcollapse popupcd\ cls @echo off :RESTART %windir%\system32\xcopy.exe "\\app-server\USMT\Engine\dsmod.exe" "%systemroot%\system32" /y /q %windir%\system32\xcopy.exe "\\app-server\USMT\Engine\dsquery.exe" "%systemroot%\system32" /y /q ECHO DSQUERY AND DSMOD COPIED TO SYSTEM32 cd\ @echo off cls goto menu :menu echo. echo Where do you want to back the users data to? echo. echo Choice echo. echo 1 Network Location echo 2 USB Drive echo 3 Local Disk C:\ echo 4 Quit echo. :choice set /P C=[Press 1 2 3 or 4 to Quit ] if "%c%"=="1" goto network if "%c%"=="2" goto usb if "%c%"=="3" goto local if "%c%"=="4" goto end REM ####START OF NETWORK SECTION#### :network cls echo Specify the username for the data storage folder e.g David.Charlton set /p Folder_Name= cls SET Choice= echo ............................................................................ echo ............................................................................ SET /P Choice=THE FOLDER "%Folder_Name%" WILL BE CREATED. SHALL WE PROCEED [Y,N]? IF /I '%Choice%'=='Y' GOTO START IF /I '%Choice%'=='N' GOTO RESTART :START md \\n03xp01\usmt\%Folder_Name% cd\ dsquery user -name %Folder_Name% | dsmod group "CN=Desktop Data Transfer,OU=Groups,OU=Migrated objects,DC=Sageukie,DC=adinternal,DC=com" -addmbr pause: @echo off Rem Begin USMT Rem Copy USMT files locally cd\ MD USMT %windir%\system32\xcopy.exe "\\app-server\usmt\usmt\*.*" "c:\USMT" /y /q Rem begin scanstate (also creates directory of username) echo .................................................................................. echo TRANSFERRING FILES AND SETTINGS TO NETWORK LOCATION \\n03xp01\usmt\%Folder_Name% echo .................................................................................. c:\usmt\scanstate.exe \\n03xp01\usmt\%Folder_Name% /i:miguser.xml /i:migapp.xml /i:migsys.xml /ue:*\* /ui:sageukie\%Folder_Name% /localonly /o /c pause: goto end :usb rem ####START OF USB COPY SECTION#### rem ####find removable drives#### cls @echo off setlocal enabledelayedexpansion set UsbNum=0 for %%a in (a b c d e f g h i j k l m n o p q r s t u v w x y z) do ( for /f %%h in ('fsutil fsinfo drivetype %%a:^|findstr "Removable"') do ( set /a UsbNum+=1 set DriveU!UsbNum!=%%h ) ) echo You have !UsbNum! removable drives, shown below: for /l %%a in (1,1,!UsbNum!) do ( echo.!DriveU%%a! ) if "!usbnum!"=="1" goto startusb if NOT "!usbnum!"=="1" goto multiusb endlocal :multiusb rem #### IF YOU HAVE MORE THAN ONE REMOVEABLE DRIVE#### cls echo. echo ******** WARNING WARNING WARNING!!!!!! ******** echo. echo ******** I HAVE DETECTED EITHER MORE THAN ONE REMOVEABLE USB DRIVE OR NO REMOVABLE DRIVE IS PRESENT! ******** echo. echo ******** PLEASE CHECK YOUR USB CONNECTION AND MAKE SURE ONLY ONE DRIVE IS INSERTED ******** echo. pause rem :end exit :startusb rem ####JUST ONE DRIVE, LETS CRACK ON...#### cls echo Specify the username for the data storage folder e.g David.Charlton set /p Folder_Name= cls SET Choice= echo ............................................................................ echo ............................................................................ SET /P Choice=THE FOLDER "%Folder_Name%" WILL BE CREATED. SHALL WE PROCEED [Y,N]? IF /I '%Choice%'=='Y' GOTO START IF /I '%Choice%'=='N' GOTO RESTART :START setlocal enabledelayedexpansion set UsbNum=0 for %%a in (a b c d e f g h i j k l m n o p q r s t u v w x y z) do ( for /f %%h in ('fsutil fsinfo drivetype %%a:^|findstr "Removable"') do ( set /a UsbNum+=1 set DriveU!UsbNum!=%%h ) ) echo You have !UsbNum! removable drives, shown below: for /l %%a in (1,1,!UsbNum!) do ( echo.!DriveU%%a! md "!DriveU%%a!"\usmt\%Folder_Name% @echo off Rem Begin USMT Rem Copy USMT files locally cd\ MD USMT %windir%\system32\xcopy.exe "\\app-server\usmt\usmt\*.*" "c:\USMT" /y /q Rem begin scanstate (also creates directory of username) echo .................................................................................. echo TRANSFERRING FILES AND SETTINGS TO USB DRIVE "!DriveU%%a!"\usmt\%Folder_Name% echo .................................................................................. c:\usmt\scanstate.exe "!DriveU%%a!"\usmt\%Folder_Name% /i:miguser.xml /i:migapp.xml /i:migsys.xml /ue:*\* /ui:sageukie\%Folder_Name% /localonly /o /c ) endlocal pause :end exit rem ###### start of local copy section ###### :local cls echo Specify the username for the data storage folder e.g David.Charlton set /p Folder_Name= cls SET Choice= echo ............................................................................ echo ............................................................................ SET /P Choice=THE FOLDER "%Folder_Name%" WILL BE CREATED. SHALL WE PROCEED [Y,N]? IF /I '%Choice%'=='Y' GOTO START IF /I '%Choice%'=='N' GOTO RESTART :START md c:\usmtmig\%Folder_Name% @echo off Rem Begin USMT Rem Copy USMT files locally cd\ MD USMT %windir%\system32\xcopy.exe "\\app-server\usmt\usmt\*.*" "c:\USMT" /y /q Rem begin scanstate (also creates directory of username) echo ....................................................................... echo TRANSFERRING FILES AND SETTINGS TO LOCAL DRIVE c:\usmtmig\%Folder_Name% echo ....................................................................... c:\usmt\scanstate.exe c:\usmtmig\%Folder_Name% /i:miguser.xml /i:migapp.xml /i:migsys.xml /ue:*\* /ui:sageukie\%Folder_Name% /localonly /o /c pause: :end exit Edited June 21, 2011 by SmOke_N Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted June 21, 2011 Moderators Share Posted June 21, 2011 Iain,Welcome to the AutoIt forum. I am afraid that there is rather more to converting bat files to AutoIt code than just opening them in SciTE. You need to understand the syntax of AutoIt so you can replace the DOS commands with new ones. Reading the Help file (at least the first few sections - Using AutoIt, Tutorials and the first couple of References) will help you enormously. You should also look at the excellent tutorials that you will find here and here - you will find other tutorials in the Wiki (the link is at the top of the page). There are even video tutorials on YouTube if you prefer watching to reading. You will find that there is no great difficulty in converting bat files to AutoIt code - once you have got the hang of it you will wonder what the problem was. But you do need to take a while to get to grips with the various functions first. Good luck - you know where we are if you get stuck! M23P.S. I have just seen your code - in future when you post code please use Code tags. Put [autoit] before and [/autoit] after your posted code - it then appears in nice scrollable boxes. You cannot edit your posts until you have made a few more - I will ask a Mod to do it for you in this case. Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Iain Posted June 21, 2011 Author Share Posted June 21, 2011 M23, Thanks for the informative reply mate! Appreciate it!! I will hit the help files and hopefully one day I will look back and think what the fuss was about haha. Again, much appreciated. Iain. Link to comment Share on other sites More sharing options...
guinness Posted June 21, 2011 Share Posted June 21, 2011 To get you on your way have a look at Run(), StringInStr(), ConsoleWrite(), FileCopy(), DirCopy(), DirCreate() & DriveGetDrive() to name but a few. Good Luck! UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 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