| View previous topic :: View next topic |
| Author |
Message |
Hacubi How do I cheat?
Reputation: 0
Joined: 29 Nov 2020 Posts: 5
|
Posted: Wed Dec 09, 2020 9:57 am Post subject: Select Directory |
|
|
need help about this
i just want to select the the directory of an exe using button1, then it will show its name on textbox, is that possible?
also i have button2 to run exe using shellcode,
| Description: |
Sample button1(select) button2(Run exe)
textbox(show exe name) |
|
| Filesize: |
10.63 KB |
| Viewed: |
1450 Time(s) |

|
_________________
Just a Passerby |
|
| Back to top |
|
 |
ByTransient Expert Cheater
Reputation: 5
Joined: 05 Sep 2020 Posts: 240
|
Posted: Wed Dec 09, 2020 12:03 pm Post subject: |
|
|
You cannot open many files by name.
Example: Can run "textFile.txt" with "notepad.exe".
"shellExecute ()" will ask for the file path.
Below is an example you can edit.
| Code: | if f then f.destroy() end
f=createForm(true)
f.Position=poDesktopCenter
f.Width=255 f.Height=105
e1 = createEdit(f)
e1.Height=24 e1.Left=5 e1.Top=10 e1.Width=160
e2 = createEdit(f)
e2.Height=24 e2.Left=5 e2.Top=40 e2.Width=245 --e2.visible=false -- or true !
b1 = createButton(f)
b1.Left=175 b1.Top=9 b1.caption="Select"
b2 = createButton(f)
b2.Left=5 b2.Top=70 b2.Width=160 b2.caption="Run Solitaire"
local file_name = ""
b1.OnClick=function()
local file_dialog = createOpenDialog()
file_dialog.InitialDir = os.getenv('%USERPROFILE%')
file_dialog.Filter = 'All files (*.*)|*'
if file_dialog.execute() then
file_name = file_dialog.FileName
name=file_name:match("[^\\]*$")
name1 = string.match(name, '(.*).exe')
b2.caption="Open: "..name1
e2.Text=file_name
e1.Text=name
return
else
return nil
end
end
b2.OnClick=function()
shellExecute(e2.Text) -- or file_name
end |
|
|
| Back to top |
|
 |
Hacubi How do I cheat?
Reputation: 0
Joined: 29 Nov 2020 Posts: 5
|
Posted: Wed Dec 09, 2020 12:30 pm Post subject: |
|
|
| ByTransient wrote: | You cannot open many files by name.
Example: Can run "textFile.txt" with "notepad.exe".
"shellExecute ()" will ask for the file path.
Below is an example you can edit.
| Code: | if f then f.destroy() end
f=createForm(true)
f.Position=poDesktopCenter
f.Width=255 f.Height=105
e1 = createEdit(f)
e1.Height=24 e1.Left=5 e1.Top=10 e1.Width=160
e2 = createEdit(f)
e2.Height=24 e2.Left=5 e2.Top=40 e2.Width=245 --e2.visible=false -- or true !
b1 = createButton(f)
b1.Left=175 b1.Top=9 b1.caption="Select"
b2 = createButton(f)
b2.Left=5 b2.Top=70 b2.Width=160 b2.caption="Run Solitaire"
local file_name = ""
b1.OnClick=function()
local file_dialog = createOpenDialog()
file_dialog.InitialDir = os.getenv('%USERPROFILE%')
file_dialog.Filter = 'All files (*.*)|*'
if file_dialog.execute() then
file_name = file_dialog.FileName
name=file_name:match("[^\\]*$")
name1 = string.match(name, '(.*).exe')
b2.caption="Open: "..name1
e2.Text=file_name
e1.Text=name
return
else
return nil
end
end
b2.OnClick=function()
shellExecute(e2.Text) -- or file_name
end |
|
Ok, thanks for the help, gonna try this,
EDIT :
Actually this is more than as I expected,
but, I made a form in form designer,
it consist of CEbutton1(select), CEbutton2(Run *.*) and CEEdit1(text)
I manage to recode the buttons but the CEEdit didn't show the file name when i select the file, im not actually confident with my code sorry
I you could show me the full code that will be a big help.
EDIT
Sorry i manage to recode, thanks for the help!
_________________
Just a Passerby |
|
| Back to top |
|
 |
ByTransient Expert Cheater
Reputation: 5
Joined: 05 Sep 2020 Posts: 240
|
Posted: Thu Dec 10, 2020 10:23 am Post subject: |
|
|
I am sorry for my late answer.
I overlooked that it might be "EDIT" instead of the new answer.
There are 2 solutions, the first is alternative to learn the solution.
The second solution may be what you want.
Just change your Trainer name instead of "UDF1".
solition (1)
| Code: |
local e1=UDF1.CEEdit1
local b1=UDF1.CEButton1
local b2=UDF1.CEButton2
b1.caption="Select"
b2.caption="Run Solitaire"
local file_name = ""
b1.OnClick=function()
local file_dialog = createOpenDialog()
file_dialog.InitialDir = os.getenv('%USERPROFILE%')
file_dialog.Filter = 'All files (*.*)|*'
if file_dialog.execute() then
file_name = file_dialog.FileName
name=file_name:match("[^\\]*$")
name1 = string.match(name, '(.*).exe')
--Print zone here
print(file_name)
b2.caption="Open: "..name1
-- e2.Text=file_name
e1.Text=name
return
else
return nil
end
end
b2.OnClick=function()
shellExecute(file_name)
end |
solition (2)
| Code: |
local file_name = ""
UDF1.CEButton1.OnClick=function()
local file_dialog = createOpenDialog()
file_dialog.InitialDir = os.getenv('%USERPROFILE%')
file_dialog.Filter = 'All files (*.*)|*'
if file_dialog.execute() then
file_name = file_dialog.FileName
name=file_name:match("[^\\]*$")
name1 = string.match(name, '(.*).exe')
--Print zone here
print(file_name)
UDF1.CEButton2.caption="Open: "..name1
--UDF1.CEEdit2.Text=file_name
UDF1.CEEdit1.Text=name
return
else
return nil
end
end
UDF1.CEButton2.OnClick=function()
shellExecute(file_name)
end |
|
|
| Back to top |
|
 |
|