Jump to content

Converting Batch File to AutoIt and I want splish screen


Recommended Posts

I want to convert batch file to AutoIt , and I want splish screen without frame when .netframework is to be installed. Is it possible??

@ECHO OFF
SETLOCAL
SET "M=Autoplay.exe"
SET "S=123\test\Microsoft .NET Framework 4.0\Setup.exe"
SET "F="
SET "N=HKLM\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\"
SET "_="

FOR /F %%A IN ('MOUNTVOL^|FINDSTR [C-Z]:\\') DO (IF EXIST "%%A%M%" SET "_=%%A")
IF NOT DEFINED _ (
    ECHO= %M% not found
    ECHO= Press any key to exit
    PAUSE >NUL
    GOTO :EOF)

IF NOT EXIST "%_%%S%" (
    ECHO= %_%%S% not found
    ECHO= Press any key to exit
    PAUSE >NUL
    GOTO :EOF)

FOR %%A IN (Client Full) DO (
    REG QUERY "%N%%%A" /V INSTALL >NUL 2>&1 && SET "F=Yes")
IF NOT DEFINED F (
    ECHO= %S:\Setup.exe=% not found
    ECHO=
    ECHO= Installing %S:\Setup.exe=%...
    CALL :PRE)

:MAIN
IF DEFINED F (
    ECHO= Now Installing %M%
    ECHO=
    ECHO= Please wait...
    ECHO=
    "%_%%M%"
    PING -n 8 127.0.0.1 1>NUL) ELSE (ECHO=
    ECHO= Installation Failure
    ECHO= Press any key to exit
    PAUSE >NUL)
GOTO :EOF

:PRE
ECHO=
START "" /WAIT "%_%%S%" /q /norestart && (SET F=Yes)
Link to comment
Share on other sites

Please wait 24h before bumping your own threads.

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

  • Moderators

Just because it is the most important thing in the world to you does not mean it is for anyone else. To answer your question, yes - it is possible. Now how about you show some effort and work at figuring it out?

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

  • Moderators

AHRIMANSEFID, you simply are not going to receive help if you refuse to put forth any effort. Why don't you at least try to do something on your own, rather than begging others? Even if it isn't working the way you want, post what you have done, and we can assist from there.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Here is a 1 to 1 translation of the CMD code to AutoIt3 code. It is has multiple blocks of code to handle $F which you could merge into one block. Some useless code that could be removed. Perhaps enough code in it so that you can clean it up or perhaps rewrite and make something good from it.

;@ECHO OFF
;SETLOCAL
;SET "M=Autoplay.exe"
;SET "S=123\test\Microsoft .NET Framework 4.0\Setup.exe"
;SET "F="
;SET "N=HKLM\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\"
;SET "_="

$M = 'Autoplay.exe'
$S = '123\test\Microsoft .NET Framework 4.0\Setup.exe'
$F = ''
$N = 'HKLM\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\'
$_ = ''

;FOR /F %%A IN ('MOUNTVOL^|FINDSTR [C-Z]:\\') DO (IF EXIST "%%A%M%" SET "_=%%A")
;IF NOT DEFINED _ (
;    ECHO= %M% not found
;    ECHO= Press any key to exit
;    PAUSE >NUL
;    GOTO :EOF)

$A = DriveGetDrive('ALL')
If IsArray($A) Then
    For $1 = 1 To UBound($A) -1
        If DriveStatus($A[$1]) = 'READY' And FileExists($A[$1] & '\' & $M) Then
            $_ = $A[$1]
            ExitLoop
        EndIf
    Next
    $A = ''
EndIf
If $_ == '' Then
    MsgBox(0x40030, @ScriptName, $M & ' not found' & @CRLF & 'Click OK to exit')
    Exit 1 ; Goto :EOF
EndIf

;IF NOT EXIST "%_%%S%" (
;    ECHO= %_%%S% not found
;    ECHO= Press any key to exit
;    PAUSE >NUL
;    GOTO :EOF)

If Not FileExists($_ & '\' & $S) Then
    MsgBox(0x40030, @ScriptName, $_ & '\' & $S & ' not found')
    Exit 1 ; Goto :EOF
EndIf

;FOR %%A IN (Client Full) DO (
;    REG QUERY "%N%%%A" /V INSTALL >NUL 2>&1 && SET "F=Yes")

For $A In StringSplit('Client Full', ' ', 3)
    $F = RegRead($N & $A, 'Install')
    If $F == '1' Then ExitLoop
Next

;IF NOT DEFINED F (
;    ECHO= %S:\Setup.exe=% not found
;    ECHO=
;    ECHO= Installing %S:\Setup.exe=%...
;    CALL :PRE)

If Not ($F == '1') Then
    SplashTextOn(@ScriptName, $S & ' not found' & @CRLF & 'Installing ' & $S)
    _PRE()
    SplashOff()
    Exit ; Goto :EOF
EndIf

;:MAIN
;IF DEFINED F (
;    ECHO= Now Installing %M%
;    ECHO=
;    ECHO= Please wait...
;    ECHO=
;    "%_%%M%"
;    PING -n 8 127.0.0.1 1>NUL) ELSE (ECHO=
;    ECHO= Installation Failure
;    ECHO= Press any key to exit
;    PAUSE >NUL)
;GOTO :EOF

If $F == '1' Then
    SplashTextOn(@ScriptName, 'Now installing ' & $M & @CRLF & 'Please wait...', 600, 100)
    ShellExecuteWait('"' & $_ & '\' & $M & '"')
    Sleep(8000)
    SplashOff()
Else
    ; previous block of code runs installer on a Not $F == '1' condition so why message failure here?
    ; this code will never be run due to previous block of code that reaches :EOF at going to :PRE
    MsgBox(0x40000, @ScriptName, 'Installation failure. Click OK to exit.')
EndIf

Exit ; Goto :EOF

;:PRE
;ECHO=
;START "" /WAIT "%_%%S%" /q /norestart && (SET F=Yes)

Func _PRE()
    SplashTextOn(@ScriptName, 'Now installing ' & $_ & '\' & $S & @CRLF & 'Please wait...', 600, 100)
    ShellExecuteWait('"' & $_ & '\' & $S & '"', '/q /norestart')
    SplashOff()
    ; setting $F seems useless here just before reaching :EOF
    $F = '1'
EndFunc

Happy coding ;)

Link to comment
Share on other sites

#MHz

thank you very much in deed

how much should I pay?

I have another project, C#, sqlite ,I wanna convert it to AutoIt too. would you please do it for me. I post this project in freelancer , and I'll pay project cost.

Edited by AHRIMANSEFID
Link to comment
Share on other sites

Your welcome and what I posted was a gift. That is my usual custom here. If you have lots of money and wish to support AutoIt, then may I suggest a donation. Donating is entirely your choice.

The other project you have, you can post that on a freelance site as you mention. Perhaps someone could be interested, though it might be nice for you to give it a try and do the conversion yourself.

P.S. The variable names in the CMD script have a MSFN sequence. Like a website I know though it is probably coincidental. :D

Link to comment
Share on other sites

Thanks for your answer,I define this project in freelancer but there in no one there that have this ability to solve my project,non of them know autoit,I haven't lots of money I just have no time:) I can pay you donation to you if want help me in this project ,and thaks lot for your gift and your time.

Link to comment
Share on other sites

Here is a 1 to 1 translation of the CMD code to AutoIt3 code. It is has multiple blocks of code to handle $F which you could merge into one block. Some useless code that could be removed. Perhaps enough code in it so that you can clean it up or perhaps rewrite and make something good from it.

;@ECHO OFF
;SETLOCAL
;SET "M=Autoplay.exe"
;SET "S=123\test\Microsoft .NET Framework 4.0\Setup.exe"
;SET "F="
;SET "N=HKLM\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\"
;SET "_="

$M = 'Autoplay.exe'
$S = '123\test\Microsoft .NET Framework 4.0\Setup.exe'
$F = ''
$N = 'HKLM\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\'
$_ = ''

;FOR /F %%A IN ('MOUNTVOL^|FINDSTR [C-Z]:\\') DO (IF EXIST "%%A%M%" SET "_=%%A")
;IF NOT DEFINED _ (
;    ECHO= %M% not found
;    ECHO= Press any key to exit
;    PAUSE >NUL
;    GOTO :EOF)

$A = DriveGetDrive('ALL')
If IsArray($A) Then
    For $1 = 1 To UBound($A) -1
        If DriveStatus($A[$1]) = 'READY' And FileExists($A[$1] & '\' & $M) Then
            $_ = $A[$1]
            ExitLoop
        EndIf
    Next
    $A = ''
EndIf
If $_ == '' Then
    MsgBox(0x40030, @ScriptName, $M & ' not found' & @CRLF & 'Click OK to exit')
    Exit 1 ; Goto :EOF
EndIf

;IF NOT EXIST "%_%%S%" (
;    ECHO= %_%%S% not found
;    ECHO= Press any key to exit
;    PAUSE >NUL
;    GOTO :EOF)

If Not FileExists($_ & '\' & $S) Then
    MsgBox(0x40030, @ScriptName, $_ & '\' & $S & ' not found')
    Exit 1 ; Goto :EOF
EndIf

;FOR %%A IN (Client Full) DO (
;    REG QUERY "%N%%%A" /V INSTALL >NUL 2>&1 && SET "F=Yes")

For $A In StringSplit('Client Full', ' ', 3)
    $F = RegRead($N & $A, 'Install')
    If $F == '1' Then ExitLoop
Next

;IF NOT DEFINED F (
;    ECHO= %S:\Setup.exe=% not found
;    ECHO=
;    ECHO= Installing %S:\Setup.exe=%...
;    CALL :PRE)

If Not ($F == '1') Then
    SplashTextOn(@ScriptName, $S & ' not found' & @CRLF & 'Installing ' & $S)
    _PRE()
    SplashOff()
    Exit ; Goto :EOF
EndIf

;:MAIN
;IF DEFINED F (
;    ECHO= Now Installing %M%
;    ECHO=
;    ECHO= Please wait...
;    ECHO=
;    "%_%%M%"
;    PING -n 8 127.0.0.1 1>NUL) ELSE (ECHO=
;    ECHO= Installation Failure
;    ECHO= Press any key to exit
;    PAUSE >NUL)
;GOTO :EOF

If $F == '1' Then
    SplashTextOn(@ScriptName, 'Now installing ' & $M & @CRLF & 'Please wait...', 600, 100)
    ShellExecuteWait('"' & $_ & '\' & $M & '"')
    Sleep(8000)
    SplashOff()
Else
    ; previous block of code runs installer on a Not $F == '1' condition so why message failure here?
    ; this code will never be run due to previous block of code that reaches :EOF at going to :PRE
    MsgBox(0x40000, @ScriptName, 'Installation failure. Click OK to exit.')
EndIf

Exit ; Goto :EOF

;:PRE
;ECHO=
;START "" /WAIT "%_%%S%" /q /norestart && (SET F=Yes)

Func _PRE()
    SplashTextOn(@ScriptName, 'Now installing ' & $_ & '\' & $S & @CRLF & 'Please wait...', 600, 100)
    ShellExecuteWait('"' & $_ & '\' & $S & '"', '/q /norestart')
    SplashOff()
    ; setting $F seems useless here just before reaching :EOF
    $F = '1'
EndFunc

Happy coding ;)

Oh, this is perfect.

i am from XDA forum, we always use .bat to create tools for Android devices.

I am going to read your code then learn them.

Thank you so much

And, can you tell me or show me more example with "cmd command to autoit"

Link to comment
Share on other sites

Splish >>> Splash

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

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