Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Batch script to Lua script or AA script

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Sun Apr 01, 2018 9:51 pm    Post subject: Batch script to Lua script or AA script Reply with quote

These batch script to control system volume (increase/decrease volume) :

Code:
-- vol_up.bat  //increasing system volume
@if (@a==@b) @end /*
:: batch portion
@ECHO OFF
cscript /e:jscript "%~f0"
:: JScript portion */
var shl = new ActiveXObject("WScript.Shell");
for (var i=0; i<5; i++) {
    shl.SendKeys(String.fromCharCode(0xAF));
}


and

Code:
-- vol_dn.bat  //idecreasing system volume
@if (@a==@b) @end /*
:: batch portion
@ECHO OFF
cscript /e:jscript "%~f0"
:: JScript portion */
var shl = new ActiveXObject("WScript.Shell");
for (var i=0; i<5; i++) {
    shl.SendKeys(String.fromCharCode(0xAE));
}



Is there any chance to change those script to Lua or AA script ?

_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
TheyCallMeTim13
Wiki Contributor
Reputation: 50

Joined: 24 Feb 2017
Posts: 976
Location: Pluto

PostPosted: Sun Apr 01, 2018 10:46 pm    Post subject: This post has 1 review(s) Reply with quote

This worked for me, had no idea; had to try.

Code:
doKeyPress(0xAF)

Code:
doKeyPress(0xAE)


But the key codes aren't in the "defines.lua" file, so you'll have to define then if you want.


Code:
VK_VOL_UP = 0xAF
doKeyPress(VK_VOL_UP)

_________________
Back to top
View user's profile Send private message Visit poster's website
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Mon Apr 02, 2018 4:56 am    Post subject: Reply with quote

TheyCallMeTim13 wrote:
This worked for me, had no idea; had to try.

Code:
doKeyPress(0xAF)

Code:
doKeyPress(0xAE)


Thank a lot,, these code work properly and also done with add / register VK_VOL_UP = 0xAF and VK_VOL_DN = 0xAE to "defines.lua" on my CE 6.7


Cheers

_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
AylinCE
Grandmaster Cheater Supreme
Reputation: 31

Joined: 16 Feb 2017
Posts: 1234

PostPosted: Mon Apr 02, 2018 5:29 am    Post subject: Re: Batch script to Lua script or AA script Reply with quote

Corroder wrote:
These batch script to control system volume (increase/decrease volume) :

Code:
-- vol_up.bat  //increasing system volume
@if (@a==@b) @end /*
:: batch portion
@ECHO OFF
cscript /e:jscript "%~f0"
:: JScript portion */
var shl = new ActiveXObject("WScript.Shell");
for (var i=0; i<5; i++) {
    shl.SendKeys(String.fromCharCode(0xAF));
}


and

Code:
-- vol_dn.bat  //idecreasing system volume
@if (@a==@b) @end /*
:: batch portion
@ECHO OFF
cscript /e:jscript "%~f0"
:: JScript portion */
var shl = new ActiveXObject("WScript.Shell");
for (var i=0; i<5; i++) {
    shl.SendKeys(String.fromCharCode(0xAE));
}



Is there any chance to change those script to Lua or AA script ?


@Corroder is in pursuit of a new job.
Let's see, what will be the result. Rolling Eyes
Thanks to you; Those who know Cheat Engine,
They explore the fun side. Wink
Never back down!

--Note:
@TheyCallMeTim13; I sent the +1 RAP points.
I always thank you for your help and patience.

_________________
Hi Hitler Different Trainer forms for you!
https://forum.cheatengine.org/viewtopic.php?t=619279
Enthusiastic people: Always one step ahead
Do not underestimate me Master: You were a beginner in the past
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Mon Apr 02, 2018 6:43 am    Post subject: Reply with quote

Quote:
@Corroder is in pursuit of a new job.
Let's see, what will be the result.


Just make a simple Internet / Web Radio using CE Lua script and IDE.
and codes from @TheyCallMeTim13 use to substitute my script to call
batch files from file stream.

Code:
mypath = TrainerOrigin or getMainForm()
file1 = 'dn.bat'
file2 = 'up.bat'
findTableFile(file1).saveToFile(mypath..'\\'..file1)
findTableFile(file2).saveToFile(mypath..'\\'..file2)

function volUP()
 f = mypath..'\\'..'up.bat'
 shellExecute(f, SW_HIDE)
end

function volDN()
 f = mypath..'\\'..'dn.bat'
 shellExecute(f, SW_HIDE)
end


substitute with :

Code:
function volUP()
 doKeyPress(0xAF)
end

function volDN()
 doKeyPress(0xAE)
end


and assign that two functions to image click events.

and this to mute / unmute (toggle) windows system volume :

Code:
doKeyPress(0xAD)



CE Radio.JPG
 Description:
Simple CE Web Radio
 Filesize:  25 KB
 Viewed:  5435 Time(s)

CE Radio.JPG



_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 198

Joined: 25 Jan 2006
Posts: 8516
Location: 127.0.0.1

PostPosted: Wed Apr 04, 2018 7:41 pm    Post subject: Reply with quote

Lua has access to os.execute which can execute command line scripts, commands, etc. if you absolutely need to access the command line in that way. You can use it to launch powershell to execute powershell scripts for more power too if needed.
_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Wed Apr 04, 2018 8:59 pm    Post subject: Reply with quote

Thanks atom0s for info. And yes i have tried Powerscript also, via bath file, vbs script which call Powershell script or just test directly via command line (cmd).

Example to mute / unmute volume :

Code:
$wshShell = new-object -com wscript.shell
$wshShell.SendKeys([char]173)


All just fine. Just face one problem when using os.execute through Lua script is can not avoid cmd windows pop-up / blink. But it doesn't matter since I made my app only for my personal use.

Then these function below, actually I used to avoid cmd windows pop-up because it run not from os.execute.

Code:
function volUP()
 doKeyPress(0xAF)
end

function volDN()
 doKeyPress(0xAE)
end


Again, thank you...

_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites