VBS file that shows the username in a messagebox? - vbscript

I wanted to make a message box that had the Spyro piracy message but I wanted to replace "I'm sorry Player" with "I'm sorry {username}"

Related

AppleScript for Mail.app : convert outgoing message to plain text [duplicate]

I have an AppleScript that nicely collates information and creates an email message with attachments.
I cannot find a way for the script to set the message format to "Plain Text" which is required by the receiving inbox (rather than the default "Rich Text").
Is there an AppleScript way (or trick) to setting the message format to "Plain Text"?
I found this question while trying to solve exactly this problem. Eventually I came up with the following solution:
tell application "Mail"
set newMessage to make new outgoing message
with properties {visible:true,
subject:"message title",
sender:"sender#from.address",
content:mailBody}
tell newMessage
make new to recipient with properties {address:"mail#recipient.com"}
end tell
activate
end tell
tell application "System Events"
click menu item "Make Plain Text" of ((process "Mail")'s (menu bar 1)'s (menu bar item "Format")'s (menu 1))
end tell
Hopefully someone will find this useful, I know I would have several hours ago!
This is tested on Mail versions 7.3 and 12.4. Newer, or older, versions might need different menu titles.
Before the section in your script that creates a message, add this line.
tell application "Mail" to set default message format to plain text
At the very end of the script add this to reset the value
tell application "Mail" to set default message format to rich text
You can use keyboard shortcut ⌘shiftt also to change the message format to plain text:
tell application "System Events" to keystroke "t" using {command down, shift down}
Tested in Mail version 12.4
Sad to say that Apple’s implementation is so broken that there is currently no way around it. You will have to suffer through it or find a way to send your mails through a commandline.
It got worse in macOS 13. Trying to have System Events send a keyboard shortcut will result in a permission error, even though all permissions are granted in System Settings.

AppleScript Error While Programming

I am still new to programing but I have a AppleScript Error that I need help with.
I am creating a prank using AppleScript but this error message showed up when I tried to compress the file.
Expected “else”, etc. but found end of script.
Here is my code. Please help me fix this! Thanks!
display dialog "Virus Detected" buttons {"Shut Down", "Crash CPU"} default button 2
if the button returned of the result is "Shut Down" then
beep 10
display dialog "Virus Downloaded. Commencing Virus Deletion Process. Shutting Down"
say "Virus Deletion Process FAILED. Virus Downloaded. Shut Down Has Been Overrided"
display dialog "All Systems Has Been Hacked. Computer Is Now Overloading"
display dialog "Passwords Have Been Hacked" buttons {"Abort"}
if the button returned of the result is "Abort" then
display dialog "About Has Been Overrided. Passwords Are Now Uploading" buttons {"Cancel"}
if the button returned of the result is "Cancel" then
display dialog "Overrided. Uploading Complete. Deleting ALL Files From Main Data Base."
say "Deletion Complete"
display dialog "Shutting Down"
tell application "Finder" to shut down
else
beep 10
display dialog "Virus Downloaded Successfully. Computer Has Been Hacked"
say "Virus Has Hacked Into The Motherboard"
display dialog "Deleting All Files. Restoring From Backup"
say "No Backups Were Found"
display dialog "Deleting ALL Data. Computer Is Now Crashing. Shutting Down"
tell application "Finder" to shut down
end if
In line 8 and 10 there are two if clauses.
Each of them must be balanced with an end if (before the else)

Applescript can't open app

I've written a Mac app that isn't scriptable (yet), and I'd like to run it with Applescript. Either of the following scripts get "An error of type-10660 has occurred.". After hours of searching, I haven't found a solution, or an explanation of the error.
if exists application "RotorDCU" then
display dialog "Found." buttons {"OK"}
else
display dialog "Not found." buttons {"OK"}
end if
tell application "RotorDCU"
activate
end tell
Error -10660 is a Launch Services error, explained in the interface file LSInfo.h:
The app cannot be run when inside a Trash folder
Is RotorDCU in the Trash, perchance?

Using AppleScript to set a mail message to Plain Text

I have an AppleScript that nicely collates information and creates an email message with attachments.
I cannot find a way for the script to set the message format to "Plain Text" which is required by the receiving inbox (rather than the default "Rich Text").
Is there an AppleScript way (or trick) to setting the message format to "Plain Text"?
I found this question while trying to solve exactly this problem. Eventually I came up with the following solution:
tell application "Mail"
set newMessage to make new outgoing message
with properties {visible:true,
subject:"message title",
sender:"sender#from.address",
content:mailBody}
tell newMessage
make new to recipient with properties {address:"mail#recipient.com"}
end tell
activate
end tell
tell application "System Events"
click menu item "Make Plain Text" of ((process "Mail")'s (menu bar 1)'s (menu bar item "Format")'s (menu 1))
end tell
Hopefully someone will find this useful, I know I would have several hours ago!
This is tested on Mail versions 7.3 and 12.4. Newer, or older, versions might need different menu titles.
Before the section in your script that creates a message, add this line.
tell application "Mail" to set default message format to plain text
At the very end of the script add this to reset the value
tell application "Mail" to set default message format to rich text
You can use keyboard shortcut ⌘shiftt also to change the message format to plain text:
tell application "System Events" to keystroke "t" using {command down, shift down}
Tested in Mail version 12.4
Sad to say that Apple’s implementation is so broken that there is currently no way around it. You will have to suffer through it or find a way to send your mails through a commandline.
It got worse in macOS 13. Trying to have System Events send a keyboard shortcut will result in a permission error, even though all permissions are granted in System Settings.

"ask for text" action in Apple automator does not receive focus automatically

I wrote an Service using Apple's Automator. The first action is an "Ask for Text" action. However, when I trigger the shortcut to initiate the service, the modal asking for text pops up, but it does not have focus. I have to use the mouse to click on it.
Is there any way to have automator open this window with the focus on the text input?
Add some applescript to the top of your workflow with the following code. Just replace myapp with your app name
tell application "myapp"
activate
end tell
This is a sort-of, works-for-me, partial answer; instead of using the Ask for text action, I just used an applescript within my automator app (instead of the Ask..action, I used the "Run applescript" action). it looks like this:
on run {input, parameters}
set x to the text returned of (display dialog "Enter a version number" default answer "1134" buttons {"OK"} default button 1)
return x
end run
My lil' automator application was to help me enter version numbers for tickets; using the mouse makes my hand hurt. The applescript dialogs seem to have focus properly, so enjoy! Let us know how you do!

Resources