Most efficient way to add filler characters to a string in Applescript?

I've been working on a script that requires you to enter a username that is always equal to or less than 32 characters. My goal is to add extra characters to the end of the string if it is less than 32 characters. For example, if I used the word "Taco", which is four characters, I'd need to add 28 filler characters to it to accomplish my goal.

Here's the code I have so far:

set localUN to "Taco"
set UNLength to length of localUN
set blanksToAdd to (32 - UNLength)
set authID to localUN
repeat blanksToAdd times
set authID to authID & "█"
end repeat

While this does work, it's a little slow to run, so I was hoping to find a better solution.

There is no shortcut for interrupting the kernel. That command, along with restarting the kernel, is in the Run menu, which also shows the shortcut for the restart kernel command. Note that because of the nature of the interaction between Python and C extensions, neither command is guaranteed to work,...

The program tries to find the file you open in the current working directory, not from the location where the executable file is. When you're executing a program from a terminal the current directory is the directory you're in. So if you do e.g. cd ~/ to go to your...

In Bash 4 you can use parameter expansion directly to capitalize every letter in a word (^^) or just the first letter (^). for f in *; do mv -- "$f" "${f^}" done You can use patterns to form more sophisticated case modifications. But for your specific question, aren't you...

Recommended: Try using virtualenv and initiate your environment with Python3. Or a quicker solution is to use python interpreter directly to execute django-admin: <path-to-python3>/python /usr/local/bin/django-admin startproject mysite ...

The Class Name should absolutely be set to a valid class. The bigger problem is that the array controller doesn't really play nicely with arrays of strings. There's no (reasonable) way to use -setValue:forKey: on a string since the string is itself what's being edited (replaced), not some property (like...

If your application is an .app bundle then it should have an info.plist. Inside the info.plist will normally contain version information that should display the version number: <key>CFBundleShortVersionString</key> <string>2.0.0</string> Typically the version information here is populated in places that call for it (eg. About). To change the name that would...

This is a product of using ls --color (you probably have an alias for this; type alias with no args to see what your current ls alias(es) is/are). Use dircolors or echo $LS_COLORS to see system-specific meanings. Here are some examples I copied and pasted from a post on the...

You have complete control with a subclass of NSFormatter. I'm not sure why you think you don't. Override isPartialStringValid(_:proposedSelectedRange:originalString:originalSelectedRange:errorDescription:) and implement the desired logic. From the docs (with some minor edits by me): In a subclass implementation, evaluate [the string pointed to by *partialStringPtr] according to the context. Return YES...

This works on a Mac (includes the %): ps -A -o %cpu | awk '{s+=$1} END {print s "%"}' To break this down a bit: ps is the process status tool. Most *nix like operating systems support it. There are a few flags we want to pass to it: -A...

Try this script: tell application "Finder" --Just get all the filenames of the target types: set allJPG to the name of every file of (entire contents of (selection as alias)) whose name extension = "JPG" set allARW to the name of every file of (entire contents of (selection as alias))...

The file /usr/bin/python (and /usr/bin/pythonw, which is a hard link to the same file) is actually a launcher program that invokes the default version of Python from /System/Library/Frameworks/Python.framework/Versions. You can select the version (2.6 and 2.7 in Yosemite) the launcher invokes using either the defaults command or the VERSIONER_PYTHON_VERSION environment...

To enable C++ in the NDK, add LOCAL_CPP_FEATURES := rtti exceptions and LOCAL_CPPFLAGS += --std=c++11 to the jni/Android.mk file. By default, the NDK supports only a C++-like language. Note that there's no underscore between CPP and FLAGS. Also, I've used += because this won't overwrite other flags such as -Wall....

+[NSObject isSubclassOfClass:] is a class method for NSObject and not all classes are subclasses of NSObject. It seems as if you have find private class that is not a subclass of NSObject, so it requires a more delicate handling for checking for inheritance. Try: BOOL isSubclass(Class child, Class parent) {...

First of all check you have to install command line or not. You can check this by opening Xcode, navigating the menu to Xcode > Preferences > Downloads > Components, finding Command Line Tools and select install/update. if you haven't find command line tool then you need to write this...

get first track give a track object or an error tracks give a list of one track or an empty list tell application "iTunes" set matchtrack to tracks in playlist 1 whose persistent ID is "F1A68AD90AA66648" if matchtrack is not {} then return name of item 1 of matchtrack else...

There's public API that's only documented in the header. CGDisplayCopyAllDisplayModes() takes an options parameter, which is a dictionary. The docs (and even the headers) say that it's unused and you must past NULL, but you can pass a dictionary with the key kCGDisplayShowDuplicateLowResolutionModes and value kCFBooleanTrue. The option name is...

You need to pick the hours as an individual variable, like shown below: set currentDate to current date set newHour to ((hours of currentDate) + 8) You can also use this for days, minutes and seconds. This will work. You can then use the variables to construct a new date...

From what I understand I would recommend you look in to Applescript as this will allow you to have a GUI Interface as well as executing 'SHELL' commands. First of all I would open 'Script Editor' program that comes preinstalled on Mac's This is an example script which asks for...

If you want to find the corresponding GCC version number for the version of libstdc++, do this: $> port provides /opt/local/lib/libgcc/libstdc++.6.dylib That will tell you which port installed the given file. In my case, that's libgcc, I'll assume it's the same for you. To find out the currently installed version...

Proper AS-ObjC integration only arrived in 10.10. To support 10.9, you have to put all the ObjC stuff in a script library and then load that script into your regular script to call it. Or, if it's a standalone applet, create it using Script Editor's Cocoa-AppleScript template. Or, y'know, you...

So the default is that your main application window is an outlet in the app delegate. You should keep MainMenu.xib's owner as the app delegate. A common alternative, if you are creating your own custom window controller, is to create a property in the AppDelegate of type CustomWindowController, then in...

So even though I don't have my app working still, I've technically answered this question. For whatever reason pyinstaller 2.1 wasn't able to properly find Python or Kivy. When I downloaded pyinstaller 2.0 and ran that, everything built properly. Instead of getting those "Can not find path" errors, I now...

Before I answered I wanted to check if the same happened to me-- but when I created a custom NSViewController in a new iOS OR OS X app, both would generate the @interface in the implementation file (.m file) So I'm not sure why you are seeing that. However, to...

If you are capturing in monitor mode, you will be getting native 802.11 packets, which do not look like Ethernet packets, so filtering similarly to Ethernet will not work. Furthermore, if you're capturing in monitor mode on a protected network, i.e. a network using WEP or WPA/WPA2, everything past the...

You can use Applescript to achieve this. To focus on a specific application: tell application "Finder" to activate And to emulate an actual Cmd+Tab input: tell application "System Events" key down command keystroke tab key up command end tell Applescript files (*.scpt) can be run through the command line with...

For the moment, there's no easy way to do this, since as you said, 10.9 is the farthest back you can specify. Until Xcode 7 is released, which I believe will only help with more recent SDKs anyway, you have few choices, none at all convenient: Keep a cheap Mac...

I get your OSX failure on Windows, and it should fail because writing a Unicode string to a file requires an encoding. When you write Unicode strings to a file Python 2 will implicitly convert it to a byte string using the default ascii codec and fails for non-ASCII characters....

This line of code is very ambiguous: for (auto it : _unhandledFiles)//ERROR HERE auto uses template argument deduction, so std::string s; std::string& sr = sr; auto x = sr; in the above code x is deduced to be of type std::string, not std::string&. So your loop is equivalent to: for...

The most common issue when handling variables containing paths of directories and files is the presence of special characters such as spaces. To handle those correctly, you should always quote the variables, using double quotes. Better code would therefor be: sudo sh "$path/join.sh" sudo sh "$path/join2.sh" It is also advised...

I found out what I was talking about. Facebook is adding a new feature which ask users if they want to get a link to the mobile app. This is in Beta right now but you will automatically eligible for the feature if: You have integrated the new Facebook Login...

The behavior of void returning action was recently changed to not convert to 204 status code. However, for you scenario you could use the CreatedAtRoute helper method(this actually creates a CreatedAtRouteResult) which sets the Location header. [HttpPost] public void Post([FromBody]CrudObject crudObject) { return CreatedAtRoute(routeName: "GetByIdRoute", routeValues: new { id =...

CoreBluetooth is for Bluetooth low energy (BLE), whereas IOBluetooth is for classic Bluetooth. iOS devices can connect to HID devices over either transport: the BLE profile is called HOGP: HID over GATT Profile. CoreBluetooth/BLE should be easier to work with, but you'll still need to implement the HID protocol yourself....

You could use the loadNibNamed:owner:topLevelObjects: method. Here's an example: NSArray *views = nil; [[NSBundle mainBundle] loadNibNamed:@"TestView1" owner:nil topLevelObjects:&views]; [self.view addSubview:[views lastObject]]; The above code will load the top-level contents of the XIB into an array. Per the documentation: Load a nib from this bundle with the specified file name and...

Number formatting of an OpenType font requires having control over which features are active during text shaping, something which typesetting tools will offer (InDesign, XeLaTeX, etc), but which normal productivity tools still (after a decade of Adobe, Apple, and Microsoft all agreeing on using OpenType!) don't offer. Notes included. So,...

Why not run a SSH server on the VM and connect from the host via a terminal? See MAC SSH. Which OS is running on the VM? It should not be too hard to get the SSH server installed and running. Of course the VM client OS must have an...