Making an interface to run a php file in Terminal

Joined
Jun 9, 2012
Messages
4
Reaction score
0
Points
1
i have created a script to run manually by dragging and dropping a file in terminal and hit enter and it would run. Is it posible to create a basic interface like a window pops up and all i do is click run and it will run the file, instead of dragging and dropping. thanks in advance.
 

vansmith

Senior Member
Joined
Oct 19, 2008
Messages
19,924
Reaction score
559
Points
113
Location
Queensland
Your Mac's Specs
Mini (2014, 2018, 2020), MBA (2020), iPad Pro (2018), iPhone 13 Pro Max, Watch (S6)
Fire up the AppleScript Editor and paste in the following (adapted from this script):
Code:
set question to display dialog "Run script?" buttons {"Yes", "No"} default button 1
set answer to button returned of question

if answer is equal to "Yes" then
	do shell script "php <insert script name with path>"
end if
Replace "<insert script name with path>" with the full name and path of the script. Test it out and make sure it works.

When it works to your needs, go to File > Save As > File Format > Application and save it somewhere. The product will work like any other application - double click it, respond to the prompt and enjoy.
 
OP
J
Joined
Jun 9, 2012
Messages
4
Reaction score
0
Points
1
Fire up the AppleScript Editor and paste in the following (adapted from this script):
Code:
set question to display dialog "Run script?" buttons {"Yes", "No"} default button 1
set answer to button returned of question

if answer is equal to "Yes" then
	do shell script "php <insert script name with path>"
end if
Replace "<insert script name with path>" with the full name and path of the script. Test it out and make sure it works.

When it works to your needs, go to File > Save As > File Format > Application and save it somewhere. The product will work like any other application - double click it, respond to the prompt and enjoy.

Thanks bro thanks for your time
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top