Need help making a simple script for my webcam

Hey everyone, fairly new to applescript programming. I just bought a usb camera for my macbook because I use it for video conferencing/playing around, and it is better quality than the built in isight. However, in order to use this camera I need to use drivers from a program called camTwist. This being said camTwist needs to be opened first and the usb camera must be selected from camTwist Step 1 list in order for any other application to use the camera. I just want to make a simple program that would open camTwist first, then select "webcam" from the list (double click it like I always have to in order to select it) in order to activate the driver, and then open photo booth which would then be using the camTwist driver in order to take pictures.
I made a crude program but it does not automatically select "webcam" from the Step 1 list in camTwist:
tell application "CamTwist" to activate
delay 10
tell application "Photo Booth" to activate
that’s basically it. I set the delay to 10 seconds so that when camTwists boots up first I can manually select my webcam. HOWEVER, I would like to make a script that would boot up CamTwist first, select my webcam from the list automatically, and then open Photo Booth with the CamTwist webcam driver already selected.
Don't know much about applescript so any help to make a working script to solve my problem would be greatly appreciated! Thanks!

Solved my problem but now I need help with something else! First I used CamTwist user options to create user defined hot keys with the specific purpose to load the webcam. I chose Command+B. I tested it out in CamTwist and it worked. The program follows a logical order from there. First it loads CamTwist, then after a short delay it presses the hot keys in order to load the webcam from the video source list, then another short delay and Photo Booth is opened with the driver loaded from camTwist. Everything works Perfect! Here's the code:
tell application "System Events"
tell application "CamTwist" to activate
delay 0.5
--Press command+b which is a user defined hot key to load webcam
key code 11 using command down
end tell
delay 0.5
tell application "Photo Booth" to activate
My Next question is, would it be possible with this same script to have both applications quit together. For example I always quit Photo Booth first, so when I quit photo booth is there a way to make CamTwist also quit and keep everything within the same script? Please let me know. This forum has been very helpful and lead me to a solution to my problem! Hoping I can solve this next problem as well! Thanks everyone.

Similar Messages

  • [solved]Need help with a bash script for MOC conky artwork.

    I need some help with a bash script for displaying artwork from MOC.
    Music folders have a file called 'front.jpg' in them, so I need to pull the current directory from MOCP and then display the 'front.jpg' file in conky.
    mocp -Q %file
    gives me the current file playing, but I need the directory (perhaps some way to use only everything after the last  '/'?)
    A point in the right direction would be appreciated.
    thanks, d
    Last edited by dgz (2013-08-29 21:24:28)

    Xyne wrote:
    You should also quote the variables and output in double quotes to make the code robust, e.g.
    filename="$(mocp -Q %file)"
    dirname="${filename%/*}"
    cp "$dirname"/front.jpg ~/backup/art.jpg
    Without the quotes, whitespace will break the code. Even if you don't expect whitespace in any of the paths, it's still good coding practice to include the quotes imo.
    thanks for the tip.
    here it is, anyhow:
    #!/bin/bash
    filename=$(mocp -Q %file)
    dirname=${filename%/*}
    cp ${dirname}/front.jpg ~/backup/art.jpg
    then in conky:
    $alignr${execi 30 ~/bin/artc}${image ~/backup/art.jpg -s 100x100 -p -3,60}
    thanks for the help.
    Last edited by dgz (2013-08-29 21:26:32)

  • Need Help making a navigation menu for a website

    Alright so I've been having some problems getting this to work correctly. I am making a navigation menu for a website and I'm trying to get when I hover over the main header a drop down appears animated of course below it. I also want when you highlight a specific text line for it to highlight blue along with a rectangle behind it to change to a lighter shade of red.
    Some of the problems  I have been running into is play and stop commands on mouseover and them not stopping when they should and getting the text to change color.
    Thanks for the help.
    Here are some screen grabs of what I am doing
    http://imgur.com/W2bZuF3
    http://imgur.com/W2bZuF3
    http://imgur.com/2GI3y71

    Your page's code is still a bit of a wreck.  Do you ever look at it?
    <html>
    <style type="text/css">#p7MBM_1 {
      width: 951px;
    You need a doctype first - I recommend HTML4.01 Transitional.  Open this (and other pages) in DW and use FILE | Convert > HTML 4.01 Transitional, then save.  But wait until you do the other changes recommended below before doing this.
    Add a <head> tag below the <html> tag.
    Add a <title> tag below the <head> tag.
    Add this below the <title> tag - <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    Add </head> below this -
    <style type="text/css">
    <!--
    .style10 {font-family: "Goudy Old Style"}
    -->
    </style>
    You may want to change that font-family style to "Goudy Old Style, Geneva, Times, 'Times New Roman', serif", since Goudy is not web safe.
    Move <body> below that </head> you just added.
    That will clean your code up a bit.  Let's look at the page again when you have done these.

  • *Help* making a simple RPG for my AP CS class

    I am in desperate need of help, I am creating an RPG(of sorts, it is a purely a battle RPG in which characters level up and modify stats) there will be no storlyine (Yet) or adventure elements. I've reached a severe mental roadblock in the actual programming of the game but I have a very clear picture of exactly how the game runs. Here's how the game works, after starting a new game from the opening screen, the player begins with a simple battle against one monster. The player has four characters and each character starts with one basic attack. Battle continues in typical RPG style in which the player selects attacks, and then battle ensues in order based on the speed of each participant. At the end of each battle, all the characters level up once and the player can distribute a certain amount of stat points to each of the characters individual stats. The game continues like this for 40 levels with increasing difficulty, new attacks, and an upgrade to a new class at level 20. level 41 is a final boss fight against a typical RPG boss monster. Here is what i particularly have trouble on
    1. Determining how to create the attacks that the player can choose and figuring out how i can call upon them and have them do their damage based on certain specs
    2. Determining how to create an interactive interface that allows the player to choose the attack for each character, upgrade individual stats after each battle, and save (this will be a point and click menu system)
    3. Figuring how to create and input my own homemade graphics into the game (the book i have doesn't seem to cover putting in graphics that you create on your own, just the graphics that are part of the java package)
    Any help on this would be greatly appreciated becuase it is a major grade in my class

    Hello,
    I have been programming (in various languages) for years now. I also am in AP CS and I have been trying to think up a good game to make, i'm about 2 months ahead of my coursework in class and spend my time making and re-making various games during class.
    If i were to program this game i would go about the Attack issue by having a class called Attack (as was mentioned early). In it have the methods and variables and such for the attack, i would have a database or something along those lines of all the attacks (but for now start small with a basic one) and then each player could have one (or multiple - depending on whether or not they have an assortment of attacks) class attached to it (or if multiple perhaps an array or vector of classes). The attack class would contain basic information like the Name of the Attack, the Damage, Type, etc. And the class could even include methods which get the 'Level' of the player and calculate the damage multiplier or something along those lines.
    As far as choosing what to have the characters/players do i would (for yours and simplicity's sake) make a side menu which allows you to choose whatever attack, etc. you want. It's simple and easier to work with, just have a JPanel within the JFrame which controls the players, and it will control each player when it's their turn. This shouldn't be too difficult to do.
    The graphics part (you have already recieved some suggestions about), i prefer to use ImageIcons in my games. They're simple and easy to work with and are painted just as a circle or rectangle is. You just draw the images outside of the program and use them in the program through ImageIcons. If you have a good image-edittor (Photoshop, Flash even), you can make Animated Gifs which will add to the look and quality of the graphics of your program.
    The trick with big projects like this (and the goal of Object Oriented Programming) is to take a big problem (Like and Entire RPG Game -- The Program) and break it up into smaller problems and tackle each one, one at a time (divide the Program into an assortment of Classes).
    I wish you the best of luck, i myself am starting a small game (Something similar to Zelda i'm thinking), i'm still designing it on paper and I personally think if you design and organize everything on paper and make a checklist of sorts, things go much smoother and more organized (not to mention faster).

  • I need help making a backup script

    I'm trying to create this full system backup script that I plan to run manually. I have some commands to compress and extract my root directory and everything in it, but they're not complete because there are a few other features I would like to have. The problem is that I have no idea how to implement these specific features, and my googling of bash scripting documentation only left me confused and at square 1. This is what I have so far (just commands I can run in the terminal):
    To compress:
    sudo tar -cpf ~/archive.tar.gz / --exclude=/proc
    To extract & restore:
    sudo tar -xpf /home/agi/archive.tar.gz -C /
    I want this script to:
    1. allows me to run as
    sh ~/.bin/backup.sh [directory to back up]
    What I mean is there should be some sort of parameter in the script so that when I run it, I can choose whatever directory I want to compress rather than just be limited to just /.
    2. puts finished .tar.gz in my home directory (I plan to transfer the archive to external media or online later; this gives me the freedom to not need to have a specific drive connected to run the script). I already have this in the commands, but I just wanted to point out that this is important.
    3. names finished .tar.gz DD-MM-YY-backup.tar.gz where DD is day, MM is month, YY is year.
    4. the "sudo" part works correctly. That is, the script, when run, asks for a password and can be granted root permissions (or is granted root permissions in some other way) so that I can back up all parts of my system without these sorts of errors.
    5. shows some sort of progress indicator. Either a progress bar, shows the tar program output, or something that gives me an indication that the script is working and perhaps how long it will take. This one is really optional, for as long as the process is working properly then I'm ok. But if it is possible and not ridiculously complicated or difficult, it would be very nice.

    What I mean is there should be some sort of parameter in the script so that when I run it, I can choose whatever directory I want to compress rather than just be limited to just /.
    On my backup script, I specify $* which should accept any arguments passed to the script.. ex: $ ./backup.sh /source/folder /source/folder2.
    in the script:
    #!/bin/sh
    tar -cpf $HOME/$(date +%d%m%Y)-backup.tar.gz $* --exclude=/proc
    2. puts finished .tar.gz in my home directory (I plan to transfer the archive to external media or online later; this gives me the freedom to not need to have a specific drive connected to run the script). I already have this in the commands, but I just wanted to point out that this is important.
    In the above script, that is what the ~ or $HOME should do..
    3. names finished .tar.gz DD-MM-YY-backup.tar.gz where DD is day, MM is month, YY is year.
    Same thing, the above script should do the trick, you might want to modify the date parameters (check the date manual)
    4. the "sudo" part works correctly. That is, the script, when run, asks for a password and can be granted root permissions (or is granted root permissions in some other way) so that I can back up all parts of my system without these sorts of errors.
    You could put something to prevent the script from running unless you are root, or you could have it prompt for a password and use sudo within the script. I would recommend the first. Here is a code snippet:
    #Check for root
    if [ $(whoami) != "root" ]; then
    echo "Error: You cannot perform this operation unless you are root"
    exit 1
    fi
    5. shows some sort of progress indicator. Either a progress bar, shows the tar program output, or something that gives me an indication that the script is working and perhaps how long it will take. This one is really optional, for as long as the process is working properly then I'm ok. But if it is possible and not ridiculously complicated or difficult, it would be very nice.
    You might be able to use a similar program to tar, but with progress. Maybe someone else could shed some light here..
    Hope this helps...

  • Need help in a simple script

    I'm basically trying to create a java script that will help me calculate certain values after I input an initial value, in this case, the weight of the car.
    I'm not really sure what's gone wrong, since I'm just a beginner at this. Could you all point me in the right direction?
    import javax.swing.JOptionPane;
    public class ForzaSpringCalculation
         public static void main(String[] args)
    //This script takes the weight and front bias data of the car and outputs the various spring rates
              double weight;
              double bias;
              double frontSpring;
              double rearSpring;
              double frontBump;
              double rearBump;
              double frontRebound;
              double rearRebound;     
         //Collects weight and weight bias data of car
              String weight=JOptionPane.showInputDialog("Weight of car?");
              System.out.println(weight);
              String bias=JOptionPane.showInputDialog("Weight front?");          
              System.out.print("Weight front: ");
              System.out.println(bias);
         //Calculations for suspension
              //Front Spring
              frontSpring=weight*bias/100*0.3828;
              System.out.print("Front Spring: ");
              System.out.println(frontSpring);
              //Rear Spring
              rearSpring=weight*100-bias/100*.3828;
              System.out.print("Rear Spring: ");
              System.out.println(rearSpring);
              //Front Bump Damping
              frontBump=frontSpring*0.00734;
              System.out.print("Front Bump Damping: ");
              System.out.println(frontBump);
              //Rear Bump Damping
              rearBump=rearSpring*0.00718;
              System.out.print("Rear Bump Damping: ");
              System.out.println(rearBump);
              //Front Rebound Damping
              frontRebound=frontBump*1.97;
              System.out.print("Front Rebound Damping: ");
              System.out.println(frontRebound);
              //Rear Rebound Damping
              rearRebound=rearBump*2;
              System.out.print("Rear Rebound Damping: ");
              System.out.println(rearRebound);
              System.exit(0);
         Thanks a lot!

    I see, so it's like double defining? But once I remove the 'double weight' and 'double bias', this is what I get.
    ForzaSpringCalculation.java:26: operator * cannot be applied to java.lang.String,java.lang.String
    frontSpring=weight*bias/100*0.3828;
    ^
    ForzaSpringCalculation.java:31: operator * cannot be applied to java.lang.String,int
    rearSpring=weight*100-bias/100*.3828;
    ^
    ForzaSpringCalculation.java:31: operator / cannot be applied to java.lang.String,int
    rearSpring=weight*100-bias/100*.3828;
    ^
    3 errors
    Is there another String thing I can use?

  • I need help making a simple droplet

    Here is what I need it to do.
    I need a droplet to open and save. Yes, that's it.
    The file must go back into its original folder.
    The droplet needs to prevent the jpeg compression dialog from opening during operation.
    PC CS4.
    What I use it for:
    I shoot wireless and the ITP Pixagent server software that I use allows the files to run through a droplet on the way into the folder.
    The reason that I need this particular droplet is that not all software reads the metadata that rotates the "auto rotate" images coming from my Canon 5D.
    Also, once the images have been run through this droplet, they never show the jpeg compression dialog again, which is nice for workflow later down the stream.  The files are all oriented correctly for any software.
    Also when shooting away from the studio, a folder of images can be drug over the desktop droplet's icon and the folder will then batch all the files through the droplet.
    I created this droplet about three years ago and didn't write down the procedure. And forgot! like an idiot. I've tried to duplicate it with no success.
    anyone want a challange?
    I am currently getting an error that "the droplet has quit working"

    As far as I know this will be included in the next ISO release. I solved it by manually bringing the dmraid package to the install and wrote a guide on installing your root system on dmraid. However when the system crashes I have the slight inconvenience of having to install dmraid and manually mount the sets to do a recovery. I guess this is the part you want to get rid of aswell. I decided to wait until the next holy ISO.

  • Need Help to create new screen for RF Sapconsole

    Hi Guru's
    I'm new on RF (but some years in ABAP) since last week.
    I need help to create new screens for RF (SAPLLMOB).
    Can someone explain me the procedure to create screen (with ABAP code after) or perhaps someone have an exemple (simple or not) ?
    I have to develop 2 new screens with really few time.
    And, another subsidiary question :
    how SAP can transfert information between the flash gun and the screen i have developped.
    Is there some code to add to enable this functionality or it is include in SAPLLMOB on standard fields ????
    It's a new strange world for me today...
    Many thanks to everyone who can explain me
    Alain

    hi,
    I am facing this problem as well. Is there any reference to create the new screen?
    Hope someone can help! Thanks!
    Regards,
    Darren

  • Need steps to create ant scripts for publishing and deploying projects.

    Need steps to create ant scripts for publishing and deploying projects.
    Have got ant, Oracle BPM Enterprise WL edition installed , Need to know what are the other configurations to be done.
    Any working example would help me to understand, please do mail me at [email protected]
    Thanks in advance.
    -Sree

    Sreekant,
    Please find the build file to publish and deploy.
    <project name="deployProject"
    xmlns:fuego="antlib:fuego.tools.ant.enterprise"
    xmlns:fuego.j2ee="antlib:fuego.tools.ant.j2ee" default = "publish">
              <property file="./Properties/fuego_deploy.properties"/>
              <fuego:passport id="fuego.passport"
    directoryid="${fuego.directoryid}"
    preset="engine" />
    <target name="publish" description="Publish and deploy processes" depends = "takeInputs">
    <!-- Open a session to the Oracle BPM directory -->
    <fuego:session
    passportref="fuego.passport"
    verbose="true"
                   properties="${fuego.basedir}/conf/directory.xml"
    haltonerror="true" >
    <!-- Publish processes -->
    <fuego:publish fpr="${fuego.project.name}"
    deploy="true"
    engine="${fuego.engineName}"
                        importdata = "${fuego.importdata}"
                        automaproles="${fuego.automaproles}"
                        automapbuspars = "${fuego.automapbuspars}"
                        automapvars="${fuego.automapvars}"
                        automapconfigs = "${fuego.automapconfigs}">
    </fuego:publish>
    </fuego:session>
    </target>
    <target name= "takeInputs" >
    <input
    message="Please enter admin-username:"
    addproperty="fuego.participant"
    />
    <input
    message="Please enter admin-password:"
    addproperty="fuego.password"
    >
    </input>
    </target>
    </project>
    and find the properties I have used..
    fuego.basedir=C:\OraBPMEnterpriseHome
    fuego.directoryid=default
    fuego.engineName = bpmengine
    fuego.project.name = E:/antExamples/Project/CommonUtilities
    # If the below property is true then ant script imports data from the project, as defined in Studio.
    # This includes importing:
    #      •Holiday and Calendar rules
    #      •Organizational Units
    #      •Roles
    #      •Resource configurations
    #      •External Variables
    fuego.importdata = true
    #If the below property is true ant script automatically map abstract roles to real ones with the same name.
    fuego.automaproles=true
    #If the below property is true ant script automatically map business parameter variable names (as defined in the project design) to an business parameter variable id with the same name (as defined in the Fuego Enterprise directory).
    fuego.automapbuspars = true
    #If the below property is true ant script automatically map external variable names (as defined in the project design) to an external variable id with the same name (as defined in the Fuego Enterprise directory).
    fuego.automapvars=true
    #If the below property is true ant script automatically map External Resources configurations (as defined in the project design) to real Configurations with the same name (as defined in the Fuego Enterprise directory).
    fuego.automapconfigs = true

  • I need help making Adobe Edge animation appear correctly on iphones, ipads and android phones.

    I need help making Adobe Edge animation appear correctly on iphones, ipads and android phones. It currently looks fine on desktops and androids. I am using wordpress with a responsive theme (Canvas). I will need you to document The url is http://adamhtc.org.s183459.gridserver.com.

    Thanks George, interesting thought.  I looked on Adobe's site and they "advertise" fillable forms for the iPhone and Android markets, but on the Windows Phone tab, that is mysteriously missing.  lol    Maybe it will come later?   Meanwhile, I'll google to see if there are any PDF viewers that can handle it now.   Thanks for the reply.  :-)

  • How do I reorder songs in a playlist in the new itunes??? I can no longer just click and drag. When I click, it doesn't move!!!! Need help ASAP- trying to prepare for an aerobics class and need songs in a specific order!

    How do I reorder songs in a playlist in the new itunes??? I can no longer just click and drag. When I click, it doesn't move!!!! Need help ASAP- trying to prepare for an aerobics class and need songs in a specific order!

    Vera,
    Use View > View Options, and set 'Sort By" to "Manual Order."
    Then you will be able to drag-n-drop songs up and down the list.

  • Need help with a activation code for Adobe Acrobat X Standard for my PC,, Don't have older version serial numbers,  threw programs away,  only have Adobe Acrobat X Standard,  need a code to unlock program?

    Need help with a activation code for Adobe Acrobat X Standard for my PC, Don't have older Version of Adobe Acrobat 9, 8 or 7. 

    You don't need to install the older version, you only need the serial number from your original purchase. If you don't have them to hand, did you register? If so, they should be in your Adobe account. If not you really need to contact Adobe, though it isn't clear they will be able to do anything without some proof of purchase etc.

  • I need help getting new authorization codes for digital copies

    I need help getting new authorization codes for digital copies of movies. Can someone help me out?

    There's a lot of results in Google when you search for this but unfortunately refreshing the page doesn't seem to generate a different code anymore. Mine also says already redeemed

  • I need help in Downloading Adobe Elements for my Mac & Adobe Acrobat for my laptop...I have been battling for the last day.

    I need help in Downloading Adobe Elements for my Mac & Adobe Acrobat for my laptop...I have been battling for the last day.

    ~graffiti wrote:
    PjonesCET wrote:
    I know if you attempt to download and exe file to Mac from a Mac Partition you'll get something like. Cannot not understand file format octet-stream. This means it does not recognize MS execute files.
    Not necesarily. I've done it a few times.
    PjonesCET wrote:
    I'm not sure you can download a PC copy of Acrobat 9 unless you operating from bootcamp or other such application and running the PC partition.
    Yes. You can.
    I've learned something. New. This must be recently changed. That last time I clicked on a Link I though was a dmg file and turned out it was and exe file my Macs wouldn't allow me to do so. But haven't tried recently everytime and exe file comes up I cancel. I gues I am used to the time everytime a Virus or some other nasty was downloaded it was packaged in and exe file and Macs owuldn't allow it. I suppose with the INtel guts now they can no longer refuse to download.

  • I need help making a new Arch install ISO

    I have posted a couple of messages, but as yet no one seems to have responded, probably because they have not read them.
    I need help building a new ISO for Arch, to take account of dmraid.
    I can and have built ones that get so far, and clearly I am not that far away.
    All I need help with now is getting at the contents of the initial ramdisk (/isolinux/initrd.img) so I can make a new one with modifications, and if anyone can help, I need a hand working out how to use the kernel26.img that I will end up with on a system.
    Any help appreaciated.

    As far as I know this will be included in the next ISO release. I solved it by manually bringing the dmraid package to the install and wrote a guide on installing your root system on dmraid. However when the system crashes I have the slight inconvenience of having to install dmraid and manually mount the sets to do a recovery. I guess this is the part you want to get rid of aswell. I decided to wait until the next holy ISO.

Maybe you are looking for

  • Trouble connecting to xserve.

    The connections are very slow and when I log into the server monitor instead of showing an ip address for the client, it lists it as "broadcasthost" instead of an ip address. How do I get the connection to show the ip address correctly? Any help is a

  • Ati & vaio = overheat &loud fan

    since a few months I was very annoyed with the loud fan and overheated laptop (70-90º). reboot to windows and all normally. i try everything.. believeme.. yesterday, while moving teamviewer's wine window with Mod4key (windows' super key) and mouse (d

  • Help with HardwareTest error code -  2GMC/3/13 :Built-In

    hello, I have an IMac 20" 2.0ghz G5 PPC I'm not sure if it qualifies for the repair programme, my mac has an EMC number 2056 and often freezes when waking up or trying to goto sleep. hardware test in normal mode runs through ok but in extended mode a

  • Rescue and recovery 4.21 backup stays at 0%

    Hi all, I try to find a solution but nothing proposed on other threads worked for me up until know. Product: ThinkCentre M55e Rescue and recovery 4.21 with latest patches Operating system: Windows XP Pro - SP3 From the rr.log I see the following: Sun

  • After changing to a newer Firefox, my bookmarks have disappeared, and "restore from backup" just gives "unable to process the backup file".

    I've tried the maintenance tool for places.sqlite, and even deleting the file so firefox rebuilds it. But no joy. New version is 36.0.1. Can't remember old one, but it was quite old. Five json files available, but none work