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 


CE Internet Radio [Implementing os.execute]

 
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: Fri Mar 30, 2018 9:25 pm    Post subject: CE Internet Radio [Implementing os.execute] This post has 1 review(s) Reply with quote

Hi there,

Just sharing small Lua script about how to make Internet Radio that maybe you can enjoy and have fun...

Note :
- I'm use firefox 59, CE 6.7 and Windows 7 64 bit Ultimate Edition
- Change 'firefox.exe' to 'your browser process name'. i.e : 'ie.exe' for Internet Explorer, 'chrome.exe' for Google Chrome, etc
- Find out your own radio URL and put it to the provided script
- You need 'GOOD Internet Connection'

Just copy and paste these script below to your CE Lua Script Table and save / execute as CT file.

Code:
f = createForm()
f.width,f.height = 200,50
f.position = 'poScreenCenter'
f.caption = 'CRDR - CE Internet Radio'
f.BorderStyle = 'bsDialog'

cb = createComboBox(f)
cb.width = 170
cb.top = 12
cb.left = (f.width - cb.width) / 2
cb.style = 'csDropdownList'

cbitem = combobox_getItems(cb)
strings_clear(cbitem)
strings_add(cbitem, 'Choose Radio Station')
strings_add(cbitem, 'Air Spectrum Stream')
strings_add(cbitem, 'US3 Stream')
strings_add(cbitem, 'US3 Live')
strings_add(cbitem, 'UK7 Stream')
strings_add(cbitem, 'UK5 Stream')
strings_add(cbitem, 'Big-B KPOP')
strings_add(cbitem, 'Aewen KPOP')

setProperty(cb, "ItemIndex", "0")
all_enabled = 0

function rad1()
 os.execute("taskkill /F /IM firefox.exe")
 cmd = 'start /min firefox.exe '..'http://airspectrum.cdnstream1.com:8122/1652_128'..' -headless'
 os.execute(cmd)
end

function rad2()
 os.execute("taskkill /F /IM firefox.exe")
 cmd = 'start /min firefox.exe '..'http://us3.internet-radio.com:8007/;stream'..' -headless'
 os.execute(cmd)
end

function rad3()
 os.execute("taskkill /F /IM firefox.exe")
 cmd = 'start /min firefox.exe '..'http://us3.internet-radio.com:8169/live'..' -headless'
 os.execute(cmd)
end

function rad4()
 os.execute("taskkill /F /IM firefox.exe")
 cmd = 'start /min firefox.exe '..'http://uk7.internet-radio.com:8226/;stream'..' -headless'
 os.execute(cmd)
end

function rad5()
 os.execute("taskkill /F /IM firefox.exe")
 cmd = 'start /min firefox.exe '..'http://uk5.internet-radio.com:8163/;stream'..' -headless'
 os.execute(cmd)
end

function rad6()
 os.execute("taskkill /F /IM firefox.exe")
 cmd = 'start /min firefox.exe '..'http://64.71.79.181:8040/;'..' -headless'
 os.execute(cmd)
end

function rad7()
 os.execute("taskkill /F /IM firefox.exe")
 cmd = 'start /min firefox.exe '..'http://37.72.100.39:8001/stream'..' -headless'
 os.execute(cmd)
end

myRadio = {rad1, rad2, rad3, rad4, rad5, rad6, rad7}

function selectRadio(option)
 option = cb.ItemIndex
 if option == -1 then return end
  myFunc = myRadio[option]
 if myFunc ~= nil then
  myFunc()
 else
  return
 end
end

function exit()
 f.hide()
 showMessage('Good bye dude...  Have a nice day!')
 os.execute("taskkill /F /IM firefox.exe")
 closeCE()
 return caFree
end

f.show()
cb.onChange = selectRadio
f.onClose = exit


Need to do :
-- How to avoid cmd windows pop-up / blink pop-up when using 'os.execute("tskill /IM /F..app name..")'

Cheers.... Cool

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

Joined: 01 Oct 2008
Posts: 938

PostPosted: Sat Mar 31, 2018 2:53 am    Post subject: Reply with quote

Using shellExecute with 4th parameter one of following (@defines.lua)
Code:

--shellExecute show defines:
SW_HIDE = 0;
SW_MAXIMIZE = 3;
SW_MINIMIZE = 6;
SW_NORMAL = 1;
SW_RESTORE = 9;
SW_SHOW = 5;
SW_SHOWDEFAULT = 10;
SW_SHOWMAXIMIZED = 3;
SW_SHOWMINIMIZED = 2;
SW_SHOWMINNOACTIVE = 7;
SW_SHOWNA = 8;
SW_SHOWNOACTIVATE = 4;
SW_SHOWNORMAL = 1;


It seems for compatibility, a 'false' will hide too.
Note that, by 'hiding', there may be possibility to leave some orphan process if it need input before it terminate.
eg. this line will leave a cmd process under cheatengine each time run (can be seen from task manager)
Code:

shellExecute("cmd.exe","/c dir * && pause",nil, false)

They will gone when parent CE process closed.

_________________
- Retarded.
Back to top
View user's profile Send private message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Sat Mar 31, 2018 9:47 am    Post subject: Reply with quote

Thanks Panraven for help,

anyway,
Code:

shellExecute("cmd.exe", "/c calc.exe", 0, SW_HIDE)


will open windows calculator without leave orphans process and 'cmd windows' not pop-up, but :
Code:

shellExecute("cmd.exe", "taskkill /F /IM calc.exe", 0, SW_HIDE);


or

Code:
shellExecute("taskkill /F /IM calc.exe")


do nothing. Is it mean 'taskkill' will not work if using 'shellExecute()' ?

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

Joined: 01 Oct 2008
Posts: 938

PostPosted: Sat Mar 31, 2018 6:53 pm    Post subject: Reply with quote

Code:

shellExecute(command, parameters OPTIONAL, folder OPTIONAL, showcommand OPTIONAL): Executes a given command

'command' should be path to an *.exe, not including its parameters.
Parameters should be set on 2nd input.

for taskkill case, probably it is not a sub-command of cmd.exe shell but itself an *.exe.
May try
Code:

shellExecute('taskkill','/F /IM calc.exe')


Also, for parameters of cmd.exe, I guess the sub-command (dir etc) has to preceded by cmd.exe's own parameter '/c', which tell the shell close after the sub-command done.
Check "cmd /?".

bye~

_________________
- Retarded.
Back to top
View user's profile Send private message
Corroder
Grandmaster Cheater Supreme
Reputation: 75

Joined: 10 Apr 2015
Posts: 1667

PostPosted: Sat Mar 31, 2018 9:02 pm    Post subject: Reply with quote

Alright, this one is work :

Code:
shellExecute("taskkill","/IM chrome.exe",SW_HIDE)


even SW_HIDE not work, mean cmd pop-up window still appear/blink for seconds.

EDIT :
This one work properly without cmd pop-up window :

Code:
shellExecute("taskkill", "/IM chrome.exe", NULL, SW_HIDE)


Again, thank for help, Panraven...

_________________
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