idleberg / vscode-applescript

Language syntax and snippets for AppleScript
https://marketplace.visualstudio.com/items?itemName=idleberg.applescript
MIT License
70 stars 8 forks source link

Could we have full logs when running ? #10

Closed nicolinuxfr closed 3 years ago

nicolinuxfr commented 6 years ago

I'm not sure it's technically possible, but if it is, it would be really nice to have a full log when running a script.

What I mean by full log, is what the Script Editor.app made by Apple can display when you run a script. For instance, with this script, here's what the Apple app gives me when I run :

tell application "Safari"
    activate
end tell
tell application "System Events"
    get name of process 1 whose frontmost = true
end tell
tell application "Safari"
    get URL of current tab of window 1
end tell
tell current application
    do shell script "echo 'https://voiretmanger.fr/wp-content/uploads/2017/08/handmaids-tale-saison-2-700x467.jpg' | grep -o '\\-[0-9]\\+x[0-9]\\+'"
    do shell script "echo 'https://voiretmanger.fr/wp-content/uploads/2017/08/handmaids-tale-saison-2-700x467.jpg' | grep -o '\\-[0-9]\\+x[0-9]\\+'"
    do shell script "curl -s -L -o /dev/null -I -w \"%{http_code}\" 'https://voiretmanger.fr/wp-content/uploads/2017/08/handmaids-tale-saison-2.jpg'"
    (*https://voiretmanger.fr/wp-content/uploads/2017/08/handmaids-tale-saison-2.jpg*)
end tell
tell application "Safari"
    close current tab of window 1
    open location "https://voiretmanger.fr/wp-content/uploads/2017/08/handmaids-tale-saison-2.jpg"
end tell

In contrast, here's what Visual Studio Code gives me, the only log in the script :

[Running] osascript "/Users/nicolas/Git/perso/full-images/full-images.applescript"
https://voiretmanger.fr/wp-content/uploads/2017/08/handmaids-tale-saison-2.jpg

[Done] exited with code=0 in 0.601 seconds

The full log is far more useful to see what happens and debugs the script. In many case, the log commands are not even necessary, while I have to use it constantly with VSCode.

So, again, if possible, would be great.

Anyway, thanks for your work on this extension ! 👍

idleberg commented 6 years ago

In your settings, set applescript.alwaysShowOutput to true

nicolinuxfr commented 6 years ago

It is already set as such. :-)

I thought the setting was only to always display output even if there is no error or nothing to display. I don't think it changes the behaviour of the output itself.

idleberg commented 6 years ago

What happens if you run the following piece of code?

do shell script "echo 'Hello host'"
tell current application
    activate
    do shell script "echo 'Hello current application'"
end tell
tell application "Safari"
    activate
end tell
tell current application
    do shell script "echo 'Hello Safari'"
end tell

No matter where I run this – AppleScript Editor or Visual Studio Code – it always output "Hello Safari". I'm using macOS 10.13.3 (17G65) and Visual Studio Code 1.25.1.

nicolinuxfr commented 6 years ago

Sorry, I forgot to answer.

In order to see full logs in the Script Editor.app, you need to check this icon before executing the script. Then, this is what you will have :

capture d ecran 2018-08-08 a 18 10 37

I don't know if it's an exclusive feature of this app or if you can have the same in VSCode.

github-actions[bot] commented 3 years ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 14 days.

github-actions[bot] commented 3 years ago

This issue was closed because it has been stalled for 14 days with no activity.