AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

BlueFire PowerUser AddOns

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
Tom.j.McCurdy



Joined: 11 Jun 2008
Posts: 12

PostPosted: Tue Jun 17, 2008 5:24 pm    Post subject: BlueFire PowerUser AddOns Reply with quote

Here is my code
Exclamation Embarassed
Code:


#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.


;BlueFire PowerUser Add Ons
;Created by Tom McCurdy (tmccurdy@umich.edu)

;--------------------------------------
;Create GUI
;--------------------------------------
Top:
Gui, Add, Tab2, w431 h350, Home|Auto C/E|Auto Choices|Auto Insert|Auto Enum
Gui, +Wrap +Resize +AlwaysOnTop +BackgroundTrans
Gui, +Center
Gui, Tab, 1

Gui, show, w450
Gui, Tab, 1 ;Home
Select:=1
gui, Add, Text, section w400 center, Welcome to the BlueFire Powertool `n ______~~--==''''_''''==--~~______ `n \__ Created by: Tom McCurdy __/
gui, add, text,,
Gui, Add, Checkbox, section Checked gSwitch vSelect, Window Locked on Top?
gui, Add, Text, vSelectText, Window Locked on Top
gui, add, text,, --Launch Programs--
gui, add, button, default, Calculator
gui, add, text, +right ys,  ; Start a new column within this section.
gui, add, text, +right, Copy `nPaste `n"Coding BCD" `n"Coding HEX"
gui, add, text, ys, ShortCuts
gui, add, text,, - F5 `n- F6 `n- F7 + B `n- F7 + H

gui, show

Gui, Tab, 2 ; Auto C/E
Gui, Add, Text, w300 +wrap, ||==Automatic Command/Event Inserting->
Gui, Add, Text, section, Adjust
Gui, Add, Edit, w120 Number ys vAdjust, 30
Gui, Add, Button, gLoadCE, Load/Refresh
Gui, Add, Button, default gSelectFileCE, Select Path
Gui, Add, Text, w400 vSelectedFile,No File Selected
Gui, Add, text,  w300 +wrap, You MUST have the sidebar to the top when you start `nStep1: Select the file `nStep2: Windows + A at the parent `nStep3: Alt + Ctrl + A the blue tab on top of the screen that includes your file name (example.ride) `nStep4: Hover over parent again and do Windows + s to start the process `nDon't do anything while it is inserting `n`nPRESS ESC AT ANYTIME TO STOP
Gui, Add, Button, gCEHelp, Help

Gui, Tab, 3
Gui, Add, Text, w300 +wrap, ||==Automatic Choice Inserting->
Gui, Add, Text, section, Adjust
Gui, Add, Edit, w120 Number ys vAdjust3, 30
Gui, Add, Text,, Enum Start
Gui, Add, Edit, w120 Number vEnum
Gui, Add, Button, gLoadChoices, Load/Refresh
Gui, Add, Button, default gSelectFileChoices, Select Path
Gui, Add, Text, w400 vSelectedFileChoices,No File Selected
Gui, Add, text,  w300 +wrap, You MUST have the sidebar to the top when you start `nStep1: Select the file `nStep2: Windows + Q at the parent `nStep3: Alt + Ctrl + Q the blue tab on top of the screen that includes your file name (example.ride) `nStep4: Hover over parent again and do Windows + W to start the process `nDon't do anything while it is inserting `n`nPRESS ESC AT ANYTIME TO STOP


Gui, Tab, 4
Gui, Add, Text, w300 +wrap, ||==Automatic Inserting Items->
Gui, Add, Text, w300 +wrap, Step1: Copy an item of whatever you would like to insert `n(via ctrl c or menu)`nStep2: Then hover over element you would like to insert over and `npress Ctrl + J
Gui, Add, Text, section, Insert Number of Something
Gui, Add, Button, default gInsertHelp, Help
Gui, Add, Edit, ys vItems



Gui, Tab, 5
Gui, Add, Text, w300 +wrap, ||==Automatic Enumeration-> `n
Gui, Add, Text,section, Base Text
Gui, Add, Text,, Start Value
Gui, Add, Text,, End Value
Gui, Add, Text,, End Text
Gui, Add, Text,, Enum Start
Gui, Add, Edit, vAEText ys
Gui, Add, Edit, Number vAEStart,
Gui, Add, Edit, Number vAEEnd,
Gui, Add, Edit, vAEEndT,
Gui, Add, Edit, Number vAEEnum
Gui, Add, Button, default gEnumHelp, Help


Gui, Show
return

;--------------------------------------
;Auto Enumberations
;--------------------------------------
EnumHelp:
Gui, -AlwaysOnTop
MsgBox Summary `n Please click in start cell then run a shortcut `n Names will go from %Text%%Start% to %TextEnd% `n The Enum will start with %Enum% and increment `n Windows + w will run through names only `n Windows + e will run through enums only `n Windows + b will do both
Gui, +AlwaysOnTop
return

#l::
Gui, Submit
Clipboard= ; empty the Clipboard
Start-- ; first loop skips start value so substract one
SetFormat, Float, 02.0 ; for leading zeros
LoopIt:=AEEnd - AEStart
Loop, %LoopIt%
   {
   Add := AEStart + A_Index
   Clipboard=%AEText%%Add%%AEEndT%
   Send,{CtrlDown}v{CtrlUp}
   sleep, 700
   Send,{Tab}
   sleep, 600
   }
Gui, Show 
Return

#e::
Gui, Submit
Clipboard= ; empty the Clipboard
Start-- ; first loop skips start value so substract one
SetFormat, Float, 02.0 ; for leading zeros
LoopIt:=AEEnd - AEStart
Loop, %LoopIt%
   {
   Add := AEEnum + A_Index -1
   Clipboard=%Add%
   Send,{CtrlDown}v{CtrlUp}
   sleep, 700
   Send, {Tab}
   sleep, 600
   }
Gui, Show 
Return

#b::
Gui, Submit
Clipboard= ; empty the Clipboard
Start-- ; first loop skips start value so substract one
SetFormat, Float, 02.0 ; for leading zeros
LoopIt:=AEEnd - AEStart
Loop, %LoopIt%
   {
   Add := Start + A_Index + 0.0 ; this makes it add a leading zero If a_index is below 10
   Clipboard=%AEText%%Add%%AEEndT%
   Send,{CtrlDown}v{CtrlUp}{Enter}{Down}{Down}{Down}{Down}{Enter}
   sleep, 1200
   Add := AEEnum + A_Index - 1
   Clipboard=%Add%
   Send,{CtrlDown}v{CtrlUp}{Enter}{Up}{Up}{Up}{Up}{Right}{Enter}
   sleep, 1200
   }
Gui, Show 
Return

insertHelp:
Gui, -AlwaysOnTop
msgBox Copy an item of whatever you would like to insert (via ctrl c or menu)`n Then hover over element you would like to insert over and press Ctrl + J
Gui, +AlwaysOnTop
return

^j::
Gui, Submit
Gui, show
MouseGetPos, xposInsert, yposInsert
MouseMove, xposInsert, yposInsert , 0
BlockInput, MouseMove
Loop, %Items%
{
Click right xpos, ypos
sleep, 400
Send, p
sleep, 400
}
BlockInput, MouseMoveOff
return









;--------------------------------------
;File Open/Load Tab2 Autochoices
;--------------------------------------


SelectFileChoices:
Gui, -AlwaysOnTop
FileSelectFile, SelectedFileChoices, 3, , Open a file, Text Documents (*.txt; *.csv; *xls;)
GuiControl,,SelectedFileChoices,%SelectedFileChoices%
Gui, +AlwaysOnTop
Goto,LoadChoices
return

LoadChoices:
ArrayCount = 0
Loop, Read, %SelectedFileChoices%
{
   ArrayCount += 1  ; Keep track of how many items are in the array.
   Array%ArrayCount% := A_LoopReadLine  ; Store this line in the next array element
}
return




;--------------------------------------
; Windows On Top
;--------------------------------------
Switch:
if Select=0
{
Gui, +AlwaysOnTop
Select:=0
GuiControl,, SelectText, Window Locked on Top
Gui, show
return
}
else
{
Gui, -AlwaysOnTop
Select:=1
GuiControl,, SelectText, Normal Operation
Gui, show
}
return

;--------------------------------------
;File Open/Load Tab2 Auto Command/Events
;--------------------------------------


CEHelp:
Gui, -AlwaysOnTop
Gui, Show
msgbox Automatic Command/Event Insert `n `n Adjust is a safety factor build in to the program. It is best to leave at default of 30. `n ReadFile: This will read from the default file location. The format of the file must be: `n Enumeration,Name,Type `n The type should be either cmd or fb but other conatatons are accepted.`n`n`n
Gui, +AlwaysOnTop
Gui, Show
return

SelectFileCE:
Gui, -AlwaysOnTop
FileSelectFile, SelectedFile, 3, , Open a file, Text Documents (*.txt; *.csv; *xls;)
GuiControl,,SelectedFile,%SelectedFile%
Gui, +AlwaysOnTop
Goto,LoadCE
return

LoadCE:
ArrayCount = 0
Loop, Read, %SelectedFile%
{
   ArrayCount += 1  ; Keep track of how many items are in the array.
   loop, parse, A_LoopReadLine, `,
   {
      if (A_index=1)
      {
      ArrayEnum%ArrayCount% := A_LoopField
      }
      if (A_index=2)
      {
      Array%ArrayCount% := A_LoopField  ; Store this line in the next array element.
      ;msgBox %A_LoopField%
      }
      if (A_index=3)
      {
      ArrayType%ArrayCount% := A_LoopField
      ;msgBox %A_LoopField%
      }
   }
   
}
return
;--------------------------------------
;Auto Choices HotKeys
;--------------------------------------
#q::
MouseGetPos, xposC, yposC
return
^!q::
MouseGetPos, xpos2C, ypos2C
return
#w::
Gui, Submit
Gui, Show
WinWait, Bluefire <Spark>,
IfWinNotActive, Bluefire <Spark>, , WinActivate, Bluefire <Spark>,
WinWaitActive, Bluefire <Spark>,
MouseMove, xposC, yposC , 0
BlockInput, MouseMove
loop %ArrayCount%
{

Click right xposC, yposC
sleep, 500
send, i
sleep, 500
send, {right}
sleep, 500
send, c

element := Array%A_Index%  ; A_Index is a built-in variable.
clipboard = %element%
sleep, 500
send,{ctrl down}v{ctrl up}
sleep, 800
send, {enter}{down}{down}{down}{down}{enter}
sleep, 300
Add :=Enum+A_Index -1
   Clipboard=%Add%
   Send,{CtrlDown}v{CtrlUp}
   sleep, 1000
Click left xpos2C, ypos2C
Rewind:= A_Index + Adjust
Loop %Rewind%
{
send, {up}
}
}
BlockInput, MouseMoveOff
MsgBox Done
return


;--------------------------------------
;Auto CE HotKeys
;--------------------------------------

esc::
GuiClose:
GuiEscape:
ExitApp

#a::
MouseGetPos, xposCE, yposCE
return
^!a::
MouseGetPos, xpos2CE, ypos2CE
return
#s::
Gui, Submit
Gui, Show

WinWait, Bluefire <Spark>,
IfWinNotActive, Bluefire <Spark>, , WinActivate, Bluefire <Spark>,
WinWaitActive, Bluefire <Spark>,
MouseMove, xposCE, yposCE , 2
BlockInput, MouseMove
loop %ArrayCount%
{



Click right xposCE, yposCE
sleep, 500
send, i
sleep, 500

type:=ArrayType%A_Index%

if (type=="Cmd" or type=="C" or type=="cmd" or type=="c" or type=="Command" or type=="command" or type=="")
{
   send, {down}{enter}
   sleep, 300
}
if (type=="Fb" or type=="F" or type=="fb" or type=="feedback" or type=="Feedback")
{
   ;msgbox feedback
   send, {down}{down}{enter}
   sleep, 300
   
}


element := Array%A_Index%  ; A_Index is a built-in variable.
clipboard = %element%
send,{ctrl down}v{ctrl up}
sleep, 1000
send, {enter}{down}{down}{down}{down}{enter}
sleep, 300
Add := ArrayEnum%A_Index%
   Clipboard=%Add%
   Send,{CtrlDown}v{CtrlUp}
   sleep, 1000
Click left xpos2CE, ypos2CE
Rewind:= A_Index + Adjust
Loop %Rewind%
{
send, {up}
}
}
BlockInput, MouseMoveOff
MsgBox Done
return


;--------------------------------------
;Define Shortcuts
;--------------------------------------
f5::^c
f6::^v
#n::
IfWinExist Untitled - Notepad
   WinActivate
else
   Run Notepad
return

#home::
IfWinExist notepad++
   WinActivate
else
   Run notepad++
return

#c::
buttonCalculator:
IfWinExist Calculator
   WinActivate
else
   Run calc
return

#x::
IfWinExist Microsoft Excel
   WinActivate
else
   Run excel   
return
   
!w::
IfWinExist Microsoft Word
   WinActivate
else
   Run winword
return

F7 & B::
Send, {Enter}Coding: BCD
return

F7 & H::
Send {Enter}Coding: HEX
return






Thanks a lot

[Title edited. Please write descriptive titles for your topics. ~jaco0646]
Back to top
View user's profile Send private message AIM Address
engunneer



Joined: 30 Aug 2005
Posts: 6847
Location: Pacific Northwest, US

PostPosted: Tue Jun 17, 2008 5:42 pm    Post subject: Reply with quote

if it works, then it doesn't need improving. Unless you have a specific section you want improved, you may have to wait a while for a good response. It will take me some time to read all that code and understand what you are trying to do.
_________________
Unless otherwise noted, all code is untested.
Common Answers: 1.(Loops, Viruses, etc.) 2. Search 3.RTFM
Back to top
View user's profile Send private message Visit poster's website
Tom.j.McCurdy



Joined: 11 Jun 2008
Posts: 12

PostPosted: Tue Jun 17, 2008 7:00 pm    Post subject: Reply with quote

The Main Areas I would like to improve
[list=]
Dynamic Abilities
Structure
[/list]

Dynamic Abilities:
I would like to learn how to allow for dynamic things. An example would be the Checkbox for Window locked on Top. I want a simple checkbox that is checked when the GUI is +AlwaysOnTop and not checked when it is -AlwaysOnTop. I want to be able to change that value by checking and unchecking it based on the checkbox variable.

I would like to add something that constantly shows the current mouse position.

I would like to have an esc key that would break from whatever is going on and just "return"

...
etc

Structure

My Code is a Mess. How would you suggest going about structuring a program like this. I know there is something like functions available but I have never used them.

How do you make something bold/italic etc

how do you add a background image
Back to top
View user's profile Send private message AIM Address
PurloinedHeart



Joined: 04 Apr 2008
Posts: 209
Location: Canada

PostPosted: Tue Jun 17, 2008 8:29 pm    Post subject: Reply with quote

Bold / Italic
For the mouse position, you could use a Loop or SetTimer
For background images, look at 'Gui, Add, Picture'
For the CheckBox, I think using "#IfWinActive" along with "GuiControl" might work
Back to top
View user's profile Send private message
Rhys



Joined: 17 Apr 2007
Posts: 736
Location: Florida

PostPosted: Wed Jun 18, 2008 8:05 pm    Post subject: Reply with quote

I added a expand/contract button to demonstrate proof of concept for you:
Code:
;BlueFire PowerUser Add Ons
;Created by Tom McCurdy (tmccurdy@umich.edu)

;--------------------------------------
;Create GUI
;--------------------------------------

Top:
CurrentFileName= "Untitled"
Gui, Add, Tab2, w481 h385, Home|Auto C/E|Auto Choices|Auto Insert|Auto Enum
Gui, +Wrap +Resize +AlwaysOnTop +BackgroundTrans
Gui, +Center
base:= 500
Gui, Tab
Menu, FileMenu, Add, &New, FileNew
Menu, FileMenu, Add, &Open, FileOpen
Menu, FileMenu, Add, &Save, FileSave
Menu, FileMenu, Add, Save &As, FileSaveAs
Menu, Movement, Add, Expand, expandWin
Menu, Movement, Add, &Collapse, minWin

Menu, MyMenuBar, Add, &Text-Editor-Menu, :FileMenu
Menu, MyMenuBar, Add, Expand/Collapse, :Movement

Gui, Menu, MyMenuBar
gui,add,button,w12 h385 vExpandCollapse gExpandCollapse ym x+0 -Theme -TabStop,>
gui, add, text, w400 vFileName ym, Basic Text Editor (Supports Drag/Drop of Files)`nCurrent File: %CurrentFileName%
gui, add, edit, WantTab W300 R20 vMainEdit
Expanded:=False

Gui, Tab, 1
Gui, show, w500
Gui, Tab, 1 ;Home
Select:=1
gui, Add, Text, section w400 center, Welcome to the BlueFire Powertool `n ______~~--==''''_''''==--~~______ `n \__ Created by: Tom McCurdy __/
gui, add, text,,
Gui, Add, Checkbox, section Checked gSwitch vSelect, Window Locked on Top?
gui, Add, Text, vSelectText, Window Locked on Top
gui, add, text,, --Launch Programs--
gui, add, button, default, Calculator
Gui, Add, Button, gexpandWin, Expand Text Editor
Gui, Add, Button, gminWin, Close Text Editor
gui, add, text, +right ys,  ; Start a new column within this section.
gui, add, text, +right, Copy `nPaste `n"Coding BCD" `n"Coding HEX"
gui, add, text, ys, ShortCuts
gui, add, text,, - F5 `n- F6 `n- F7 + B `n- F7 + H


gui, show

Gui, Tab, 2 ; Auto C/E
Gui, Add, Text, w300 +wrap, ||==Automatic Command/Event Inserting->
Gui, Add, Text, section, Adjust
Gui, Add, Edit, w120 Number ys vAdjust, 30
Gui, Add, Button, gLoadCE, Load/Refresh
Gui, Add, Button, default gSelectFileCE, Select Path
Gui, Add, Text, w400 vSelectedFile,No File Selected
Gui, Add, text,  w300 +wrap, You MUST have the sidebar to the top when you start `nStep1: Select the file `nStep2: Windows + A at the parent `nStep3: Alt + Ctrl + A the blue tab on top of the screen that includes your file name (example.ride) `nStep4: Hover over parent again and do Windows + s to start the process `nDon't do anything while it is inserting `n`nPRESS ESC AT ANYTIME TO STOP
Gui, Add, Button, gCEHelp, Help

Gui, Tab, 3
Gui, Add, Text, w300 +wrap, ||==Automatic Choice Inserting->
Gui, Add, Text, section, Adjust
Gui, Add, Edit, w120 Number ys vAdjust3, 30
Gui, Add, Text,, Enum Start
Gui, Add, Edit, w120 Number vEnum
Gui, Add, Button, gLoadChoices, Load/Refresh
Gui, Add, Button, default gSelectFileChoices, Select Path
Gui, Add, Text, w400 vSelectedFileChoices,No File Selected
Gui, Add, text,  w300 +wrap, You MUST have the sidebar to the top when you start `nStep1: Select the file `nStep2: Windows + Q at the parent `nStep3: Alt + Ctrl + Q the blue tab on top of the screen that includes your file name (example.ride) `nStep4: Hover over parent again and do Windows + W to start the process `nDon't do anything while it is inserting `n`nPRESS ESC AT ANYTIME TO STOP


Gui, Tab, 4
Gui, Add, Text, w300 +wrap, ||==Automatic Inserting Items->
Gui, Add, Text, w300 +wrap, Step1: Copy an item of whatever you would like to insert `n(via ctrl c or menu)`nStep2: Then hover over element you would like to insert over and `npress Ctrl + J
Gui, Add, Text, section, Insert Number of Something
Gui, Add, Button, default gInsertHelp, Help
Gui, Add, Edit, ys vItems



Gui, Tab, 5
Gui, Add, Text, w300 +wrap, ||==Automatic Enumeration-> `n
Gui, Add, Text,section, Base Text
Gui, Add, Text,, Start Value
Gui, Add, Text,, End Value
Gui, Add, Text,, End Text
Gui, Add, Text,, Enum Start
Gui, Add, Edit, vAEText ys
Gui, Add, Edit, Number vAEStart,
Gui, Add, Edit, Number vAEEnd,
Gui, Add, Edit, vAEEndT,
Gui, Add, Edit, Number vAEEnum
Gui, Add, Button, default gEnumHelp, Help



Gui, Show
return

;--------------------------------------
;Auto Enumberations
;--------------------------------------
EnumHelp:
Gui, -AlwaysOnTop
MsgBox Summary `n Please click in start cell then run a shortcut `n Names will go from %Text%%Start% to %TextEnd% `n The Enum will start with %Enum% and increment `n Windows + L will run through names only `n Windows + U will run through enums only `n Windows + B will do both
Gui, +AlwaysOnTop
return

#l::
Add:=0
Gui, Submit
Clipboard= ; empty the Clipboard
AEStart-- ; first loop skips start value so substract one
SetFormat, Float, 02.0 ; for leading zeros
LoopIt:=AEEnd - AEStart
Progress, b w200, In Progress, Auto Enum Inserting, BlueFire
BlockInput, MouseMove
Loop, %LoopIt%
   {
   Progress, % Floor(A_Index / LoopIt * 100) ;%
   Add := AEStart + A_Index
   Clipboard=%AEText%%Add%%AEEndT%
   Send,{CtrlDown}v{CtrlUp}
   sleep, 700
   Send,{Tab}
   sleep, 600
   }
   Progress, Off
BlockInput, MouseMoveOff
Gui, Show 
Return

#u::
Add:=0
Gui, Submit
Clipboard= ; empty the Clipboard
AEStart-- ; first loop skips start value so substract one
SetFormat, Float, 02.0 ; for leading zeros
LoopIt:=AEEnd - AEStart
Progress, b w200, In Progress, Auto Enum Inserting, BlueFire
BlockInput, MouseMove
Loop, %LoopIt%
   {
   Progress, % Floor(A_Index / LoopIt * 100) ;%
   Add := AEEnum + A_Index -1
   Clipboard=%Add%
   Send,{CtrlDown}v{CtrlUp}
   sleep, 700
   Send, {Tab}
   sleep, 600
   }
   Progress, Off
BlockInput, MouseMoveOff
Gui, Show 
Return

#b::
Add:=0
Gui, Submit
Clipboard= ; empty the Clipboard
AEStart-- ; first loop skips start value so substract one
SetFormat, Float, 02.0 ; for leading zeros
LoopIt:=AEEnd - AEStart
Progress, b w200, In Progress, Auto Enum Inserting, BlueFire
BlockInput, MouseMove
Loop, %LoopIt%
   {
   Progress, % Floor(A_Index / LoopIt * 100) ;%
   Add := AEStart + A_Index + 0.0 ; this makes it add a leading zero If a_index is below 10
   Clipboard=%AEText%%Add%%AEEndT%
   Send,{CtrlDown}v{CtrlUp}{Enter}{Down}{Down}{Down}{Down}{Enter}
   sleep, 1200
   Add := AEEnum + A_Index - 1
   Clipboard=%Add%
   Send,{CtrlDown}v{CtrlUp}{Enter}{Up}{Up}{Up}{Up}{Right}{Enter}
   sleep, 1200
   }
Progress, Off
BlockInput, MouseMoveOff
Gui, Show 
Return

insertHelp:
Gui, -AlwaysOnTop
msgBox Copy an item of whatever you would like to insert (via ctrl c or menu)`n Then hover over element you would like to insert over and press Ctrl + J
Gui, +AlwaysOnTop
return

^j::
Gui, Submit
Gui, show
MouseGetPos, xposInsert, yposInsert
MouseMove, xposInsert, yposInsert , 0
BlockInput, MouseMove
Progress, b w200, In Progress, Auto Inserting Items, BlueFire
Loop, %Items%
{
 
Progress, % Floor(A_Index / Items * 100) ;%
Click right xpos, ypos
sleep, 400
Send, p
sleep, 400
}
Progress, Off
BlockInput, MouseMoveOff
return









;--------------------------------------
;File Open/Load Tab2 Autochoices
;--------------------------------------


SelectFileChoices:
Gui, -AlwaysOnTop
FileSelectFile, SelectedFileChoices, 3, , Open a file, Text Documents (*.txt; *.csv; *xls;)
GuiControl,,SelectedFileChoices,%SelectedFileChoices%
Gui, +AlwaysOnTop
Goto,LoadChoices
return

LoadChoices:
ArrayCount = 0
Loop, Read, %SelectedFileChoices%
{
   ArrayCount += 1  ; Keep track of how many items are in the array.
   Array%ArrayCount% := A_LoopReadLine  ; Store this line in the next array element
}
return




;--------------------------------------
; Windows On Top
;--------------------------------------
Switch:
if Select=0
{
Gui, +AlwaysOnTop
Select:=1
GuiControl,, SelectText, Window Locked on Top
Gui, show
return
}
else
{
Gui, -AlwaysOnTop
Select:=0
GuiControl,, SelectText, Normal Operation
Gui, show
}
return

;--------------------------------------
;File Open/Load Tab2 Auto Command/Events
;--------------------------------------


CEHelp:
Gui, -AlwaysOnTop
Gui, Show
msgbox Automatic Command/Event Insert `n `n Adjust is a safety factor build in to the program. It is best to leave at default of 30. `n ReadFile: This will read from the default file location. The format of the file must be: `n Enumeration,Name,Type `n The type should be either cmd or fb but other conatatons are accepted.`n`n`n
Gui, +AlwaysOnTop
Gui, Show
return

SelectFileCE:
Gui, -AlwaysOnTop
FileSelectFile, SelectedFile, 3, , Open a file, Text Documents (*.txt; *.csv; *xls;)
GuiControl,,SelectedFile,%SelectedFile%
Gui, +AlwaysOnTop
Goto,LoadCE
return

LoadCE:
ArrayCount = 0
Loop, Read, %SelectedFile%
{
   ArrayCount += 1  ; Keep track of how many items are in the array.
   loop, parse, A_LoopReadLine, `,
   {
      if (A_index=1)
      {
      ArrayEnum%ArrayCount% := A_LoopField
      }
      if (A_index=2)
      {
      Array%ArrayCount% := A_LoopField  ; Store this line in the next array element.
      ;msgBox %A_LoopField%
      }
      if (A_index=3)
      {
      ArrayType%ArrayCount% := A_LoopField
      ;msgBox %A_LoopField%
      }
   }
   
}
return
;--------------------------------------
;Auto Choices HotKeys
;--------------------------------------
#q::
MouseGetPos, xposC, yposC
return
^!q::
MouseGetPos, xpos2C, ypos2C
return
#w::
Gui, Submit
Gui, Show
WinWait, Bluefire <Spark>,
IfWinNotActive, Bluefire <Spark>, , WinActivate, Bluefire <Spark>,
WinWaitActive, Bluefire <Spark>,
MouseMove, xposC, yposC , 0
BlockInput, MouseMove
Progress, b w200, In Progress, Auto Choice Inserting,
loop %ArrayCount%
{
   Progress, % Floor(A_Index / ArrayCount * 100) ;%
   Click right xposC, yposC
   sleep, 500
   send, i
   sleep, 500
   send, {right}
   sleep, 500
   send, c
   element := Array%A_Index%  ; A_Index is a built-in variable.
   clipboard = %element%
   sleep, 500
   send,{ctrl down}v{ctrl up}
   sleep, 800
   send, {enter}{down}{down}{down}{down}{enter}
   sleep, 300
   Add :=Enum+A_Index -1
      Clipboard=%Add%
      Send,{CtrlDown}v{CtrlUp}
      sleep, 1000
   Click left xpos2C, ypos2C
   Rewind:= A_Index + Adjust
   Loop %Rewind%
   {
      send, {up}
   }
}
BlockInput, MouseMoveOff
Progress, Off
MsgBox Done
return


;--------------------------------------
;Auto CE HotKeys
;--------------------------------------

esc::
GuiClose:
GuiEscape:
;Reload
ExitApp

#a::
MouseGetPos, xposCE, yposCE
return
^!a::
MouseGetPos, xpos2CE, ypos2CE
return
#s::
Gui, Submit
Gui, Show

WinWait, Bluefire <Spark>,
IfWinNotActive, Bluefire <Spark>, , WinActivate, Bluefire <Spark>,
WinWaitActive, Bluefire <Spark>,
MouseMove, xposCE, yposCE , 2
BlockInput, MouseMove
Progress, b w200, In Progress, Auto Command/Event Inserting,
loop %ArrayCount%
{
   Progress, % Floor(A_Index / ArrayCount * 100) ;%
   Click right xposCE, yposCE
   sleep, 500
   send, i
   sleep, 500

   type:=ArrayType%A_Index%

   if (type=="Cmd" or type=="C" or type=="cmd" or type=="c" or type=="Command" or type=="command" or type=="")
   {
      send, {down}{enter}
      sleep, 300
   }
   if (type=="Fb" or type=="F" or type=="fb" or type=="feedback" or type=="Feedback")
   {
      ;msgbox feedback
      send, {down}{down}{enter}
      sleep, 300
      
   }


   element := Array%A_Index%  ; A_Index is a built-in variable.
   clipboard = %element%
   send,{ctrl down}v{ctrl up}
   sleep, 1000
   send, {enter}{down}{down}{down}{down}{enter}
   sleep, 300
   Add := ArrayEnum%A_Index%
      Clipboard=%Add%
      Send,{CtrlDown}v{CtrlUp}
      sleep, 1000
   Click left xpos2CE, ypos2CE
   Rewind:= A_Index + Adjust
   Loop %Rewind%
   {
      send, {up}
   }
}
Progress, Off
BlockInput, MouseMoveOff
MsgBox Done
return


;--------------------------------------
;Define Shortcuts
;--------------------------------------
f5::^c
f6::^v
#n::
IfWinExist Untitled - Notepad
   WinActivate
else
   Run Notepad
return

#home::
IfWinExist notepad++
   WinActivate
else
   Run notepad++
return

#c::
buttonCalculator:
IfWinExist Calculator
   WinActivate
else
   Run calc
return

#x::
IfWinExist Microsoft Excel
   WinActivate
else
   Run excel   
return
   
!w::
IfWinExist Microsoft Word
   WinActivate
else
   Run winword
return

F7 & B::
Send, {Enter}Coding: BCD
return

F7 & H::
Send {Enter}Coding: HEX
return

ExpandCollapse:
If (Expanded)
{
   GoSub MinWin
   GuiControl,,ExpandCollapse,>
}
Else
{
   GoSub ExpandWin
   GuiControl,,ExpandCollapse,<
}
Expanded:=!(Expanded)
Return



expandWin:
{
count:=0
WinWidth:=base
loopExpand: ;Start of Loop
if (WinWidth = 815) ;Expand width to 800
goto, endExpand
WinWidth:= base + count*5
gui, show, w%WinWidth%
count++
goto, loopExpand ;End Loop


endExpand:



base:= WinWidth
return

}

minWin:
{
count:=0
WinWidth:=base
loopMin: ;Start of Loop
if (WinWidth = 500) ;Expand width to 800
goto, endMin
WinWidth:= base - count*5
gui, show, w%WinWidth%
count++
goto, loopMin ;End Loop


endMin:
base:=WinWidth
return
}

FileNew:
CurrentFileName="Untitled"
SelectedFileName=
GuiControl,, MainEdit  ; Clear the Edit control.
GuiControl,, FileName, % "Basic Text Editor (Supports Drag/Drop of Files)`nCurrent File: " ShortName(CurrentFileName) ;%

return

GuiDropFiles:  ; Support drag & drop.
Loop, parse, A_GuiEvent, `n
{
    SelectedFileName = %A_LoopField%  ; Get the first file only (in case there's more than one).
    break
}
Gosub FileRead
return

FileRead:  ; Caller has set the variable SelectedFileName for us.
FileRead, MainEdit, %SelectedFileName%  ; Read the file's contents into the variable.
if ErrorLevel
{
   Gui, -AlwaysOnTop
    MsgBox Could not open "%SelectedFileName%".
    Gui, +AlwaysOnTop
   return
}
GuiControl,, MainEdit, %MainEdit%  ; Put the text into the control.
CurrentFileName = %SelectedFileName%
Gui, Show,, %CurrentFileName%   ; Show file name in title bar.
GuiControl,, FileName, % "Basic Text Editor (Supports Drag/Drop of Files)`nCurrent File: " ShortName(CurrentFileName) ;%
return

FileOpen:
Gui +OwnDialogs  ; Force the user to dismiss the FileSelectFile dialog before returning to the main window.
FileSelectFile, SelectedFileName, 3,, Open File, Text Documents (*.txt; *.csv; *xls;)
if SelectedFileName =  ; No file selected.
    return
Gosub FileRead
return
FileSave:
if CurrentFileName =   ; No filename selected yet, so do Save-As instead.
    Goto FileSaveAs
Gosub SaveCurrentFile
return

FileSaveAs:
Gui +OwnDialogs  ; Force the user to dismiss the FileSelectFile dialog before returning to the main window.
FileSelectFile, SelectedFileName, S16,, Save File, Text Documents (*.txt; *.csv; *xls;)
if SelectedFileName =  ; No file selected.
    return
CurrentFileName = %SelectedFileName%
Gosub SaveCurrentFile
return

SaveCurrentFile:  ; Caller has ensured that CurrentFileName is not blank.
IfExist %CurrentFileName%
{
    FileDelete %CurrentFileName%
    if ErrorLevel
    {
        MsgBox The attempt to overwrite "%CurrentFileName%" failed.
        return
    }
}
GuiControlGet, MainEdit  ; Retrieve the contents of the Edit control.
FileAppend, %MainEdit%, %CurrentFileName%  ; Save the contents to the file.
; Upon success, Show file name in title bar (in case we were called by FileSaveAs):
Gui, Show,, %CurrentFileName%
return

ShortName(Name)
{
   Loop, parse, Name, `\  ; Parse the string based on the cent symbol.
   {
      ShortName=%A_loopfield%
      
   }
   Return ShortName
}


#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.


}
Not as pretty as it should be but you get the idea...
_________________
[Join IRC!]

http://www.codeforcure.org/
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group