Jump to content

bcartledge1871

Member
  • Posts

    6
  • Joined

  • Last visited

Posts posted by bcartledge1871

  1.  

     

    "Securecrt /T", this option is not supported (anymore?).

     

    /T will open the session in a new tab. I think tabs where introduced in v.7, so if you have an older version remove the option

     

     

     

    All the sessions and directories must be without space. It's a big problem :s Is there any script expert around who could fix it 

     

    This is a pain and I hoped to go back and fix but never seem to find the time...

  2. Ok I got there in the end with the help of google. The script is below in case other SecureCRT users find it useful. It's my first attempt at Applescript so open to any suggestions or ways to simplify.

     

    One caveat is if the session name has a space it's not working. In this case the session name must be enclosed with quotation marks and I can't figure out the correct AppleScript syntax e.g. /Applications/SecureCRT.app/Contents/MacOS/SecureCRT /T /S "My Session". But as a workaround I can rename my session files and folders to remove any spaces.

    set findThis to "/Users/*******/******/VanDyke/Config/Sessions/" -- SecureCRT sessions path
    set replaceItWith to ""
    set newText to switchText of "{query}" from findThis to replaceItWith
    
    trim_ext(newText, ".ini") -- remove .ini extension
    
    do shell script "/Applications/SecureCRT.app/Contents/MacOS/SecureCRT /T /S " & result & " > /dev/null 2>&1 &" -- start SecureCRT
    
    to switchText of theText from SearchString to ReplaceString -- remove sessions path
    	set OldDelims to AppleScript's AppleScript's text item delimiters
    	set AppleScript's AppleScript's text item delimiters to SearchString
    	set newText to text items of theText
    	set AppleScript's AppleScript's text item delimiters to ReplaceString
    	set newText to newText as text
    	set AppleScript's AppleScript's text item delimiters to OldDelims
    	return newText
    end switchText
    
    on trim_ext(strg, trim_characters)
    	set trim_list to every character of trim_characters
    	set right_counter to -1
    	repeat with J from 1 to length of strg
    		if (character right_counter of strg) is in trim_list then
    			set right_counter to right_counter - 1
    		else
    			exit repeat
    		end if
    	end repeat
    	try
    		set strg to text 1 through right_counter of strg
    	on error
    		set strg to ""
    	end try
    	return strg
    end trim_ext
    
    
  3. I was able to get somewhere with this using a file filter and some text manipulation in an NSAppleScript action. What happens though is that SecureCRT launches and connects to the host, however while its running I can't use Alfred until I quit the SecureCRT application.

    do shell script "/Applications/SecureCRT.app/Contents/MacOS/SecureCRT /S " & result
  4. Within the .ini the hostname is referenced by IP address like this -

     

    S:"Hostname"=192.168.0.1

     

    With the field kMDItemTextContext I tried a value of "Hostname"={query} and no joy but I'm not sure thats what I'm looking for. I'd like to be able to open the sessions by name as I don't remember all the IP addresses. For example -

     

    Sessions Folder

         Houston

              Houston-router.ini

              Houston-switch.ini

         London

              London-router.ini

              London-switch1.ini

    ......

     

    When using the /S switch when opening SecureCRT it can only look for a .ini in the session folder root if you don't specify the full path.

     

    kMDItemPath would would be ideal but it doesn't look like it can be used with a query? http://stackoverflow.com/questions/1341590/no-results-in-spotlight-in-searches-against-kmditempath/1342019#1342019

  5. SecureCRT is a terminal client I use for ssh sessions. I've created a simple workflow that opens the app and passes a session name query to automatically connect to a host -

     

    /Applications/SecureCRT.app/Contents/MacOS/SecureCRT /S <Session_Name>

     

    Now this works fine but SecureCRT nests the session .ini files in folders (and I have a few hundred of these based on the device locations), so I find myself having to include the path in the keyword argument. For example "keyword \folder\host.ini".

     

    What I'd like to be able to achieve is a way of searching the folders for the host .ini and then passing the resulting path to the command line argument that launches the appropriate session in the app.

     

     

    Hope that makes sense and thanks in advance for any help or pointers.

     

×
×
  • Create New...