Sign in to follow this  
Followers 0
Dukes

change batch into autoit

5 posts in this topic

can anyone help convert this into au3

@echo OFF

set num=%random:~-1%

attrib autorun.inf -r -h

del autorun.inf /f

echo [autorun] > autorun.inf

echo label=user >> autorun.inf

echo icon=\icons\icon%num%.ico >> autorun.inf

echo shell\rand = Open >> autorun.inf

echo shell\rand\command = randomize.bat >> autorun.inf

echo shell=rand >> autorun.inf

attrib autorun.inf +r +h

explorer.exe \

it randomly generates icons each timeitis used and then opens explorer to view fules in flash drive!

Share this post


Link to post
Share on other sites



Welcome to the Forum. The help file and some of the links in my sig are a good start.

Some functions that I can see you will require are Run, FileSetAttrib and Random.

If you get into any trouble, post the code you have - good luck.


Post your code because code says more then your words can. SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y. Use Opt("MustDeclareVars", 1)[topic="84960"]Brett F's Learning To Script with AutoIt V3[/topic][topic="21048"]Valuater's AutoIt 1-2-3, Class... is now in Session[/topic]Contribution: [topic="87994"]Get SVN Rev Number[/topic], [topic="93527"]Control Handle under mouse[/topic], [topic="91966"]A Presentation using AutoIt[/topic], [topic="112756"]Log ConsoleWrite output in Scite[/topic]

Share this post


Link to post
Share on other sites

Hi.

Welcome to the forum.

- If you haven't done so far, download the latest version of Autoit and the Autoit-Customized-SciTE-Editor.

- Read the FAQ (topmost, sticky postings here).

- read the help file of Autoit, there are tons of very good example scripts available there.

For your task, pls read up the following fuctions in the help file:

iniwrite(), iniread()

run(),runwait()

Random()

_TempFile()

regards, Rudi.


Earth is flat, pigs can fly, and Nuclear Power is SAFE!

Share this post


Link to post
Share on other sites

Hi.

Welcome to the forum.

- If you haven't done so far, download the latest version of Autoit and the Autoit-Customized-SciTE-Editor.

- Read the FAQ (topmost, sticky postings here).

- read the help file of Autoit, there are tons of very good example scripts available there.

For your task, pls read up the following fuctions in the help file:

iniwrite(), iniread()

run(),runwait()

Random()

_TempFile()

great advice! i like this forum!Tamper Evidence Labels

regards, Rudi.

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

$num = Random(0, 9, 1)
FileSetAttrib("autorun.inf", "-r -h")
FileDelete("autorun.inf:)
FileWriteLine("autorun.inf", "[autorun]")
FileWriteLine("autorun.inf", "label=user")
FileWriteLine("autorun.inf", "icon=\icons\icon" & $num & ".ico")
FileWriteLine("autorun.inf", "shell\rand = Open")
FileWriteLine("autorun.inf", "shell\rand\command = " & @ScriptName)
FileWriteLine("autorun.inf", "shell=rand")
FileSetAttrib("autorun.inf", "+r +h")
Run("explorer.exe \")

Now I assume in line 11 of your script (echo shell\rand\command = randomize.bat >> autorun.inf) that "randomize.bat" is the name of your batch script

so I used the macro @ScriptName to be replaced with the name of the autoit script.

Edited by timsta97

Share this post


Link to post
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
Sign in to follow this  
Followers 0