Jump to content

Search the Community

Showing results for tags 'Entropy'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Alfred 3
  • Make the Most of Alfred
    • Discussion & Help
    • Bug Reports
    • Alfred Feature Suggestions
    • Themes
  • Alfred Workflows
    • Share your Workflows
    • Workflow Help & Questions
  • Alfred v2 Themes
  • Alfred Remote for iOS
    • Alfred Remote Discussion & Help
    • Remote Connection Troubleshooting

Categories

  • Articles
    • Forum Integration
    • Frontpage
  • Pages
  • Miscellaneous
    • Databases
    • Templates
    • Media

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Twitter


Website URL


Jabber


Location


Interests

Found 1 result

  1. Hello Everyone, I'm hoping to find some direction here, so let me be clear. This is not a "please, oh please, do this for me" post. I genuinely want to learn. To the point: I've created a workflow for Entropy using applescript, and I have two ideas I wish to implement. Being that I'm very new to all of this (scripting in general), I don't have the slightest clue where I should be focusing my attention (e.g. do I need php, perl, etc?), or can I get to where I want without such methods. Here's what I want to add: 1. Currently I'm calling the script (run script; /usr/bin/osascript) with a keyword (zip), and using the query to designate the name of the archive, if no query is entered the script uses a default name. When I want to add a password to the archive I've set up another run script which uses the same keyword, but uses the modifier key cmd. This runs an almost identical script, but using applescripts display dialog to set the password. I wish to forgo the display dialog in applescript, and split the alfred query so that when I want to add a name and a password I would enter something like "zip name:password." How can I do this? 2. It seems that scripts called with a keyword work as expected, but if want to use a file action then I have to first open the selection in finder before I use the applescript. Why is this, and how can I get around this? Applescript: tell application "Finder" to set theSel to selection as alias list set theQ to "{query}" -- Alfred Query (Archive Name) if (count of theSel) is 1 then if theQ is "" then if (theSel as string) ends with ":" then set folderName to the POSIX path of theSel set thePath to text 1 thru ((offset of ":" in folderName) - 2) of folderName & ".zip" tell application "System Events" if (exists file (thePath)) then display dialog ("Archive Exists") return end if end tell else set shortName to the POSIX path of theSel set thePath to text 1 thru ((offset of "." in shortName) - 1) of shortName & ".zip" tell application "System Events" if (exists file (thePath)) then display dialog ("Archive Exists") return end if end tell end if else set thePath to ((path to desktop from user domain) as string) & theQ & ".zip" tell application "System Events" if (exists file (thePath)) then display dialog ("Archive Exists") return end if end tell end if else repeat with i from 1 to count of theSel set item i of theSel to POSIX path of item i of theSel end repeat set archiveName to getEmptyPath(path to desktop as text, "archive", "zip") if theQ is "" then set thePath to ((path to desktop from user domain) as string) & archiveName & ".zip" else set thePath to ((path to desktop from user domain) as string) & theQ & ".zip" end if end if -- Set Password for Archive --set thePassword to the text returned of (display dialog "Enter Password" default answer "") tell application "Entropy" archive thePath files theSel --settings {password:thePassword, encryption method:0} end tell --------------------------------------------------------------- -- See if a file with the passed name exists -- If so, add an integer to the name, and check again -- Keep checking until an unused name is found -- Parameters: path of file's container -- file name, no extension -- file extension -- Returns: updated file name --------------------------------------------------------------- on getEmptyPath(containerPath, fileName, fileExtension) set filePath to containerPath & fileName tell application "Finder" if exists file (filePath & "." & fileExtension) then set x to 1 -- Start Counting repeat set cFilePath to filePath & " " & x & "." & fileExtension if exists file cFilePath then -- Are we There? set x to x + 1 -- No, Increment Counter else exit repeat -- Yes, Leave end if end repeat return fileName & " " & x -- This Name is Safe to Use else return fileName -- Use Original Name end if end tell end getEmptyPath
×
×
  • Create New...