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 


open special folder in C: [help]

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> Cheat Engine Lua Scripting
View previous topic :: View next topic  
Author Message
Lynxz Gaming
Advanced Cheater
Reputation: 1

Joined: 01 Jul 2017
Posts: 67

PostPosted: Mon Feb 19, 2018 7:12 am    Post subject: open special folder in C: [help] Reply with quote

how to open special folder in CConfused
like:
shellExecute("C:\Users\(pcname)\AppData\Local\Growtopia")
how to make it work on all computer
Back to top
View user's profile Send private message
Corroder
Grandmaster Cheater
Reputation: 17

Joined: 10 Apr 2015
Posts: 619

PostPosted: Mon Feb 19, 2018 8:46 am    Post subject: Re: open special folder in C: [help] Reply with quote

Lynxz Gaming wrote:
how to open special folder in CConfused
like:
shellExecute("C:\Users\(pcname)\AppData\Local\Growtopia")
how to make it work on all computer


Instead of typing full path like "C:\Users\(pcname)\AppData\Local\Growtopia", I prefer giving users the option to search for the files they want to open.

example to try :

Code:
f = createForm()
f.width,f.height = 130, 50
f.caption = ' '
b = createButton(f)
b.left,b.top,b.width,b.height = 10,10,110,30
b.Caption = 'Open File'

function GetFileName(f)
 local str = f
 local temp = ""
 local result = ""
 for i = str:len(), 1, -1 do
 if str:sub(i,i) ~= "/"  then
 temp = temp..str:sub(i,i)
 else
 break
 end
 end
 for j = temp:len(), 1, -1 do
 result = result..temp:sub(j,j)
 end
 return result
end

function exploFile()
 load_dialog = createOpenDialog(self)
 load_dialog.InitalDir = os.getenv('%USERPROFILE%')
 load_dialog.execute()
 file = load_dialog.FileName
 a = GetFileName(file)
 if a == nil then
 return a
 else
 -- print(a)  --- should be change to shellExecute here...
 shellExecute(a)
 end
end

b.onClick = exploFile
f.show()


_________________
Singapore Sling + Johnnie Walker + Some Peanuts....
Back to top
View user's profile Send private message
FreeER
Grandmaster Cheater
Reputation: 31

Joined: 09 Aug 2013
Posts: 765

PostPosted: Mon Feb 19, 2018 9:13 am    Post subject: Reply with quote

Environment variables.

local path = os.getenv('localappdata') .. '\\Growtopia'

Though letting the user provide the path is a nice extra, particularly for files that can be in different places (ie, game files don't always have to be in program files!)

Alternatively, read the path from the game... it's probably in there somewhere.

_________________
https://github.com/FreeER/ has a few CE related repos
Back to top
View user's profile Send private message
Lynxz Gaming
Advanced Cheater
Reputation: 1

Joined: 01 Jul 2017
Posts: 67

PostPosted: Mon Feb 19, 2018 10:09 am    Post subject: Reply with quote

thank you corroder and FreeEr
Back to top
View user's profile Send private message
Aylin
Expert Cheater
Reputation: 2

Joined: 16 Feb 2017
Posts: 154

PostPosted: Mon Feb 19, 2018 10:51 am    Post subject: Re: open special folder in C: [help] Reply with quote

Lynxz Gaming wrote:
how to open special folder in CConfused
like:
shellExecute("C:\Users\(pcname)\AppData\Local\Growtopia")
how to make it work on all computer


The covers you are using are arranged to take out.
With this code internally, it will enable you to open each .EXE!
Code:
shellExecute([[C:\Users\(pcname)\AppData\Local\Growtopia.exe]]);


The game you open,
with an onClick or
If you want to close with Trainer Close, tell it absolutely.
I can suggest a way. Wink

_________________
See Hitler ! This Trainer is for you!
http://forum.cheatengine.org/viewtopic.php?t=606786
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 MSN Messenger
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