1. mikelcal's Avatar
    Inspired by the legendary BlackBerry PlayBook warrrior HaTaX's post here and the recent surge of converted android apps, I too created a simple way to load PlayBook .bar files from my mac using a simple AppleScript I'd like to call oBarLoad. I'm in no way a developer, nor coder, but I do find that I am an excellent researcher

    This script requires that you edit a few lines of code, and assumes that you already have a "PlayBook_Tools" folder somewhere on your harddrive and that you know how to put your PB in Developer mode. If you know a way to add a user interface to this script, by all means let me know how to do it so that I can update the script and thread with all the relevant files needed.

    If you are familiar with AppleScript, just fire up the AppleScript editor and paste in this code

    Code:
    set filecount to 0
    
    on open loadbar
    	repeat with i in loadbar
    		set filecount to 1
    		tell application "Terminal"
    			set currentTab to do script "cd /Users/username/directory/Playbook_Tools" -- replace what is inside the quotes with the directory where you have Playbook Tools
    			set filename to POSIX path of i
    			do script "java -Xmx512M -jar  \"BarDeploy.jar\" -installApp -device 127.0.0.1 -password passwordhere " & filename in currentTab -- change 127.0.0.1 to your actual developer ip found in the status bar of your pb, also change passwordhere to your actual password
    			do script "exit" in currentTab
    			delay 10
    		end tell
    	end repeat
    end open
    
    if filecount < 1 then
    	tell application "Terminal"
    		do script "exit"
    	end tell
    end if
    If you prefer, download the applescript below and edit it with AppleScript.

    Hit compile in AppleScript and save it as an .app you can then drag your .bar files to the icon and watch the magic unfold. Yes, I said files, you can drag multiple files to oBarLoad to sideload multiple .bar files simultaneously!

    [b]*NOTE*[b] You have to edit the script to tell it where your PlayBook-Tools folder is and what your developer ip/password are. I'm still researching how to make it so that you don't have to edit the script and instead have it ask you for the ip and password.

    I hope someone finds it useful.
    Last edited by mikelcal; 01-09-12 at 03:51 PM.
    01-09-12 12:05 AM
  2. rob7100g's Avatar
    Hi Mike,

    Excellent job, thanks!

    I had to point to the Playbook_Tools lib folder (attached) to get it to work. Once done everything worked.

    FWIW I find it easiest to put the bar files in the Playbook_Tools folder as well.

    -- Robert.
    mikelcal likes this.
    01-09-12 02:32 AM
  3. mikelcal's Avatar
    Hi Mike,

    Excellent job, thanks!

    I had to point to the Playbook_Tools lib folder (attached) to get it to work. Once done everything worked.

    FWIW I find it easiest to put the bar files in the Playbook_Tools folder as well.

    -- Robert.
    no, thank you for the kind words! l'll work some more on this later on today.
    01-09-12 10:25 AM
  4. solidkundi's Avatar
    woww... good work sir...

    but i'm a n00b when it comes to playbook stuff...

    can you please specify a step procedure... so you won't be asked these questions...

    I'm guessing you >> plug in usb >> development mode on >> drag bar to app(script)?

    i didn't understand the part about the username / password file... if someone can please help... it'll be greatly appreciated
    01-09-12 11:40 AM
  5. Sergag's Avatar
    I have that line in the Terminal...

    "Unable to access jarfile BarDeploy.jar"

    So the sideload doesn't work, question, were is that BarDeploy.jar file. Thanks.
    01-09-12 03:42 PM
  6. mikelcal's Avatar
    woww... good work sir...

    but i'm a n00b when it comes to playbook stuff...

    can you please specify a step procedure... so you won't be asked these questions...

    I'm guessing you >> plug in usb >> development mode on >> drag bar to app(script)?

    i didn't understand the part about the username / password file... if someone can please help... it'll be greatly appreciated
    I do apologize, I should write a proper How-To. After you download the script, you actually have to "right-click" the file and open with applescript editor and change the lines of code where your PB tools folder is saved. Also you have to edit it to reflect your developer IP/Password. If your PB and laptop are connected to wifi using the same network, you dont even need to connect to USB!! after that is done hit save and you can drag and drop any bar file on the app. Hope this helps.
    01-09-12 03:49 PM
  7. mikelcal's Avatar
    I have that line in the Terminal...

    "Unable to access jarfile BarDeploy.jar"

    So the sideload doesn't work, question, were is that BarDeploy.jar file. Thanks.
    It should be in the Playbook_Tools folder you have to edit the line where it changes directories to the PB tools folder. If you dont have them, I just uploaded the zip file.
    01-09-12 03:53 PM
  8. mikelcal's Avatar
    Thanks everyone for your comments so far. I will work on an even easier way to sideload apps to your PB on a Mac.
    01-09-12 03:54 PM
  9. Sergag's Avatar
    Ok, I've downloaded the java lib and now it work, big thanks, no need to pass by Windows anymore.
    Last edited by Sergag; 01-09-12 at 04:18 PM.
    01-09-12 04:08 PM
  10. CanadianThomas's Avatar
    cool script, thanks. I use the terminal but this is good for those who are shy of the old school text command.

    OP. I think if you pulled this script in to automator, you could add the ability to have a pop up for filling in the info. Maybe one at a time?

    But once a person edits the info for themselves, and sets their router to give the playbook a static IP address, it makes for a great desktop drop application. Good job.

    Thanks.

    My advice to all is to make your router give your playbook the same IP (static) then place your PlayBook_tools in your documents. This way you can edit this script once and it will always work.
    Last edited by CanadianThomas; 01-09-12 at 11:22 PM.
    01-09-12 10:09 PM
  11. CanadianThomas's Avatar
    Anyone have an issue with file names with spaces? I'll check into it further.
    01-09-12 11:47 PM
  12. BigRed65's Avatar
    Hello,

    Here is what I did to provide prompts into the initial scripts. I make no guarantee, the last version loaded, but I was having variable substitution errors with the do script with the collected data for some reason.

    You need to change the location variables too. I blanked mine out in the script - current tab



    property passwd : ""
    property pbip : ""

    set ipd to ""
    set pass to ""

    set pass to display dialog "Enter your debug password" default answer pass
    set passwd to text returned of pass
    set ipd to display dialog "Enter your playbook IP" default answer ipd
    set pbip to text returned of ipd
    display dialog passwd & " " & pbip

    set filecount to 0
    on open loadbar
    repeat with i in loadbar
    set filecount to 1
    tell application "Terminal"
    set currentTab to do script "cd /Users/username/location/Playbook_Tools" -- replace what is inside the quotes with the directory where you have Playbook Tools
    set filename to POSIX path of i
    -- do script "java -Xmx512M -jar \"BarDeploy.jar\" -installApp -device 127.0.0.1 -password passwordhere " & filename in currentTab -- change 127.0.0.1 to your actual developer ip found in the status bar of your pb, also change passwordhere to your actual password
    do script "java -Xmx512M -jar \"BarDeploy.jar\" -installApp -device " & pbip & " -password" & passwd & " " & filename in currentTab -- change 127.0.0.1 to your actual developer ip found in the status bar of your pb, also change passwordhere to your actual password
    do script "exit" in currentTab
    delay 10
    end tell
    end repeat
    end open

    if filecount < 1 then
    tell application "Terminal"
    do script "exit"
    end tell
    mikelcal likes this.
    02-07-12 05:51 PM
  13. mikelcal's Avatar
    Hello,

    Here is what I did to provide prompts into the initial scripts. I make no guarantee, the last version loaded, but I was having variable substitution errors with the do script with the collected data for some reason.

    You need to change the location variables too. I blanked mine out in the script - current tab



    property passwd : ""
    property pbip : ""

    set ipd to ""
    set pass to ""

    set pass to display dialog "Enter your debug password" default answer pass
    set passwd to text returned of pass
    set ipd to display dialog "Enter your playbook IP" default answer ipd
    set pbip to text returned of ipd
    display dialog passwd & " " & pbip

    set filecount to 0
    on open loadbar
    repeat with i in loadbar
    set filecount to 1
    tell application "Terminal"
    set currentTab to do script "cd /Users/username/location/Playbook_Tools" -- replace what is inside the quotes with the directory where you have Playbook Tools
    set filename to POSIX path of i
    -- do script "java -Xmx512M -jar \"BarDeploy.jar\" -installApp -device 127.0.0.1 -password passwordhere " & filename in currentTab -- change 127.0.0.1 to your actual developer ip found in the status bar of your pb, also change passwordhere to your actual password
    do script "java -Xmx512M -jar \"BarDeploy.jar\" -installApp -device " & pbip & " -password" & passwd & " " & filename in currentTab -- change 127.0.0.1 to your actual developer ip found in the status bar of your pb, also change passwordhere to your actual password
    do script "exit" in currentTab
    delay 10
    end tell
    end repeat
    end open

    if filecount < 1 then
    tell application "Terminal"
    do script "exit"
    end tell
    Thanks BigRed! This is great!
    02-11-12 10:56 PM
  14. BerryClever's Avatar
    I apologize for bringing back this thread, but it is the most helpful so far. I am still having trouble side loading through my mac though. I think maybe it has to do with the ip address. Clicking the dev. icon on the home screen I get 2 IP address. Do I use the first or the second? I am tweaking what I am doing, and each time I get a different error message. The last time was "Error: Authentication failed. There have been 2 out of 5 attempts"
    02-22-12 07:07 PM
  15. BerryClever's Avatar
    The thread is probably dead, but incase anyone else has the issues I had. It was a password issue, I used a password for the device, and a different password for sharing. I made them both the same, and it worked for me.
    02-23-12 12:08 PM
  16. NaijaBerry's Avatar
    I had issues with the "Unable to access jarfile BarDeploy.jar"

    So i added the location of that file at the end of the path like this
    cd /Users/Username/Playbook_Tools/lib
    and it worked then.

    Thanks for the Mac Script much faster to install than on windows which i have to borrow to use!
    eamon10 and retep like this.
    02-28-12 04:59 AM
  17. D_Town's Avatar
    still getting the bar error...:-(
    03-04-12 08:17 PM
  18. Denus's Avatar
    Hi all,

    I'm trying to compile the applescript, but I get this error message: "Syntax Error, Expected end of line but found end of script".
    I did copy the script as shown in this thread.
    What's the issue here?

    Thanks!
    03-05-12 02:25 AM
  19. Denus's Avatar
    Well, I managed to do the install with the .bat file on my Windows partition (dual boot is handy).
    03-05-12 06:46 AM
  20. eamon10's Avatar
    please help keep getting this "Unable to access jar file BarDeploy.jar"
    I've tried everything put in the correct path and everything.
    04-01-12 10:13 AM
  21. eamon10's Avatar
    I had issues with the "Unable to access jarfile BarDeploy.jar"

    So i added the location of that file at the end of the path like this
    cd /Users/Username/Playbook_Tools/lib
    and it worked then.

    Thanks for the Mac Script much faster to install than on windows which i have to borrow to use!
    this is genius. thank you soooo much it finally worked
    04-01-12 10:20 AM
  22. troyante's Avatar
    first of all my terminal message is this
    admins-MacBook-Pro:~ admin$ then i try to add the
    java -Xmx512M -jar BarDeploy.jar -installApp -device PLAYBOOK_IP -password PB_PASSWORD appname.bar
    and then it says
    the it says Unable to access jarfile BarDeploy.jar
    08-05-12 12:45 PM
  23. Sammity's Avatar
    Looks like I'll be reviving this dead thread sorry!

    First of all, thanks to the OP for taking the time to share his applescript it is much appreciated.

    But I also had slight problems with the applescript on my computer, I edited the initial directory line from :
    set currentTab to do script "cd /Users/username/directory/Playbook_Tools"
    to the following
    set currentTab to do script "cd Playbook_Tools/lib"

    This is because when I open terminal I 'm already in my user directory.

    After this it was all working, happy days!
    08-27-12 05:31 PM
  24. b1g1an's Avatar
    I only needed to put the "lib" on the end for mine to work...and then the time it took to realise I needed to remove the spaces from the file names!


    Sent from my BlackBerry Runtime for Android Apps using Tapatalk 2
    08-28-12 02:34 PM
LINK TO POST COPIED TO CLIPBOARD