An AppleScript to create a Virex7 GUI

May 14, '03 09:41:00AM

Contributed by: Anonymous

I may be the only OSX 10.2 user in the world to buy Virex 7 without knowing of its crashing GUI. I'm also somewhat uncomfortable in Terminal. Therefore, I wanted to share an AppleScript I wrote to give me somewhat of a "GUI" for Virex. Read the rest of the hint for the script.

[robg adds: Although I have verified that the AppleScript syntax is correct, I have not tested the script itself -- if someone wants to try to verify if it works, please post your results!]

Replace "mypassword" with your own and compile the script as an applet.

set chooseVar to display dialog "Scan a file or a folder?" ¬
buttons {"File", "Folder", "Cancel"} default button 2
if button returned of chooseVar is "Folder" then
  set scanVar to display dialog "Scan Or clean?" ¬
  buttons {"Scan", "Clean"} default button 2
  if button returned of scanVar is "Scan" then
    set scanInstruct to ""
  else
    set scanInstruct to "c"
  end if --scan or clean folder
  set recursVar to display dialog ¬
  "Scan top level of folder or the entire directory?" ¬
  buttons {"Top scan", "Recursive scan"} default button 2
  if button returned of recursVar is "Top scan" then
    set recurse to ""
  else
    set recurse to "r"
  end if --recursVar is "Top scan"
  set itmsAlis to choose folder
  if scanInstruct is not "" or recurse is not "" then
    set scanOpt to " -" & scanInstruct & recurse
  else
    set scanOpt to ""
  end if --scan or recurs is not ""
else
  if button returned of chooseVar is "File" then
    set recurse to ""
    set scanVar to display dialog "Scan or clean file?" ¬
    buttons {"Scan", "Clean"} default button 2
    if button returned of scanVar is "Scan" then
      set scanInstruct to ""
    else
      set scanInstruct to "c"
    end if --scanVar is "Scan"
  end if --chooseVar is "File"
  set itmsAlis to choose file
  if scanInstruct is not "" then
    set scanOpt to " -" & scanInstruct
  else
    set scanOpt to ""
  end if --scanInstruct is not ""
end if --chooseVar is "Folder"
set dkTopAlis to path to desktop
set scanItm to quoted form of POSIX path of itmsAlis
set dkTop to quoted form of POSIX path of dkTopAlis
set shscr to "./usr/local/vscanx/vscanx" & scanOpt & " --summary > " ¬
& dkTop & "report.txt " & scanItm & " &"
with timeout of 96000 seconds
  do shell script shscr password "mypassword" with administrator privileges
end timeout

Comments (8)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20030511212920697