I wrote a simple applescript to start to a program called "SelfControl" during startup, while I run the script with applescript editor, it launch the "SelfControl" app, but while I export the script as application, the app won't launch. I change the code to launch other app and is working fine.
I also change permission of SelfControl app to full read write access. Still no luck. Any idea what cause this?
Finally I found out what cause the problem, I named my applescript code as "SelfControl" and in my code I tell "SelfControl" to activate, which perhaps it try to launch itself than the app I want to launch.
Related
I wrote a script using the Mac script editor on Mojave (10.14.15)
The script simply launches an application with Admin privileges:
on run
do shell script ¬
"/Applications/App.app/Contents/MacOS/App" user name "name" password "pw" with administrator privileges
quit
end run
I then saved this as an application and am able to launch successfully using it.
However the application that I launch (Anki study software) can not change the input setting, which means I am unable to type in any language except the default system language.
Note that making a similar application in script editor that launches without admin privileges works without issue,
ie:
on run
do shell script ¬
"/Applications/App.app/Contents/MacOS/App"
quit
end run
This seems to be the case no matter the app I launch, I also tried launching Sublime Text and the same thing occurs.
The issue also happens when using sudo to launch an app from terminal. So it definitely seems to be an issue with trying to launch an app as root.
I am new to working with AppleScript and MacOS. It seems the fault is with launching the application with admin privileges though. Any help would be greatly appreciated.
I have written an app for OSX (Sierra) in Go (lang) with the GUI powered by the Golang QT binding therecipe/qt. When I build the app and run it from the command prompt with command open $(pwd)/myapp.app I get a terminal output while its running, and everything works fine.
When I double click on the app in finder to run it, I obviously don't have access to the console to see debugging, but in parts of the app that work fine in the GUI when I run from console (clicking on things, etc), it crashes the app when run by clicking on it.
I realise people don't know what the app is, and without seeing where in the app it crashes, they can't help me. What I am after is some ideas about debugging it, for instance:
Outputting logs to a text file and tailing the text file to watch as it is written to
Connecting a debugger to the application by the process, perhaps I can discover where it crashes. This doesn't sound straight forward
Is there a way to attach to a console of an application run like this to see what it is outputting?
Any ideas appreciated.
Thanks
Was wondering if there is any way to run a small piece of apple script when I launch an application on OS X?
I have a hard-drive which need to be mounted in order for the app to run right. I did this apple script already:
on run
try
do shell script "diskutil mountDisk disk2"
delay 3
tell application "Application"
run
end tell
on error
tell application "Application"
quit
end tell
set question to display dialog "Error." buttons {"OK"}
set answer to button returned of question
if answer is equal to "OK" then
close
end if
end try
end run
But even tho this works great and the hard-drive spins up before the app starts.
I would like to add the diskutil mountDisk disk2 and delay directly in front of the real application when its starting so I can double click files for that app say in my downloads folder. Which will run the script before it opens the clicked file in the app. So I wont have to start the application with another application each time i download a new file for it. Is this even possible?
Shortly:
It's not possible unless the application itself supports some inhook and outhook functionality.
I have a Mac OS X project (a game using SDL), and for debugging purposes when not running in xcode, I'd like to open up a terminal window that I can send text to and get line input from the user.
Is there a quick way to do this that doesn't involve creating a custom window (which is slightly problematic since the game uses SDL and I don't directly create windows)?
Opening up the standard OS X terminal would be fine, or even connecting to a separate terminal process and then sending output and reading input would also be OK.
The one criteria is that it needs to work when the application is run outside of xcode, or even on machines that don't have xcode installed.
I've spent the last few hours trying to Google this, but my searches are all returning unhelpful results. I'm clearing not seaching on the right keywords.
Thanks.
Actually every app has ability to interact with console, your just need to run it in a proper way (from a terminal or console)
Locate folder with your application. For XCode you can do it in a "Project Navigator" folder "Products", then for your app in context menu press "Show in Finder". For installed application it probably will be in the folder /Applications/. Let it be, for example, /Applications/MyBigProgramm.app.
Open console or terminal make cd to your app folder /Applications/MyBigProgramm.app/Contents/MacOS
There will be an executable file of your app.
Run it from console. After it stdin and stdout will be linked to your app.
Work with stdin and stdout as you want.
UPD 1
A bit of automation.
Create applescript with the following content:
tell application "Terminal" set currentTab to do script
("/Applications/MyBigProgramm.app/Contents/MacOS/MyBigProgramm")
end tell
Save your applescript either as app or script.
Run your base application ("MyBigProgramm") by starting your applescript.
Work with stdin and stdout as you want within your base application.
Watch output in the terminal, type sth in the terminal as input to your base application.
I have a particular piece of software that i wish to load on windows startup. Under normal circumstances i would simply place a shortcut in the startup folder or an entry in the run key in the registry.
Unfortunately and for an unknown reason this application throws a win32 execption whenever that is done - and i am assuming it is because an element of windows has not been loaded that is vital to this application.
Once windows has actually loaded i can double click on the icon and it runs fine. So my question is - is there a programmatic solution to this? I have already tried a console app launcher that sleeps for n seconds and then launches but all that seems to do is delay the startup of windows.
Does anyone have any creative solutions? I am open to anything from a windows service to c#, vb, batch files.. etc
Thx
Can you run it as a service, or write a shell service which will attempt to start it up? That way you will have built in support for response on failure and delay time before trying again.
Have a look at AUTOEXEC.BAT. But be careful!!