Saturday, September 19, 2009

AutoHotKey - MSE 입력 툴

Mental Status Examination의 입력 툴.

;===========================
; for Mental Status Examination
;===========================

^!m::
;----------- Push the clipboard ----------------------
clipSaved = clipboardAll
clipboard =

;----------- Initialize myReturningComponent-------
myReturningComponent := ""

;---------- Make GUI ------ Real Chicken Job !!! ---
;---------- No.1 ---
Gui, Add, Groupbox, X5 r1, General Appearance:
Gui, Add, Radio, xp+5 yp+20 vGoodLooking, Good-looking
Gui, Add, Radio, xp+100 yp+0 vPoorLooking, Poor-looking
Gui, Add, Radio, xp+100 yp+0 vImpreving, Improving State

;---------- No.2 ---
Gui, Add, Groupbox, X5 yp+25 r1, Verbal Productivity:
Gui, Add, Radio, xp+5 yp+20 vVerbalIncreased, Increased
Gui, Add, Radio, xp+100 yp+0 vVerbalNormal, Normal
Gui, Add, Radio, xp+100 yp+0 vVerbalDecreased, Decreased

;---------- No.3 ---
Gui, Add, Groupbox, X5 yp+25 r1, Psychomotor Activity:
Gui, Add, Radio, xp+5 yp+20 vPsychomotorIncreased, Increased
Gui, Add, Radio, xp+100 yp+0 vPsychomotorNormoactive, Normoactive
Gui, Add, Radio, xp+100 yp+0 vPsychomotorDecreased, Decreased

;---------- No.4 ---
Gui, Add, Groupbox, X5 yp+25 r2, Mood:
Gui, Add, Checkbox, xp+5 yp+20 vMoodEuthymic, euthymic
Gui, Add, Checkbox, vMoodDysphoric, dysphoric
Gui, Add, Checkbox, xp+100 yp-18 vMoodDepressive, depressive
Gui, Add, Checkbox, xp+0 yp+18 vMoodAnxious, anxious
Gui, Add, Checkbox, xp+100 yp-18 vMoodEuphoric, euphoric
Gui, Add, Checkbox, xp+0 yp+18 vMoodReactive, reactive

;---------- No.5 ---
Gui, Add, Groupbox, X5 yp+25 r1, Affect:
Gui, Add, Radio, xp+5 yp+20 vAffectAppropriate, Appropriate
Gui, Add, Radio, xp+100 yp+0 vAffectInappropriate, Inappropriate
Gui, Add, Radio, xp+100 yp+0 vAffectLabile, Labile

;---------- No.6 ---
Gui, Add, Groupbox, X5 yp+25 r1, Halluciantion:
Gui, Add, Checkbox, xp+5 yp+20 vHallucinationAuditory, Auditory
Gui, Add, Checkbox, xp+100 yp+0 vHallucinationVisual, Visual

;---------- No.7 ---
Gui, Add, Groupbox, X5 yp+25 r3, Thought Process:
Gui, Add, Checkbox, xp+5 yp+20 vThoughtProcessLoosening, loosening
Gui, Add, Checkbox, vThoughtProcessIncoherence, incoherence
Gui, Add, Checkbox, vThoughtProcessRetardation, retardation
Gui, Add, Checkbox, xp+100 yp-35 vThoughtProcessBlocking, blocking
Gui, Add, Checkbox, xp+0 yp+18 vThoughtProcessPerserveration, perserveration
Gui, Add, Checkbox, xp+0 yp+18 vThoughtProcessIrrelevantAnswer, irrevant answer
Gui, Add, Radio, xp+120 yp-35 vThoughtProcessCirsumstantiality, circumstantiality
Gui, Add, Radio, xp+0 yp+18 vThoughtProcessTangentiality, tangentiality
Gui, Add, Checkbox, xp+0 yp+18 vThoughtProcessFlightOfIdeas, flight of ideas

;---------- No.8 ---
Gui, Add, Groupbox, X5 yp+25 r2, Delusion:
Gui, Add, Checkbox, xp+5 yp+20 vDelusionPersecutory, persecutory
Gui, Add, Checkbox, vDelusionReferance, referance
Gui, Add, Checkbox, xp+100 yp-18 vDelusionBizzare, bizzare
Gui, Add, Checkbox, xp+0 yp+18 vDelusionSomatic, somatic
Gui, Add, Checkbox, xp+100 yp-18 vDelusionControl, control
Gui, Add, Checkbox, xp+0 yp+18 vDelusionNihilistic, nihilistic

;---------- No.9 ---
Gui, Add, Groupbox, X5 yp+25 r1, Suicidal Idea:
Gui, Add, Radio, xp+5 yp+20 vSuicidalIdeaNo, No
Gui, Add, Radio, xp+100 yp+0 vSuicidalIdeaSuspected, Suspected
Gui, Add, Radio, xp+100 yp+0 vSuicidalIdeaStrong, Strong

;---------- No.10 ---
Gui, Add, Groupbox, X5 yp+25 r1, Homocidal Idea:
Gui, Add, Radio, xp+5 yp+20 vHomocidalIdeaNo, No
Gui, Add, Radio, xp+100 yp+0 vHomocidalIdeaSuspected, Suspect
Gui, Add, Radio, xp+100 yp+0 vHomocidalIdeaStrong, Strong

;---------- No.11 ---
Gui, Add, Groupbox, X5 yp+25 r1, Impulse:
Gui, Add, Radio, xp+5 yp+20 vImpulseYes, Yes
Gui, Add, Radio, xp+100 yp+0 vImpulseNo, No

;---------- No.12 ---
Gui, Add, Groupbox, X5 yp+25 r1, Insight:
Gui, Add, Radio, xp+5 yp+20 vInsightIntact, Intact
Gui, Add, Radio, xp+100 yp+0 vInsightPartial, Partial
Gui, Add, Radio, xp+100 yp+0 vInsightPoor, Poor

Gui, Add, Text
Gui, add, button, default, OK
;----------- End of the Make GUI ------------------------

;----------- Show GUI & Get status ----------------------
Gui, show,, Mental Status Examination
return
GuiClose:
ButtonOK:
Gui, submit

;---------- Dicision routine ---------------------------
;---------- No.1 ---
IfEqual, GoodLooking, 1
GeneralAppearance := "General Appearance: Good-looking"
else IfEqual, PoorLooking, 1 ; if there is no "else", then always execute the last else.
GeneralAppearance := "General Appearance: Poor-looking"
else IfEqual, Improving, 1
GeneralAppearance := "General Appearance: Improving State"
else GeneralAppearance := "General Appearance: "

;---------- No.2 ---
IfEqual, VerbalIncreased, 1
VerbalProductivity := "Verbal Productivity: Increased"
else IfEqual, VerbalDecreased, 1
VerbalProductivity := "Verbal Productivity: Decreased"
else IfEqual, VerbalNormal, 1
VerbalProductivity := "Verbal Productivity: Normal"
else VerbalProductivity := "Verbal Productivity: "

;---------- No.3 ---
IfEqual, PsychomotorIncreased, 1
PsychomotorActivity := "Psychomotor Activity: Increased"
else IfEqual, PsychomotorDecreased, 1
PsychomotorActivity := "Psychomotor Activity: Decreased"
else IfEqual, PsychomotorNormoactive, 1
PsychomotorActivity := "Psychomotor Activity: Normoactive"
else PsychomotorActivity := "Psychomotor Activity: "

;---------- No.4 ---
IfEqual, MoodEuphoric, 1
{
component := "euphoric"
myLinker(component)
preMood := preMood . myReturningComponent
VarSetCapacity(component,0) ; VarSetCapacity(variable,0) to clear variables
VarSetCapacity(myReturningComponent,0)
}
IfEqual, MoodDysphoric, 1
{
If preMood =
sleep, 0 ; dummy code
else myLinker(", ")
component := "dysphoric"
myLinker(component)
preMood := preMood . myReturningComponent
VarSetCapacity(component,0)
VarSetCapacity(myReturningComponent,0)
}
IfEqual, MoodEuthymic, 1
{
If preMood =
sleep, 0
else myLinker(", ")
component := "euthymic"
myLinker(component)
preMood := preMood . myReturningComponent
VarSetCapacity(component,0)
VarSetCapacity(myReturningComponent,0)
}

IfEqual, MoodDepressive, 1
{
If preMood =
sleep, 0
else myLinker(", ")
component := "depressive"
myLinker(component)
preMood := preMood . myReturningComponent
VarSetCapacity(component,0)
VarSetCapacity(myReturningComponent,0)
}

IfEqual, MoodAnxious, 1
{
If preMood =
sleep, 0
else myLinker(", ")
component := "anxious"
myLinker(component)
preMood := preMood . myReturningComponent
VarSetCapacity(component,0)
VarSetCapacity(myReturningComponent,0)
}

IfEqual, MoodReactive, 1
{
If preMood =
sleep, 0
else myLinker(", ")
component := "reactive"
myLinker(component)
preMood := preMood . myReturningComponent
VarSetCapacity(component,0)
VarSetCapacity(myReturningComponent,0)
}
Mood := "Mood: " . preMood
VarSetCapacity(preMood,0)
;---------- No.5 ---
IfEqual, AffectAppropriate, 1
Affect := "Affect: Appropriate"
else IfEqual, AffectInappropriate, 1
Affect := "Affect: Inappropriate"
else IfEqual, AffectLabile, 1
Affect := "Affect: Labile"
else Affect := "Affect: "

;---------- No.6 ---
IfEqual, HallucinationAuditory, 1
{
component := "auditory"
myLinker(component)
preHallucination := preHallucination . myReturningComponent
VarSetCapacity(component,0)
VarSetCapacity(myReturningComponent,0)
}
IfEqual, HallucinationVisual, 1
{
If preHallucination =
sleep, 0
else myLinker(", ")
component := "visual"
myLinker(component)
preHallucination := preHallucination . myReturningComponent
VarSetCapacity(component,0)
VarSetCapacity(myReturningComponent,0)
}

If preHallucination =
Hallucination := "Halluciantion: denied by pt."
else Hallucination := "Halluciantion: " . preHallucination
VarSetCapacity(preHallucination,0)

;---------- No.7 ---
IfEqual, ThoughtProcessLoosening, 1
{
component := "loosening"
myLinker(component)
preThoughtProcess := preThoughtProcess . myReturningComponent
VarSetCapacity(component,0)
VarSetCapacity(myReturningComponent,0)
}

IfEqual, ThoughtProcessIncoherence, 1
{
If preThoughtProcess =
sleep, 0
else myLinker(", ")
component := "incoherence"
myLinker(component)
preThoughtProcess := preThoughtProcess . myReturningComponent
VarSetCapacity(component,0)
VarSetCapacity(myReturningComponent,0)
}
IfEqual, ThoughtProcessRetardation, 1
{
If preThoughtProcess =
sleep, 0
else myLinker(", ")
component := "retardation"
myLinker(component)
preThoughtProcess := preThoughtProcess . myReturningComponent
VarSetCapacity(component,0)
VarSetCapacity(myReturningComponent,0)
}
IfEqual, ThoughtProcessBlocking, 1
{
If preThoughtProcess =
sleep, 0
else myLinker(", ")
component := "blocking"
myLinker(component)
preThoughtProcess := preThoughtProcess . myReturningComponent
VarSetCapacity(component,0)
VarSetCapacity(myReturningComponent,0)
}
IfEqual, ThoughtProcessPerserveration, 1
{
If preThoughtProcess =
sleep, 0
else myLinker(", ")
component := "perserveration"
myLinker(component)
preThoughtProcess := preThoughtProcess . myReturningComponent
VarSetCapacity(component,0)
VarSetCapacity(myReturningComponent,0)
}

IfEqual, ThoughtProcessIrrelevantAnswer, 1
{
If preThoughtProcess =
sleep, 0
else myLinker(", ")
component := "irrevant answer"
myLinker(component)
preThoughtProcess := preThoughtProcess . myReturningComponent
VarSetCapacity(component,0)
VarSetCapacity(myReturningComponent,0)
}
IfEqual, ThoughtProcessCirsumstantiality, 1
{
If preThoughtProcess =
sleep, 0
else myLinker(", ")
component := "circumstantiality"
myLinker(component)
preThoughtProcess := preThoughtProcess . myReturningComponent
VarSetCapacity(component,0)
VarSetCapacity(myReturningComponent,0)
}

IfEqual, ThoughtProcessTangentiality, 1
{
If preThoughtProcess =
sleep, 0
else myLinker(", ")
component := "tangentiality"
myLinker(component)
preThoughtProcess := preThoughtProcess . myReturningComponent
VarSetCapacity(component,0)
VarSetCapacity(myReturningComponent,0)
}
IfEqual, ThoughtProcessFlightOfIdeas, 1
{
If preThoughtProcess =
sleep, 0
else myLinker(", ")
component := "flight of ideas"
myLinker(component)
preThoughtProcess := preThoughtProcess . myReturningComponent
VarSetCapacity(component,0)
VarSetCapacity(myReturningComponent,0)
}

If preThoughtProcess =
ThoughtProcess := "Thought Process: within normal limit"
else ThoughtProcess := "Thought Process: " . preThoughtProcess
VarSetCapacity(preThoughtProcess,0)

;---------- No.8 ---
IfEqual, DelusionPersecutory, 1
{
component := "persecutory"
myLinker(component)
preDelusion := preDelusion . myReturningComponent
VarSetCapacity(component,0)
VarSetCapacity(myReturningComponent,0)
}
IfEqual, DelusionReferance, 1
{
If preDelusion =
sleep, 0
else myLinker(", ")
component := "referance"
myLinker(component)
preDelusion := preDelusion . myReturningComponent
VarSetCapacity(component,0)
VarSetCapacity(myReturningComponent,0)
}
IfEqual, DelusionBizzare, 1
{
If preDelusion =
sleep, 0
else myLinker(", ")
component := "dysphoric"
myLinker(component)
preDelusion := preDelusion . myReturningComponent
VarSetCapacity(component,0)
VarSetCapacity(myReturningComponent,0)
}

IfEqual, DelusionSomatic, 1
{
If preDelusion =
sleep, 0
else myLinker(", ")
component := "somatic"
myLinker(component)
preDelusion := preDelusion . myReturningComponent
VarSetCapacity(component,0)
VarSetCapacity(myReturningComponent,0)
}

IfEqual, DelusionControl, 1
{
If preDelusion =
sleep, 0
else myLinker(", ")
component := "control"
myLinker(component)
preDelusion := preDelusion . myReturningComponent
VarSetCapacity(component,0)
VarSetCapacity(myReturningComponent,0)
}

IfEqual, DelusionNihilistic, 1
{
If preDelusion =
sleep, 0
else myLinker(", ")
component := "nihilistic"
myLinker(component)
preDelusion := preDelusion . myReturningComponent
VarSetCapacity(component,0)
VarSetCapacity(myReturningComponent,0)
}
If preDelusion =
Delusion := "Delusion: no active delusion."
else Delusion := "Delusion: " . preDelusion
VarSetCapacity(preDelusion,0)

;---------- No.9 ---
IfEqual, SuicidalIdeaNo, 1
SuicidalIdea := "Suicidal Idea: No"
else IfEqual, SuicidalIdeaSuspected, 1
SuicidalIdea := "Suicidal Idea: Suspected"
else IfEqual, SuicidalIdeaStrong, 1
SuicidalIdea := "Suicidal Idea: Strong"
else SuicidalIdea := "Suicidal Idea: "

;---------- No.10 ---
IfEqual, HomocidalIdeaNo, 1
HomicidalIdea := "Homicidal Idea: No"
else IfEqual, HomocidalIdeaSuspected, 1
HomicidalIdea := "Homicidal Idea: suspect"
else IfEqual, HomocidalIdeaStrong, 1
HomicidalIdea := "Homicidal Idea: Strong"
else HomicidalIdea := "Homicidal Idea: "
;---------- No.11 ---
IfEqual, ImpulseYes, 1
Impulse := "Impulse: Yes"
else IfEqual, ImpulseNo, 1
Impulse := "Impulse: No"
else Impulse := "Impulse: "

;---------- No.12 ---
IfEqual, InsightIntact, 1
Insight := "Insight: Intact"
else IfEqual, InsightPartial, 1
Insight := "Insight: Partial"
else IfEqual, InsightPoor, 1
Insight := "Insight: Poor"
else Insight := "Insight: "
;---------- End of Decision routine ---------------

;---------- myLinker function: make a sentence ----
myLinker(component){
global myReturningComponent
myReturningComponent := myReturningComponent . component
return myReturningComponent
}

;---------- Wright into the ClipBoard -------------
clipboard = %GeneralAppearance%`r`n%VerbalProductivity%`r`n%PsychomotorActivity%`r`n%Mood%`r`n%Affect%`r`n%Hallucination%`r`n%ThoughtProcess%`r`n%Delusion%`r`n%SuicidalIdea%`r`n%HomicidalIdea%`r`n%Impulse%`r`n%Insight%`r`n`r`n

;---------- Clear variables -----------------------
VarSetCapacity(GeneralAppearance,0)
VarSetCapacity(VerbalProductivity,0)
VarSetCapacity(PsychomotorActivity,0)
VarSetCapacity(Mood,0)
VarSetCapacity(Affect,0)
VarSetCapacity(Hallucination,0)
VarSetCapacity(ThoughtProcess,0)
VarSetCapacity(SuicidalIdea,0)
VarSetCapacity(HomicidalIdea,0)
VarSetCapacity(Impulse,0)
VarSetCapacity(Insight,0)

;---------- Paste to Note from ClipBoard -----------
;send {f2}
;sleep 100
Run C:\WINDOWS\system32\notepad.exe ; RIDE OFF
WinWait, Untitled - Notepad, , 2 ; RIDE OFF
Send, ^v ; Paste clipboard contents
ClipWait ; Wait for ClipBoard working

;---------- Pop the clipboard ------------------
clipboard := clipSaved
clipSaved =

;---------- Exit the Script --------------------
Gui, Destroy
return




유사배열을 사용할 수 있으면 더 짧은 스크립트 작성이 가능할 것으로 보임.
아직은 공부 부족.



No comments: