Alternative to Netterm with "Invoke App as a Printing Option" - printing

Netterm has the option to invoke an app when print command is issued like in this screenshot.
The resulting text from the print command will be opened in the selected app (e.g Notepad) instead of being printed.
Is there any alternative (preferably open source) with the similar option?
P.S. : I would love to purchase Netterm but it seems like the company is no longer accepting order especially outside the US.

Related

Applescript breaking when application name is a variable?

I have a script on a machine that has multiple versions of Photoshop that looks for any open version of Photoshop (in this case CS6) and saves the name as a variable called AppName.
It seems to work fine for checking "If AppName is running" but later on down the script I have "tell application ... " and when I start doing things inside there, I get error 1728.
Example: I have CS6 open and one image open.
tell application AppName
log count documents
log file path of document 1
end tell
That would generate
(*1*)
(*Adobe Photoshop CS6 got an error: Can't get path. - -1728*)
It works perfectly fine if I just enter "Adobe Photoshop CS6" or "com.adobe.photoshop", but for various reasons I can't do that and need it to remain a variable.
Anyone have any ideas? =/
The argument of tell application must be a literal string (a constant) because the terminology is evaluated at compile time.
The only way to evaluate AppleScript terminology beside tell application is an using terms from block frequently used in event handlers for example
using terms from application "Adobe Photoshop CS6"
end using terms from
but this requires also a constant as argument. The implementation depends on the context.

Windows 10 - Username with whitespace and PATH [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 2 years ago.
Improve this question
Upon installing Windows 10 I created my admin user as Miha Šušteršič. Now when I install programs that need to modify the environment variable PATH, most of them don't get added. For instance this happens with MongoDB and Git, but npm got added normally.
I think this is an issue with the whitespace in the path to the variables. I tried renaming my username to M.Sustersic, but the system folder Users\Miha Šušteršič\ did not get updated.
Is there a way for me to change this folder name automatically (so the rest of the app dependencies on \Users\Miha Šušteršič\AppData don't get bugged) or do I need to reinstall windows?
Is there something else I am missing here? I tried adding the dependencies on my own, but nothing worked so far.
You can actually change the folder name. It's a bit tedious but it's worth it. Make sure you know of the edition of your Windows 10 you're using first - Professional, Enterprise or Home - before carrying out these steps, cos of step 5:
Right click on Windows Start Menu option and click Command Prompt (Admin)
(If you can't find Command Prompt (Admin) when you right-click on the Start Menu or search for it, you can simply go to C:/Users/Default/AppData/Local/Microsoft/Windows/WinX/Group3 on your pc. There, you'll find two shortcuts both named "Command Prompt"; one is for Command Prompt, and the other is for Command Prompt (Admin).Try out both shortcuts to know which is which, and then click on the one for Command Prompt (Admin))
In the Command Prompt (Admin), create a new/temporary admin account by entering this command: net user Administrator /active:yes (Notice the space between Administrator and /) and close the cmd
Next, click on the start menu and sign out of your current admin account
(four icons above the shut down button)
Sign in with the new Administrator account you just created
(Skip this step only if you use the Windows Home Edition) Right click on the Start Menu and click Computer Management and open Local Users and Groups > Users. Right-click on the username you wish to change and select Rename and close the window.
Open Local Disk (C) > Users and right-click and rename the corresponding folder with the name you wish, just as in Step 5, and close the window.
Next, search for regedit in the search box and click on it. Now, inside the regedit (i.e. Registry Editor), go to HKEY_LOCAL_MACHINE > SOFTWARE > Microsoft > Windows NT > Current Version > Profile List.
In the list of identifiers under Profile List, find the ProfileImagePath that corresponds to the account name you wish to change. Yours should look something like this:
ProfileImagePath REG_EXPAND_SZ c:\Users\Miha Šušteršič.
Double click on the value and rename it to what you want.
Still in the regedit, scroll up to the top of the window and make sure the highlight is on Computer, then click Edit in the menu options just above it; then click Find; then enter C:\Users\<your old username>. In your case, that would be:
C:\Users\Miha Šušteršič
And search.
If the search brings out any result (i.e. any folder bearing your old account user name,) click on it and rename it, and then go back to Edit in the menu option and this time, click Find Next or f3. Keep on "Finding Next" this until there are no files are left to rename, then close regedit.
Finally, sign out of your Administrator account and sign in with your now-renamed account, and then, go on to disable the Administrator account you just signed out from. You do this by going to Command Prompt (Admin) and this time, you enter the command:
net user Administrator /active:no
(Once again, notice the space between Administrator and /)
...and close the command.
And that's it! Long and tedious, but it works. You can check also out this video to have a better understanding of everything I just described.
_Note: Make sure to follow every step to the letter so you don't run into more serious problems.
If you run into any issues renaming at Step 6, simply shut down your computer and restart and try again.
Also, certain files may/will not allow for renaming. It's alright; just leave them as they are and "Find Next" until there's no more file to rename._
See this KB article to change the name of the User Profile directory.
After you do this, you may want to make a link just in case any of your apps keep local path configuration.
cd C:\Users
mklink /D "Miha Šušteršič" M.Sustersic

access trouble when controlling remote mac with AppleScript

I'm new to all this programming stuff, but trying to learn. I've had moderate success, but feel like it's more accidental than intentional. I'd appreciate help learning and understanding AppleScript in particular and networking, automation and programing in general.
Here's the environment: Almost all Apple with two Minis, a couple of laptops and various iOS devices including an AppleTV. The network consists of an Apple Airport Extreme, and an older D-Link switch I rescued (with permission) from the recycle bin at work. There are three Foscam wi-fi cameras as well. One of the Mini's (named Dora) is acting as a file server running Yosemite and the OS X Server application with a growing RAID 1 array for media storage.
What I’d like to be able to do is to run a single AppleScript from my laptop (Adam’s Macbook) that does the following:
Launch the application iCamSource on Adam’s Macbook
Change “Require Password to Wake” to true on Adam’s Macbook
Quit iTunes on Adam’s Macbook if it’s running
Start the current ScreenSaver locking Adam’s Macbook
Quit iTunes on Dora if it’s running
Start the current ScreenSaver on Dora if it’s not already running thereby locking Dora
I’d also like to have a single script on Adam’s Macbook that reverses these actions.
I have been able to launch iCamSource, set “Require Password to Wake” to true and start the ScreenSaver on Adam’s Macbook with a lot of Google-Fu, much trial and error, and quite a bit of frustration. I’ve not yet tried to quit iTunes if it’s running. That’s a new idea/requirement, but I think it should be pretty simple to add to the functioning script.
Where I’m running into trouble is controlling Dora from a script on Adam’s Macbook. I run into access errors (905 and 927 generally) about half to two thirds of the time I run the script. I’ve tried every syntax option and many combinations of syntax that I found via Google searches, but this is the one that has the most (but still inconsistent) success.
set remoteMachine to "eppc://remoteMachineadam:slajdlll#10.0.1.2"
tell application "iTunes" of machine remoteMachine
quit
end tell
When reading various articles explaining how to do this, sometimes the scripts use eppc, others use epps and I’ve not seen a consistent result with either one. Some of the articles use the actual IP address of the remote machine, others use password#name.local, so that syntax would be slajdlll#dora.local. That change also seems inconsistent in its results.
This seems to be a pretty basic task, and I’ve found lots of articles that do this very thing, but their methods don’t work in my environment. Many of the articles I’ve read are quite old, so the syntax may be out of date. I’m kind of at my wits end, but feel I should be able to make this work. Any help y’all could provide would be VERY appreciated.
Update - I had the scripts working last night in all regards except controlling the remote machine. This morning, I tried to open the "Away" script to again tackle the remote control issue and I get a Syntax Error Unable To Authenticate User message and the script won't compile. Here's the code:
tell application "System Events"
try
tell application "iTunes" to quit
end try
try
tell application "iTunes" of machine "eppc://Dora.local" to quit
end try
tell security preferences
set require password to wake to true
tell application "iCamSource" to activate
tell application "System Events" to start current screen saver
end tell
end tell
Both "Away" and "Home" scripts run from the AppleScript menu. When I unlock the ScreenSaver after running the "Away" script I get a dialog box stating "There was a problem connecting to the server "Dora's Airport Extreme. The share does not exist on the server. Please check the share name, and then try again." I'm beginning to think I may have a Permissions error on one or more of the machines, or if there's another problem that's making the scripts act inconsistently.
Thanks for all the help so far!
UPDATE Ok, it seems that there was a problem with iPhoto and Screen Saver interacting with the files on the networked hard drive. Opening iPhoto and slowly opening each image and re-linking those that had lost their location seems to have solved that problem. I am still encountering the access error code 905. In order to troubleshoot this process, I'm stripping the script down to one task, to quit iTunes on the remote machine named "Dora" Here's the code:
set Dora to "epps://adam:slajdlll#10.0.1.2"
try
tell application "iTunes" of machine Dora to quit
end try
Here's the event log that running that script generates:
tell application "iTunes" of machine "eppc://epps/adam%253kslajdlll%4010.0.1.2.local"
quit
--> error number -905
end tell
Is it possible/probable that the OS X Server application is mis-configured and is preventing the script from controlling the remote machine? Any other thoughts or things to try?
Thanks!
UPDATE 2
In the Groups section of the OS X Server application running on the remote machine, I found that there is a group called Apple Remote Events ACL. When I click the Edit button to view it's settings I see the actual account name is "com.apple.access_remote_ae-disabled". I wonder if this is telling us something. I searched several libraries for "com.apple.access" thinking it may be something that could be edited, but found nothing. I'm a member of that group. I tried removing myself from the group and tried the script with no change in the results so I added myself back into it.
UPDATE 3
As suggested I'm trying to eliminate OSX Server from the equation. To do this I'm going to try to launch TextEdit (since it's faster to launch than iTunes) on a third machine, known as Office Mini that does not have the Server application on it. Here's the script:
set OfficeMini to "eppc://10.0.1.196"
try
tell application "System Events" of machine OfficeMini
open "/Applications/TextEdit.app"
end tell
end try
When I ran the script initially I got two dialog boxes asking for username and password. I supplied them and checked the "Save in Keychain" checkbox. The script didn't open TextEdit, but I'm not getting the access errors. I am getting different errors though, -600 or -10010 depending on if I use System Events or the Finder. Using the list on this page: Nicholas Reilingh AppleScript Error Codes I find that with System Events I get an error -600 which means the application isn't running. That's no surprise, I'm trying to open it. When I use the Finder instead of System Events, I get an error -10010 which the list indicates is "Handler can’t handle objects of this class." So, there's progress, but I'm still stumped.
UPDATE 4 To further clarify/simplify, I tried running a simple script to open iTunes on the Office Mini locally on that machine and it worked fine.
tell application "iTunes" to activate
Substituting the "quit" for "activate", and trying this syntax with several different applications all worked quite well and very fast. I tried the same script and variations on the Dora machine with the same, successful results.
I then tried to make that syntax work remotely with this code:
set OfficeMini to "eppc://10.0.1.196"
tell application "iTunes" of machine OfficeMini to quit
I got this error message in the event log:
tell application "iTunes" of machine "eppc://10.0.1.196"
quit
--> error number -927
Result:
error "iTunes got an error: Unable to authenticate user." number -927
So, since OSX Server isn't running on the Office Mini, this seems to eliminate that as a culprit for the error. I tried altering the code with another variant I saw online that uses "epps" in place of "eppc" which results in a similar error message: "iTunes got an error: Remote access isn’t allowed." number -905. I did not get dialog boxes requesting credentials. When I've seen the "epps" string used online, it was formatted as "epps://username:password#location" so I used "epps://adam:slajdlll#10.0.1.196" and received the same error message. I even tried "Adam" in place of "adam" with no change in the results.
Yes, step 1 is to try to make your script as simple as possible to narrow down the point of failure.
I have copied your minimal script onto my machine & gotten it to work:
set Dora to "minipuppy.local"
try
tell application "iTunes" of machine Dora to quit
end try
A few notes:
I used "minipuppy.local" (the Bonjour linklocal name) rather than your eppc stuff, because I know what the former is, but not the latter. (You can get the link local name from the Sharing prefs panel* where it says "Computers on your local network can access your computer at:XXXXX"
An authentication dialog popped up saying that I needed to enter the username and password for the target machine - but it did have
an eppc address in the dialog (I didn't take a screenshot :-( )
After entering the username/password my script did nothing. Interestingly, I could not get it to print out a log as yours has?
I fixed this by going to the target Mac's System Preferences & enabling "Remote Apple Events" in the Sharing panel*. After turning that on, my script worked.
I'm hoping enabling "Remote Apple Events" is the ultimate solution to your simplified problem.
*Apple Menu -> System Preferences -> Sharing

Applescript: print first or other specific pages

How can you instruct an application or the printer to only print the first page, a page range or just odd or even pages of a file? I attempt this with the help of the Preview app, which looks promising:
set theFile to "[file-path/file]""
tell application "Preview"
activate
print theFile with properties {target printer:"Printer", ending page:1} without «class pdlg»
--these properties isn't available for the printer app, here just limiting amount of printed pages
quit
end tell
But with this I'm bitten by the sandboxd process that tells me the file can't be opened for printing and I get a deny file-read-data result in the log.
In the CUPS suggestion by adamh I encounter issues with umlauts and have other execution issues as well, possibly also because of sandbox rules. The code works from the command line, but not when called in automated fashion.
I tried to look up useful examples of the print command in a reference, in my books and tried searching the online Apple references, but I can't seem to find many examples fitting to the present day situation with sandbox, if any.
You could script printing by command line tool lp & lpr.
These talk to CUPS, Common Unix Printing System
To target pages / ranges:
lp -o page-ranges=2-4 "my_great_document.pdf"
To call it from applescript use do shell script
e.g,
do shell script "lp -o page-ranges=2-4 'my_great_document.pdf'"
For more ideas see: http://www.cups.org/documentation.php/options.html

Running Fitnesse in Debug mode [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I used to use Fitnesse daily years ago, but forgot how to run tests in debug mode (or have stack trace information be output) - does anyone know?
I recall being able to configure it either as a flag when running/starting up fitnesse.jar, or as a URL parameter (e.g. http://localhost:8090/FitLibraryWeb.MyTest?test&debug=true)
To debug fixtures in .Net I normally add Debugger.Break() inside my C# fixture code
Although my prefered development solution has already been pointed out on Rustin's DebugBreak() suggestion, and alternate solution is to invoke RunnerW.exe, which requires adding the following line to your target Fitnesse test page
[[Press me to start in remote debug mode][?responder=test&remote_debug=true]]
Please, bear in mind that I am assuming your test page already defines REMOTE_DEBUG_RUNNER pointing to RunnerW.exe, as stated in Fitnesse guide's Customizing Test Execution section
For the sake of simplicity, I will present a sample fit test header.
So, here is how to Remote Debug using Visual Studio:
Make sure you fitnesse test page starts with the following lines
!define TEST_RUNNER {FitSharp\Runner.exe}
!define REMOTE_DEBUG_RUNNER {FitSharp\RunnerW.exe}
[[Press me to start in remote debug mode][?responder=test&remote_debug=true]]
The rest of your test specification goes here
In Visual Studio, set target code breakpoint
On fit test page, click on Press me to start in remote debug mode, defined above. This starts the RunnerW.exe process (winform app called Fitsharp) which will wait for 30 seconds (I am not sure).
In Visual Studio > Debug menu > Attach to process, locate RunnerW.exe and press Attach button.
On Fitsharp window (RunnerW.exe process), click GO button and you are on your way.
As pratical solution, I use the following strategy:
I create static page called SetupEngine and add the 3 lines stated on previous step 1.
On the top of every test page, I just put the following header, so I don't have to repeat those 3 lines.
!include .SetupEngine
Note that . (dot) on .SetupEngine (which is a path) refers to your Fitnesse root page. You may have to adjust it.
I had this ideia when I was referring to Fitnesse.UserGuide's remote debug section
Hope it helps
Add the following line just before the your test target location
!|debug|
For further details, refer to Michael Sorens' excelent article, the most comprehensive article on Fitnesse debug techniques.
Your thinking of using RunnerW.exe as opposed to the Runner.exe.
If you change your test runner to be RunnerW a pop-up window will appear with a 'go' button on it, and will not start the fitnesse test until you hit it.
Before hitting go you can attach to any process (via 'Attach To Process' in the debug menu if your using VS) and the execution will pause at the break points set.
Note: You must have the same build being used by FitNesse as the code you are debugging.
You can also attach to a remote process, using the Remote Debugger.
Also, if you attach the the RunnerW.exe process, you can debug the fixtures themselves.
I haven't had to do it in a while, but the current documentation that comes with FitNesse indicates that you are close. You should be using remote_debug instead of debug.
The best thing is to start with the documentation that comes with your copy of FitNesse, as it matches what you are running. If you are running on port 8080, then the following link should work: http://localhost:8080/FitNesse.UserGuide.DebugingFixtureCode.
Assuming you are using Java, these instructions should help. If you are using a different language I am not sure I can help.

Resources