Sunday, February 16, 2014

A few cycripts

These are a few things you can 1. Run from terminal while in cycript. 2. Add to your lockscreens to use.

Turn on the lockscreen
[[SBBacklightController sharedInstance] turnOnScreenFullyWithBacklightSource:1]
Unlock iPhone (Terminal only)
[[SBLockScreenManager sharedInstance] _finishUIUnlockFromSource:1 withOptions:1]
Stop dimming of the lockscreen
[[SBBacklightController sharedInstance] cancelLockScreenIdleTimer]
Pull info from settings set plist
 var settings = [NSDictionary dictionaryWithContentsOfFile:@"/var/mobile/Library/Preferences/com.JunesiPhone.miWeather.plist"];
Pull info from settings code
 

script type="text/cycript"
   try{
        var settings = [NSDictionary dictionaryWithContentsOfFile:@"/var/mobile/Library/Preferences/com.JunesiPhone.miWeather.plist"];
       if(settings!=null){
       }
    }catch(err){
        alert(err);
    }
/script
SB switcher stuff
 
[[SBUIController sharedInstanceIfExists]_toggleSwitcher]

[[SBUIController sharedInstanceIfExists]dismissSwitcherAnimated:YES]

[[SBUIController sharedInstanceIfExists]getRidOfAppSwitcher]
Unlock with passcode
 
[[SBLockScreenManager sharedInstance] attemptUnlockWithPasscode:@"1234"]
Small status on SB
 
SBLockScreenViewController.messages['statusBarStyle']=function(){return 0}
Allow folders to be placed in folders.
 
SBIconView.messages['canReceiveGrabbedIcon:'] = function (icon){ return YES; }
See if notifications are showing on the Lockscreen
 
[[[SBLockScreenManager sharedInstance] lockScreenViewController] lockScreenIsShowingBulletins];
Use location services
 
manager = [[[CLLocationManager alloc] initWithEffectiveBundle: [NSBundle bundleForClass: CLLocationManager.class]]autorelease]
    manager.delegate = CLLocationManagerDelegate;
    manager.desiredAccuracy = kCLLocationAccuracyBest;
    [manager startUpdatingLocation];
    var GPS = manager.location.coordinate;
    [manager stopUpdatingLocation];
    var Latitude = JSON.stringify(GPS[0]);
    var Longitude = JSON.stringify(GPS[1]);
See if location services is enabled
 
[[CLLocationManager sharedManager] locationServicesEnabled];
Detect if passcode is on
 
[[SBDeviceLockController sharedController]isPasscodeLocked];
Open url in safari
 
mySafari = [UIApplication sharedApplication];
    myURL = [[NSURL alloc]initWithString:@""+url];
    [mySafari openURL:myURL]; //myUrl is your link
    [myURL release];
Disable lock bounce iOS7.1
 
SBLockScreenView.messages['hintDisplacement']=function(){return 0}
Get app notification badge
 
SBIconController.sharedInstance.model.leafIconsByIdentifier["com.apple.MobileSMS"].badgeValue;
Device stuff
 
[[UIDevice currentDevice] name];
[[NSFileManager defaultManager] attributesOfFileSystemForPath:@"/var/mobile" error:NULL];
[NSProcessInfo processInfo].physicalMemory;
[NSProcessInfo processInfo].processorCount;
[NSProcessInfo processInfo].operatingSystemVersionString;
[NSProcessInfo processInfo].systemUptime;
Battery Percent
 
[[SBUIController sharedInstance]batteryCapacityAsPercentage];
Unlock device on iOS7. Thanks to Saurik for his help on this one.
 
   [^void(){[[UIApplication sharedApplication] launchApplicationWithIdentifier:@""+bundle suspended:NO];}
  performSelectorOnMainThread: @selector(invoke) withObject: nil waitUntilDone: NO];
Hide LS items
 
 [[[[SBLockScreenManager sharedInstance]lockScreenViewController]lockScreenView]setSlideToUnlockHidden:1 forRequester:1];
 [[SBAppStatusBarManager sharedInstance] hideStatusBar];
 [[[[SBLockScreenManager sharedInstance]lockScreenViewController]lockScreenView]setTopGrabberHidden:1 forRequester:1];
 [[[[SBLockScreenManager sharedInstance]lockScreenViewController]lockScreenView]setBottomGrabberHidden:1 forRequester:1];
Get last touched icon
 
 [[SBIconController sharedInstance]lastTouchedIcon];
Home button tap by code
 
 [[SBIconController sharedInstance]handleHomeButtonTap];
Display icons or bundles
 
 [[SBApplicationController sharedInstance]allDisplayIdentifiers]
[[SBApplicationController sharedInstance]allApplications]
Hope this helps, has taken me quite awhile to get most of these. Sometimes weeks at a time to figure one out. If you have any let me know, and I will add them. Most all of these can be found in LockBuilder Evo

8 comments:

  1. When I try to do the first 4 in the terminal I keep getting an error like this:
    ReferenceError: Can't find variable: SBBacklightController

    I can run the NSDictionary ones from the terminal but can't get the same in my lockscreen. In the code below the alert never shows. Any thoughts?

    <*script type="text/cycript">
    var settings = [NSDictionary dictionaryWithContentsOfFile:@"/var/mobile/Library/Preferences/com.mchnhd.LSCountdown.plist"];
    alert('after settings');

    ReplyDelete
  2. Hej M8,

    Good coding here !!!

    Try to fetch weather from the local

    sharedPreferences] localWeatherCity]

    Everything is working but I not the forecast and today's high low temperatures which are stored in arrays


    How can I read out these Array variables?

    Thanks
    Thewaytozion

    ReplyDelete
  3. var days=[[[WeatherPreferences sharedPreferences] localWeatherCity]dayForecasts];

    alert(days[0]); would give you the first day.
    alert(days[1]); second day etc

    If you want to say get the high then. alert(days[0].high); would get the first day forecast high.

    ReplyDelete
  4. If you just alert(days); you will get he whole object, so you can see the keys. Best to do this in cycript from Terminal instead of dealing with alerts.

    http://cydgets.blogspot.com/p/cycript-pronounced-ssscript.html

    ReplyDelete
  5. Hej M8,

    just another question ;). Do you know the code for forcing the standard iOS weather app to fetch the weather data - like it is doing when you pulling down the notification center.

    For now I am using the weather plist to load the weather data to my LS, but to update the plist I need to pull the notification center or open the weather App itself.

    Thanks and have a nice day

    Thewaytozion

    Btw I am currently 1nspired ;)

    ReplyDelete
  6. By the way

    Do you know how to read out an array within an array?

    More specific how to read out the
    dayForecasts
    from the non gps cities (which are stored in the array "cities").

    Thanks
    Thewaytozion

    ReplyDelete
  7. Is there a way with "cycript -p SpringBoard" to set a badge on any app?

    ReplyDelete