Applescript based app: Hiding a button in the UI if a certain file exists

Hope someone can help,
I'm writing a small app which can be used to easily configure printers in a school environment. I have designed the applescript-based app in xcode and it is working well.
I now wish to improve driver support for the app. I am installing each printer with the lpadmin command, and have had a reasonable amount of success with this too. But...
The app sources the drivers from /usr/share/cups/model. I need to have the app detect whether the driver(s) have been copied to the model dir, and if it can see them, hide the "Install Drivers" button in the UI.
So basically, in an applescriptish tongue,
if /usr/share/cups/model/2100.ppd exists then
enable button "Install drivers"
end if
Wow, hope thats not too confusing!
Hope you can help me to do this!

You could try something like this:
set exists_ to driverInstalled("/usr/share/cups/model/2100.ppd")
if exists_ then
set enabled of button "installButton" of window "main" to false
end if
-- OR --
if exists_ then
set hidden of button "installButton" of window "main" to true
end if
on driverInstalled(thePOSIXPath)
try
set thePath to ((thePOSIXPath as POSIX file) as alias)
return true
on error
return false
end try
end driverInstalled
You could try either of those options, though the hidden option is only available in OS X 10.3 and later. Also, I've only guessed at the syntax, since I moved on from AppleScript Studio to Objective C a while ago. This script assumes that you have a window whose AppleScript name is "main" and directly in it is a button whose AppleScript name is "installButton".
Hope this helps....
Dual 2.7GHz PowerPC G5 w/ 2.5 GB RAM; 17" MacBook Pro w/ 2 GB RAM -   Mac OS X (10.4.8)  

Similar Messages

  • Where do I find the "number of apps to update" button on the new iTunes?

    I can't find the "number of apps to update" option in the new iTunes.  Where has it gone?

    Hi Janice
    If you are talking about the Hard Drive, click on the Hard Disk on your Desktop to highlight it and then from the Finder menu > File select *Get Info*. You can also press Command + i to get the same dialogue box to open.
    There you will see, the Capacity of the Hard drive, how much is used and how much free space remains.
    If you are talking about the RAM, that shows in the first opening window of System Profiler.

  • TS4204 I need to delete a calendar event that transfered to my 4S from my Droid.  Also this event occurs yearly.  When I open this event, the edit button in the upper right corner does not exist so I can't delete it.  Any suggestions to get rid of it? Sur

    I need to delete a calendar event that transfered to my 4S from my Droid phone. This event occurs yearly.  When I open this event, the edit button that normally appears in the upper right corner does not exist so I can't delete it.  Any suggestions on how to get rid of it?

    uninstalled firefox ....deleted all files still remaining under mozilla firefox directory in program files ... to avoid having to reprogram all my settings, reisntall all addons as well .. I did not remove anything from mozilla firefox that is stored in either appdata or under the windows users directory (if any)
    ... the as suggested reinstalled the latest version of the firefox browser using the link you provided in the email ..; tested and several issues still remain present and unresolved ....
    so please this is urgent or I will have to jump browsers and start using chrome .. because we work 14 hours a day 6 (sometimes 7) days a week, to get ready for the launch of our newest venture and we cannot lose that much days on browser related issues ... so please instead of putting me through week long step process .. of do this .. do that .. can you please actually look into the issue from your end .. I use firefox for so many, many years thta I deserve this kind of support .. thnx Robert

  • Hiding minimize button in the frame

    hello,
    how can i hide a minimize button in frame.
    thanks in advance
    daya

    You'll have to set the visibility of the JFrame to false i.e.
    frame.setVisible(false);However, if you do this you may not be able to reopen your application unless you keep probably a JWindow containing a button or something to set the visibility of your app to true. So keep that in mind.
    Happy Coding!
    ICE

  • R12: Role based security : Hiding a button in OAF page for roles

    Hi All,
    We have a requirement where in which, we have to hide a "Create" button in AR customer search form for some roles ... we have implemented UMX - Roles based security in our project and we cant hide it based on user or resp ...
    Any ideas ... Is it feasible with this new featue of RBAC?
    Thanks and Regards,
    Senthil

    Hi Ajay,
    metalink note 2778881.1 is discussing "Page access tracking report".
    but here i want to implement access restrictions to a particular page.
    Regards,
    Naren.

  • Dreamweaver CS6 displaying the wrong icon for certain file types

    I recently upgraded to the Maverick and I noticed that my Dreamweaver changed some of my files' icon to Acrobat Reader symbol. This does not represent the actual file type. My most important files, such as mp3 and m4v, are not displaying correctly. My concern is that it is affecting my website. How do I change the icons back to the original file type icons? Much needed help! Thanks!

    What do local file associations have to do with your website? You have a severely wrong understanding of this stuff. Anyway, file associations on Mac can be changed using a right-click and Get Info and then choosing a new default program for the file type.
    Mylenium

  • Create a Skype Video Call button on the desktop in Snow Leopard

    Hi There,
    I'm having trouble working out how to create a script that will allow my 70+ year old mother in law make a video call in Skype from a button on the desktop.
    I found a discussion from 2007 on the forums but the steps don't seem to apply to the Snow Leopard version of Automator.
    Any suggestions would be most welcome.
    Cheers

    OK, have done some digging around and have come up with an Automator workflow that will not only start a video chat, but will speak to my mother in law so that during pauses (like when Skype starts up) she knows what's going on.
    There is practically no info online about how to do this so these instructions are for my reference just incase I forget - but others may find it useful.
    It looks like a lot of work but in reality it only took me 5mins to put together (I promise) and just makes it easier for people who have limited computer experience to call you.
    This works in both Leopard and Snow Leopard and may work in older versions too.
    1. Open Automator
    Open Automator at: /Applications/Automator
    The Automator starting point window will appear
    If you're using Leopard, choose "Custom" and and click the "Choose" button in the bottom right
    If you're using Snow Leopard, choose "Workflow" and click the "Choose" button in the bottom right
    Now you will have a blank workflow document open
    2. Create the Automator workflow
    In the Workflow document window, ensure the "Library" icon in the first list on the far left is selected so all variables are available
    Just above the lists you'll see a little search box, type "hide" into it
    The list will now show the "Hide All Applications" variable
    Click and drag the variable from the list and drop it into the main workflow section on the right
    Type "launch" into the search box and drag the "Launch Application" variable onto the workflow so it is under "Hide All Applications"
    Select "Skype" from the application drop-down menu
    Type "get text" into the search box and drag "Get Specified Text" into the workflow so it's under "Launch Application"
    Type "Now starting Skype, please wait a few moments." into the text box
    Type "speak" in the search box and drag "Speak Text" into the workflow under "Get Specified Text"
    Leave the voice on the default text of "Alex" - he's the easiest to understand bar far
    Type "pause" into the search box and drag "Pause" into the workflow under "Speak Text"
    Set it for 5 seconds. This will allow Skype time to sign-in. Depending on your connection speed, you may need to make it longer
    Shift click on the previous "Get Specified Text" & "Speak Text" variables in the workflow area
    Both should now have blue borders around them
    Hold down the option key and drag both items to duplicate them and drop them under the "Pause" variable
    Now you should have a copy of the "Get Specified Text" & "Speak Text" variables under the "Pause" variable
    If not, just manually add both items again by searching and dragging the variables into the workflow pane one by one as per above
    Replace the text in the new "Get Specified Text" box to: "Now checking to see if <name> is online"
    Where <name> is the person you would like to contact and removing the - I just used the first name
    Option drag the previous "Pause" variable above and drag it so it's under the last "Speak Text" variable
    Leave it at 5 seconds. Again, you may need to allow more time depending on your connection speed
    Type "run applescript" into the search box and drag "Run Applescript" so it's under the last "Pause" variable
    Now you should have an AppleScript window that will show some placeholder AppleScript
    3. Inserting the AppleScript
    Select and delete the placeholder AppleScript
    Copy the following script and paste it into the AppleScript box
    SkypeCall("<skypeUserName>")
    on SkypeCall(login)
    set AppleScript's text item delimiters to " "
    tell application "Skype"
    set foo to send command "GET USER " & login & " ONLINESTATUS" script name "MyScript"
    set UserStatus to my GetPart(foo, 4, " ")
    if UserStatus is "ONLINE" then
    say "<skypeUserName> is online, calling her now."
    send command "CALL " & login script name "MyScript"
    else
    say "<skypeUserName> is not online at the moment. Maybe try again later."
    end if
    end tell
    end SkypeCall
    on GetPart(s, p, d)
    set theList to every text item of s
    return (item p of theList)
    end GetPart
    4. Insert the Skype username of the person you would like to call into the script
    In the AppleScript box, locate ("<skypeUserName>") on the first line
    Change <skypeUserName> to the username of the person you would like to call removing the
    e.g. if the Skype username is johnbrown2, the first line of the script should look like:
    SkypeCall("johnbrown2")
    Do this in the two other places further down the script - remember to remove the when doing so
    These other two ares in the script tell the caller if the person is online or not
    5. Making the workflow a button on the desktop
    In Automator, choose >File >Save As
    Give your workflow a name like "Call John"
    Select "Application" from the "File Format" drop-down list
    Save it to your desktop
    NOTE: If you need to edit the workflow, you'll have to open it from Automater using >File >Open as double clicking it from the desktop will now run the workflow and call the person.
    6. Turning on Speech
    Because the older generation expect this to work like a telephone (and work instantly), I turned on Speech so the script tells them what is going on during the pauses in the script.
    Go to "System Preferences" from the Apple menu top left
    Click the "Speech" icon
    Click the "Speech Recognition" tab/button at the top if it isn't already selected
    Click the "On" radio button
    If this is the first time using Speech, you'll get a window asking you to enable access for assistive devices
    There should be a button to take you to the appropriate preference pane
    If not, just go to the "Universal Access" pane in System Preferences
    Once there (either way) check the "Enable access for assistive devices" box bottom left
    Back in the "Speech" preference pane", under the On/Off radio buttons, click the "Commands" tab/button
    Turn off all the check boxes except "Application Specific Items"
    Close System Preferences
    NOTE: Obviously if you use text to speech normally, leave these last settings alone and just ensure "Application Specific Items" is on (It's on by default normally).
    7. Hiding the Speech Microphone icon
    If you've done everything correctly, you will now have a big round microphone icon showing that can't be hidden
    I dragged mine to the bottom left corner and then further so all you can see is a little bit of the top right corner
    If anyone has a better way of disabling or hiding this big icon, sing out!
    8. Running the workflow and making a call
    Now double click your icon and the workflow will run. The script will check to see if the Skype user is online, if they're not, the script will tell them and stop running.
    If they are online, the worflow will start a video chat as long as you have "Start my video automatically" selected in your Skype preferences under "Video"
    Special thanks to SIMO HUOPIO ESPOO in Finland for the script I found on his blog here: http://huopio.fi/simo/blog/2009/03/learnin...ling-skype.html
    If you don't want the workflow to talk, don't turn on Speech in steps 6 & 7...

  • Using UIScrollView in a window-based app - IS IT POSSIBLE?

    sorry for noob question but i am very new and only 12 years old so i am very new. I am making an app that involves scrollviews but i want to use window based app so i can use the window setHidden piece of code instead of messing around with view controllers.
    My Question:
    How can I implement a scroll view into the app delegate .m since there is obviously no ViewDidLoad feature. Do I just make the IBOutlet in the .H file but what to do in the .M file to get the "scrollview ScrollEnable:YES" and the CGSize parameters in without causing a massive error?

    Hi Tom, and welcome to the Dev Forums!
    tomgoodenough wrote:
    sorry for noob question but i am very new
    This forum is for developers of all levels, including future developers and has-beens. Beginners are especially welcome.
    i want to use window based app so i can use the window setHidden piece of code instead of messing around with view controllers.
    I don't know why you'd want to hide your main window, but in any case, a view controller wouldn't prevent you from doing that. View controllers do all kinds of good things behind the scenes and catch lots of useful messages, which is why they're almost always recommended for any full-screen view--even in the simplest possible project (see [Overview|http://developer.apple.com/library/ios/#documentation/UIKit/Reference /UIViewControllerClass/Reference/Reference.html%23//appleref/occ/cl/UIViewController] in the UIViewController Class Reference). That said, making iOS apps without any view controllers will be an excellent way for you to learn what they do for you, so onward and upward!
    How can I implement a scroll view into the app delegate .m ... Do I just make the IBOutlet in the .H file but what to do in the .M file to get the "scrollview ScrollEnable:YES" and the CGSize parameters ...?
    Yes, assuming a UIScrollView object has been added to MainWindow.xib, make an IBOutlet ivar and @property for your scroll view in the @interface (MyAppDelegate.h) of your app delegate, and connect that outlet to the scroll view in IB. Then add the scroll view to the window and set its properties in the [applicationDidFinishLaunching:|http://developer.apple.com/library/ios/#documen tation/UIKit/Reference/UIApplicationDelegateProtocol/Reference/Reference.html%23//appleref/doc/uid/TP40006786] method of the @implementation (MyAppDelegate.m). Don't forget to set the [contentSize|http://developer.apple.com/library/ios/#documentation/UIKit/Refere nce/UIScrollViewClass/Reference/UIScrollView.html%23//appleref/doc/uid/TP40006922] property of the scroll view to the size of the view it will scroll. The view won't scroll unless contentSize is higher and/or wider than the scroll view frame.
    ... there is obviously no ViewDidLoad feature. ...
    There's no reason your app delegate class needs to be a direct subclass of NSObject. It can just as easily be a subclass of UIViewController. In that case you could override viewDidLoad, or any of the other useful view controller methods in the app delegate @implementation. Just change the superclass from NSObject to UIViewController in the first line of the @interface, and connect the 'view' outlet of the app delegate to the scroll view object in IB.
    \- Ray

  • Applescript Studio app crashes with link error (dyld) image not found

    I've built a small Applescript studio app that works fine on the development machine but when I run it on other machines it crashes with a dyld error, specifically:
    Link (dyld) error:
    Library not loaded: /System/Library/PrivateFrameworks/ZeroLink.framework/Versions/A/ZeroLink
    Referenced from: /Volumes/Discover Your Mac Spotlight movie/Table of Contents Viewer.app/Contents/MacOS/Table of Contents Viewer
    Reason: image not found
    Does any one know why this happens and how I can fix it?
    Thanks very much in advance...
    iMac G5 20   Mac OS X (10.4.2)  

    Rick,
    looks like you built the application in "Development" mode - switch the build style to "Deployment" and most probably things will be fine in the other machine.
    Andreas

  • File problem - checking the existence of a remote file

    I have absolute paths to several text files from a ftp server (which don't require any
    authentication and can be accessed over the internet).
    I am trying to write a Java method that can check any of the above absolute ftp file
    paths and returns true/false depending on whether the file exists/doesn't exist.
    I tried somewhat this way:
    File current_file = new File(absolute_file_path);
    // absolute_file_path comes as a parameter
    // e.g. "ftp://ftp.test.com/myfile.txt"
    if(current_file.exists()) return true;
    // if the file exists return true
    return false;
    // otherwise return false
    Then I ran the program in my local machine which has internet access. But it returned
    false for all the files (even if the file exists). Seems like it's unable to get those
    files.
    Could someone please tell me how can I rewrite my program so that it can be executed
    locally.
    Thanks,
    SQ

    Does anyone know if URL and URLConnection support FTP
    directly? I can imagine downloads being simple, but
    how about uploads? Never tried with FTP myself.Yes, they do. But uploads don't work properly with Java 1.3. (Note: I only know this because I've seen questions asked about it here, not from personal experience.) If I wanted to know whether a certain file existed on an FTP server, I would use an FTP client that could tell me that. Such as the Jakarta Commons/Net FTP client.

  • Certain files contain the current bookmarks and bookmarks toolbar and and could be copied into firefox on another computer. I found these files but they only have my old bookmarks, not my current ones.

    In the past, there were certain files in the "Local Settings" and "Application Data" folders that contain my current Bookmarks and current Bookmarks Toolbar contents. I have been able to copy these files to a jumpdrive then use it to bring my CURRENT bookmarks and boomarks toolbar to Firefox on a different computer. When I attempt to do the same now, I get my bookmarks from 2 years ago and nothing at all on my bookmarks toolbar. I have successfully done this as recently as this past February. What happened to them and why can I not do this anymore?
    I NEED to have these bookmarks and bookmarks toolbar on my other computers. I do NOT want them uploaded to YOUR servers to be able to do this. The whole reason I use Firefox is to avoid using M$ for the very same reason you are now trying to force on your faithful users. This has been a huge factor for most of us to use Firefox, to get away from IE.

    If you have access to Firefox on that computer then export the bookmarks to an HTML file.<br />
    Otherwise you need the JSON backups in the bookmarkbackups folder and restore the bookmarks from the most recent JSON backup.<br />
    Note that this will replace all current bookmarks, so in order to keep these you need to export them to an HTML file and reimport that file after you have restored the JSON backup.
    See:
    *http://kb.mozillazine.org/Backing_up_and_restoring_bookmarks_-_Firefox

  • I purchased dungeon hunter alliance from the app store and accidentally hit the x button instead of the installed button to install the game how do I install the game now

    Can someone help me, I purchased the game dungeon hunter alliance froom the app store and accidentally hit the x button instead of the install button so now how can I install the game to my computer macbook

    Hi ...
    You accidentally "hid" the purchase ..
    Follow the instructions here.  Mac App Store: Hiding and unhiding purchases
    Once the app is available ...
    How to re download apps from the Mac App Store:
    Open the App Store. From the menu bar click Store > Sign In
    Click Purchases from the top of the App Store window.
    Select which apps you want to re download. Then right or control click where you see Installed  then click Install.
    Make sure and use the same Apple ID used for the original purchase.

  • When I try to update apps on my iPad mini, I tap the "Update" button, but the app just opens and doesn't update.

    I have an iPad mini, 16G, WiFi only. My operating system is iOS 7.0.3. My problem is that my App Store has stopped updating apps. And it's not like the update starts, but never finishes. It doesn't start at all. I touch the "Update" button, and the app opens instead of updating. I have 9 updates now, and none of them work. And the rest of the App Store is working fine. I have no problems searching for apps or downloading new apps. It's just the updates that don't work. I had thought that maybe I needed to update my software and then it would start working, but I can't. The available software update requires 5.9G of storage, and I only have 1.6G. I also thought that maybe there was not enough forage to update the apps, but if that was the case, then it would tell me that there is not enough storage instead of opening the app. Does anyone know how to fix this? I really need to update my apps!

    Hey there nstephanie0625,
    It sounds like you are unable to update your apps in the App store because they launch, rather than update. I would recommend starting by signing out of your Apple ID in Settings:
    iTunes: Using the iTunes Store for iPhone, iPad, and iPod touch
    Settings > iTunes & App Stores > Create New Apple ID on your device.
    Then quit all the running apps on your phone:
    iOS: Force an app to close
    Double-click the Home button.
    Swipe left or right until you have located the app you wish to close.
    Swipe the app up to close it.
    When you have done that restart the device and test the issue again:
    iOS: Turning off and on (restarting) and resetting
    Thank you for using Apple Support Communities.
    Regards,
    Sterling

  • When i go to buy an app on my ipod touch, i click the buy button then the install button and it just keeps repeating itself then dissappears, why is this?

    when i go to buy an app on my ipod touch, i click the buy button then the install button and it just keeps repeating itself then dissappears, why is this?     help me please, i cant download no apps.

    If  you have iOS 3.1.3 then it is an Apple problem.

  • Before I upgraded my iPad mini, you could turn off apps to save battery power by double clicking the control button and then holding your finger on the app button until the minus sign appeared.  That doesn't work anymore.  How do you turn off the apps wit

    Before I upgraded my iPad mini, you could turn off apps to save battery power by double clicking the control button and then holding your finger on the app button until the minus sign appeared.  That doesn't work anymore.  How do you turn off the apps with ios7

    Now you swipe downward, the app will appear and you delete, keep scolling to the right as in the past.  With the new operating system you also swipe downward to get the search bar to find an app

Maybe you are looking for

  • Bring back iTunes syncing feature back!

    I don't mean to be the stickler, but I cannot believe Apple decided to force us to use iCloud for syncing contacts. If i had known that upgrading to Maverick would have caused such, I would never have done so. I have a lot of personal and sensitive i

  • Sending e-mails to multiple users at a time

    Hi! I am using weblogic portal 7.0 for personalization. I am using campaign based e-mails for targetting specific customers. I am able to send e-mail through weblogic portal for users when the user logs in. How can I send group e-mails for a specific

  • Photoshop CS4 slow on my idea centre a600

    Hi. i have with me an IdeaCentre A600, 1gb ram, ati 3560. However, photoshop CS4 is laggy with this desktop. It is fast in loading images and all.. however, cropping is lagging (when highlighting the area i want to crop), adding text etc. any idea ho

  • I have an iPad (no iPhone) - how can I link facetime/iMessage to my phone number

    Hi there, New to the forums, can't seem to find this answer and if anyone could help that would be great. I don't have an iPhone. On my ipad, my apple ID only allows me to facetime and imessage by my email address. When I login with my girlfriends ap

  • Export markers to XML

    I create videos for online purposes. Often the videos need chapters which are clickable within the video player so the viewer can skip to certain parts of the video and even can create chapter playlists. These chapters are extracted from a XML file.