Jump to content

Can some one help me convert this file to autoit?


Recommended Posts

The code is:

@echo off
set m2ver=Alpha 1.0.1
set m2=%~dp0
if not exist %~dp0\lib\nul (
    set b=%cd%
    cd %m2%
    md lib
    cd %b%
)
set lib=%~dp0\lib
set me=%~1
if not exist "%me%" goto end
for /f "eol=/ delims=" %%i in (%me%) do call :executer %%i

:executer
if "%~1"=="" goto end
if "%~1"=="#define" goto define
if "%~1"=="#include" goto include
if "%~1"=="#goto" goto goto
if "%~1"=="#execute" goto execute
if "%~1"=="#call" goto call
if "%~1"=="#if" goto if
if "%~1"=="#ifnot" goto ifnot
if "%~1"=="#while" goto while
if "%~1"=="#ver" goto ver
goto out-commands

:ver
echo Official M2 Installed
echo Version: %m2ver%
goto end

:while
:wst
if %~2 (
    call :executer %~3
    call :executer %~4
    call :executer %~5
    goto wst
)
goto end

:call
if exist "%~2" for /f "eol=/ delims=" %%i in (%~2) do call :executer %%i
goto end

:execute
if exist "%~2" call %~2 %~3
goto end

:ifnot
if not %~2 call :executer %3 %4 %5 %6 %7 %8 %9
goto end

:if
if %~2 call :executer %3 %4 %5 %6 %7 %8 %9
goto end

:restart
for /f "eol=/ delims=" %%i in (%me%) do call :executer %%i
goto end

:goto
set i=%~2
set /a lines=%i%-1
if "%i%"=="0" goto restart
if "%lines%"=="0" goto restart
for /f "skip=%lines% eol=/ delims=" %%i in (%me%) do call :executer %%i
goto end

:define
if "%~2"=="" goto end
if "%~3"=="" goto end
set %~2=%~3
goto end

:include
if not exist %lib%\%~2\nul goto end
path %path%;%lib%\%~2
goto end

:out-commands
if not exist "%lib%\%~1\%~2.bat" goto end
call %~2.bat %3 %4 %5 %6 %7 %8 %9
goto end

:end

Thank you for helping me!

Link to comment
Share on other sites

Welcome to AutoIt forums Mihail! :welcome:, What are you trying to do with that batch script? Since its beyond my scope to convert it to AutoIt script, you can try these resources to get down the basics of AutoIt, TD :)

EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time)

DcodingTheWeb Forum - Follow for updates and Join for discussion

Link to comment
Share on other sites

Super trivial to convert, you need (not in this order)

FileExists, If...EndIf, Local/Global, While, Calling functions, For...Next.

// THERE IS NO GOTO IN AutoIt

 

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 parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Link to comment
Share on other sites

Welcome to Autoit and the forum!
As we do not spoon feed users here, can you please show us what you have tried so far?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

  • 2 weeks later...

Hi MihailProgramming, I think what you need to know is that you can write a AU3 script that looks and works much like a bat.  Thats where I started, basic batch, just on steroids...

However, using AutoIts GUI capabilities you can either just put a simple GUI on it, to hide what your script is doing, or you can actually create a full GUI where everything uses all of AutoIT.  

Perhaps start with just basics - make a very simple au3 script that jsut does exactly the same with no GUI components.  Once you get the hang of it, the rest will come easily. :)

Good luck

Skysnake

Why is the snake in the sky?

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...