View previous topic :: View next topic |
Author |
Message |
Lynxz Gaming Expert Cheater Reputation: 4
Joined: 01 Jul 2017 Posts: 208 Location: help
|
Posted: Mon Feb 19, 2018 7:12 am Post subject: open special folder in C: [help] |
|
|
how to open special folder in C
like:
shellExecute("C:\Users\(pcname)\AppData\Local\Growtopia")
how to make it work on all computer
|
|
Back to top |
|
|
Corroder Grandmaster Cheater Supreme Reputation: 75
Joined: 10 Apr 2015 Posts: 1667
|
Posted: Mon Feb 19, 2018 8:46 am Post subject: Re: open special folder in C: [help] |
|
|
Lynxz Gaming wrote: | how to open special folder in C
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()
|
_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL |
|
Back to top |
|
|
FreeER Grandmaster Cheater Supreme Reputation: 53
Joined: 09 Aug 2013 Posts: 1091
|
Posted: Mon Feb 19, 2018 9:13 am Post subject: |
|
|
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.
_________________
|
|
Back to top |
|
|
Lynxz Gaming Expert Cheater Reputation: 4
Joined: 01 Jul 2017 Posts: 208 Location: help
|
Posted: Mon Feb 19, 2018 10:09 am Post subject: |
|
|
thank you corroder and FreeEr
|
|
Back to top |
|
|
AylinCE Grandmaster Cheater Supreme Reputation: 32
Joined: 16 Feb 2017 Posts: 1250
|
Posted: Mon Feb 19, 2018 10:51 am Post subject: Re: open special folder in C: [help] |
|
|
Lynxz Gaming wrote: | how to open special folder in C
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.
_________________
|
|
Back to top |
|
|
|