ios uialertview through mobile terminal command - ios

Is there a terminal utility for ios or a script that can be written so that with a command into mobile terminal or through ssh, a uialertview will pop up?
For example, into terminal, i type in >alert [message] [title] [buttonmessage]
and an alert on the screen pops up with the specified parameters.

Use osascript, for example:
osascript -e 'tell app "Finder" to display dialog "Hello World"'
osascript -e 'tell app "System Events" to display dialog "Hello World"'

Related

UIAutomation - command line issue

I would like to access the SETTINGS and turn on/off WiFi.
Therefore I am running the following command:
instruments -v -w [my_phpne_ID] -t /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns/AutomationInstrument.xrplugin/Contents/Resources/Automation.tracetemplate /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/Applications/Preferences.app -e UIASCRIPT /Users/test/Documents/xCode/Shell-Script/mytest.js -e UIARESULTSPATH /Users/test/Documents/xCode/Shell-Script
The following issue pops up:
Instruments : Instrument 'Automation - Preferences' rejected command 'Instrument Command (purpose:Trace;
Do I need to initialize the phone and Xcode somehow?
It usually works after I run a dummy App from Xcode on the phone.
But I would like to avoid it and run this command directly without any dummy App.

What does osascript stand for?

I am trying this command
osascript <<EOD
tell "Finder" something
etc
etc
In this command, what does the acronym osascript stand for?

Instruments > Automation - Script and Editor Log open simultaneously

In the Instruments Automation tool, is it possible to have the Script and Editor Log panes open simultaneously (e.g. vertically split)?
No :)
I recommend to edit script in an external editor and then run via console. That's easy:
instruments -w "iPad Air" -t "Automation" ~/My.app -e UIASCRIPT my_script.js
To add on this, please make sure you export the script first if you created it within the trace document and then delete it form the trace document. If you do not do that, it will be overwritten when you reopen the trace document with instruments.

make an lp script into functioning printer

I'm trying to print to separate printers simultaneously in Ubuntu 14.04
From all of my reading the best option I've seen is to write a script
that sends an lp command to the separate printers.
This is the script I've written so far
!/bin/bash
lp -d printer "$#"
lp -d printer2 "$#"
where printer and printer 2 are the actual printers installed on the system
This script works from a terminal, however I would like to be able to send print jobs directly to a "printer" that is actually the script I've written.
How can I make this lp script into a "printer"
Ok I didn't find a way to do this the way I originally intended, however it is possible with tea4CUPS
great cups backend tool with an easy config file
http://www.pykota.com/software/tea4cups/download
The install instructions are on the download page.
As for printing to multiple printers, add this command in the config file for every printer you wish to print to.
prehook_firstprinter: /usr/bin/lp -d Name of Printer -o raw $TEADATAFILE
Here are the simplest instructions I could write
1. download the tea4cups.gz
Extract it to the home folder, rename it to tea4cups
Open a terminal and run these commands
sudo cp /home/manifester/tea4cups/tea4cups.conf /etc/cups
sudo cp /home/manifester/tea4cups/tea4cups /usr/lib/cups/backend/
sudo chmod 700 /usr/lib/cups/backend/tea4cups
Run this command
sudo gedit /etc/cups/tea4cups.conf
Paste this in the bottom of the document
prehook_firstprinter: /usr/bin/lp -d Name of Printer yes the literal name in the printer window -o raw $TEADATAFILE
you will need a new line for every printer you have, so if you want to print to 3 printers you will need three of the above line each having the name of the printer it will be talking to.
save and close everything
open a terminal and run
sudo service cups restart
open a web browser and go to the browser cups controller
http://localhost:631/admin
go to Add Printer
you should see a printer named "tea4CUPSnothing"
If you don't see it go back and press "Find Printers"
it should be there
Change the info of the printer to "Print all" for all type fields"
Press Continue
The generic printer driver works because the printer doesn't actually exist.
Press Continue
Set Defaults
you should be done, go to your printer window on ubuntu and do a test print.

How to continue testing an iOS app, using UIAutomation instrument, even after the app exits?

I have an app. There is a button in the app, which, if clicked, exits the app. I am testing the app using UIAutomation instruments. I want to test this button. But after the app exits, the instrument stops giving an exception. What I want to do is that after the app exists, I want to reopen the app and continue with the rest of the test. Have anyone else been in the same scenario? If so, can you please share the solution, if you have found any?
This is not possible because Instruments loses the connection with the app process once it quits.
If you are scripting UI Automation from the command line, you can run a second automation script after the first one quits the app that then checks to make sure everything is reset.
instruments \
-D [trace document] \
-t [instruments template] \
/path/to/Bundle.app \
-e UIARESULTSPATH [directory to store test output] \
-e UIASCRIPT reset_the_app.js
instruments \
-D [trace document] \
-t [instruments template] \
/path/to/Bundle.app \
-e UIARESULTSPATH [directory to store test output] \
-e UIASCRIPT check_that_the_app_is_reset.js
So, rather than trying to get the same instance of Instruments to relaunch and reattach to the app, just run two separate scripts, one that does your reset-and-abort, and the other that checks the resulting state of the app.
You can Use:
UIATarget.localTarget().deactivateAppForDuration(n);
where n is the number of seconds you want this app to restart. I hope this helps.
thanks for the answers, but the documentation says:
"When a user exits your app by tapping the Home button or causing some other app to come to the foreground, your app is suspended."
So its not restarting but suspended?

Resources