XIM Community

FortyOne AHK Profile Loader - UPDATED  (Read 2109 times)

Offline FortyOne

  • Member
  • *
  • Posts: 324
    • View Profile
  • Gamertag: Forty0ne
  • PSN ID: Forty_One
FortyOne AHK Profile Loader - UPDATED
« on: 07:15 PM - 08/25/16 »
FortyOne User Friendly Profile Loader

I have created a Profile Loader Script that allows me to have one button AHK script loading similar to loading your XIM profiles.  The great thing about this script is when it starts it will kill all other script so that you can load what you need with out having to move files in folders.  All you need to do is assign a profile button for the script you want to load.  You can assign macros or profiles.  You will have only one profile loaded at once so when you load another profile it will automatically kill the old profile.  This in turn allows you to create script for speciific games and just toggle them on and off easily.  You can also assign a toggle key for Your non profile macros.  Do add profile macros just go ahead and copy and paste any of the provided macros and add them to the bottom of this script.  Examples are below

This is what My Script Offers.
  • One Button Profile Loading
  • Universal Profile Suspend Toggle
  • Automatic Enable and Disable of profiles.
  • Custom Macro File Toggle


Profile Script
Code: [Select]
#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.

;--------------------------------------------------------------------------------------------------------
;-----------------------------------------41 Profile Loader----------------------------------------------
;--------------------------------------------------------------------------------------------------------
sleep, 1000
;----------------------------------------------Variable--------------------------------------------------
currentProfile := "" ;Current Loaded Profile
scriptDir := A_ScriptDir ;SandhawC Script Directory
scriptList := Object() ;Array of Excluded Scripts


Loop Files, %scriptDir%\*.ahk, R ;Collect all the script
{
if (A_LoopFileName != A_ScriptName)
{
scriptList.push(A_LoopFileName)
}
}
for index, element in scriptList ;Suspend All Excluded scripts
{
try
{
DetectHiddenWindows On
SetTitleMatchMode RegEx
WinClose, %element% ahk_class AutoHotkey
} Catch {}
}

;----------------------------------------------Functions-------------------------------------------------
LoadProfile(pro) ;Load Profile Function
{
global currentProfile ;Make global so I can have access to it
if (currentProfile != "")
{
DetectHiddenWindows On
SetTitleMatchMode RegEx
WinClose, %currentProfile% ahk_class AutoHotkey
}
currentProfile := pro ;set the new Profile Variable
try
{
DetectHiddenWindows On
SetTitleMatchMode RegEx
run %pro% ahk_class AutoHotkey ;run Profile File
} Catch {}
}

LoadMacros(macro)
{
if WinExist(macro)
{
try
{
DetectHiddenWindows On
SetTitleMatchMode RegEx
WinClose, %macro% ahk_class AutoHotkey
} Catch {}
} else {
try
{
DetectHiddenWindows On
SetTitleMatchMode RegEx
run %macro% ahk_class AutoHotkey
} Catch {}
}
}


suspendProfile()
{
global currentProfile
try
{
DetectHiddenWindows On
SetTitleMatchMode RegEx
WM_COMMAND := 0x111
ID_FILE_SUSPEND := 65404
PostMessage, WM_COMMAND, ID_FILE_SUSPEND,,, %currentProfile% ahk_class AutoHotkey
} Catch {
return
}
}

ScrollLock::
suspendProfile()
return

SetScrollLockState, AlwaysOff

;--------------------------------------------------------------------------------------------------------
;----------------------------Go Ahead and add your profile commands below--------------------------------
;--------------------------------------------------------------------------------------------------------

f1::
LoadProfile("Destiny.ahk")
return

f2::
                LoadProfile("none")
return

f10::
LoadMacros("Test2.ahk")
return

Profile Examples
As you can see to assign a profile or Macro you simply need to choose your profile or macro "key".  In this example i have it set up as F1 for my destiny script since thats the same key i have it set in the XIM.  For the f2 key i set to none since thats my COD profile in XIM.  By doing so I kill the Destiny script.  To assign the script you just put the script name in the function.  The script also hass to be located in the sandhawc script folder in your documents.   On the other hand LoadMacros() acts as a toggle switch for a selected macro file you have picked.  Pressing the f10 here will run or close the script.

Code: [Select]
f1::
LoadProfile("Destiny.ahk")
return

f2::
LoadMacros("Test2.ahk")
return

f3::
LoadProfile("none")
return
« Last Edit: 02:58 PM - 08/27/16 by FortyOne »

Come Join us on Discord.  Its a great way to
chat and meet up with your fellow ximmers.
Just click on the Image to your left to Join.
<------------------------------------------
Link : SandhawC Profile Loader

Online Od1n

  • Global Moderator
  • MVP
  • *
  • Posts: 28140
    • View Profile
Re: FortyOne AHK Profile Template
« Reply #1 on: 04:45 AM - 08/26/16 »
very helpfull and a great idea overall, just saved your script and will use it for when theres a game i want to use a macro on! :)
PS4 & X1 | C: MS | XIM4 | FW: the latest ofc! :) | Mon: BenQ XL2420Z | Pad: Zowie G-SR | KB: Ducky DK1008L Cherry Red O-Rings| A: AKG K701 Creative X7 Antlion Modmic | M: Zowie EC1-A | D: 3200 | P: 1000hz | BF4 4 HIP: 35 ADS: 20

Check out my Youtube Channel: XIMGameplay
Du sprichst Deutsch? Hier gehts zum deutschen Forum

Offline knox66

  • Member
  • *
  • Posts: 143
    • View Profile
  • PSN ID: shogun6x
Re: FortyOne AHK Profile Template
« Reply #2 on: 09:38 AM - 08/26/16 »
thanks! i just got the cable in today so i am going to get started over the weekend.

Offline FortyOne

  • Member
  • *
  • Posts: 324
    • View Profile
  • Gamertag: Forty0ne
  • PSN ID: Forty_One
Re: FortyOne AHK Profile Template
« Reply #3 on: 04:36 PM - 08/26/16 »
Looks like this code has some bugs.  I'm debugging and trying to fix them at the moment.

Come Join us on Discord.  Its a great way to
chat and meet up with your fellow ximmers.
Just click on the Image to your left to Join.
<------------------------------------------
Link : SandhawC Profile Loader

Offline FortyOne

  • Member
  • *
  • Posts: 324
    • View Profile
  • Gamertag: Forty0ne
  • PSN ID: Forty_One
Re: FortyOne AHK Profile Template
« Reply #4 on: 05:45 PM - 08/26/16 »
Actually turns out at this won't work.  Older AHK macros get replaced when opening the new AHK.  I will find a way to get this to work but for now I would Scratch this code I posted.  Its a learning process.

Come Join us on Discord.  Its a great way to
chat and meet up with your fellow ximmers.
Just click on the Image to your left to Join.
<------------------------------------------
Link : SandhawC Profile Loader

Offline FortyOne

  • Member
  • *
  • Posts: 324
    • View Profile
  • Gamertag: Forty0ne
  • PSN ID: Forty_One
Re: FortyOne AHK Profile Loader - UPDATED
« Reply #5 on: 03:03 PM - 08/27/16 »
Okay i updated it an fixed it.  I also have the script now just kill all scripts and just loads what you need.  Turns out if you have multiple AHK with the same keys macroed then it will just overwrite your old macros when another script starts up.

Come Join us on Discord.  Its a great way to
chat and meet up with your fellow ximmers.
Just click on the Image to your left to Join.
<------------------------------------------
Link : SandhawC Profile Loader

Online Od1n

  • Global Moderator
  • MVP
  • *
  • Posts: 28140
    • View Profile
Re: FortyOne AHK Profile Loader - UPDATED
« Reply #6 on: 07:01 PM - 08/27/16 »
thanks for the new version! :)
PS4 & X1 | C: MS | XIM4 | FW: the latest ofc! :) | Mon: BenQ XL2420Z | Pad: Zowie G-SR | KB: Ducky DK1008L Cherry Red O-Rings| A: AKG K701 Creative X7 Antlion Modmic | M: Zowie EC1-A | D: 3200 | P: 1000hz | BF4 4 HIP: 35 ADS: 20

Check out my Youtube Channel: XIMGameplay
Du sprichst Deutsch? Hier gehts zum deutschen Forum

Offline Y2K

  • Member
  • *
  • Posts: 324
    • View Profile
Re: FortyOne AHK Profile Loader - UPDATED
« Reply #7 on: 10:07 PM - 08/27/16 »
Working great !thank
XBOX ONE/PS4 Pro
Netgear r7800 with SQM
Mouse: G403- ceeZa cable with talon grips
keyboard: Leopold FC900R cherry red
Pad: qck+
asus vp28uqg 4k
Game-akgk701/sound blaster x7/modmic

Offline havoxxx

  • MVP
  • *
  • Posts: 816
    • View Profile
Re: FortyOne AHK Profile Loader - UPDATED
« Reply #8 on: 09:20 AM - 08/28/16 »
This is a nice add, good job, now all you got to understand the GUI interface as well ;)
 I have every gun for R6S on a simple turn on and off system :)

This post on their website really helped me out to make my GUI.

https://autohotkey.com/boards/viewtopic.php?f=19&t=10420

Offline FortyOne

  • Member
  • *
  • Posts: 324
    • View Profile
  • Gamertag: Forty0ne
  • PSN ID: Forty_One
Re: FortyOne AHK Profile Loader - UPDATED
« Reply #9 on: 12:55 PM - 08/28/16 »
This is a nice add, good job, now all you got to understand the GUI interface as well ;)
 I have every gun for R6S on a simple turn on and off system :)

This post on their website really helped me out to make my GUI.

https://autohotkey.com/boards/viewtopic.php?f=19&t=10420

This seems like a good idea actually.  Probably wouldnt hurt to create a GUI that updates and shows what profile and what macros are loaded.  Im probably gonna be updating this script more often.

Come Join us on Discord.  Its a great way to
chat and meet up with your fellow ximmers.
Just click on the Image to your left to Join.
<------------------------------------------
Link : SandhawC Profile Loader

Offline havoxxx

  • MVP
  • *
  • Posts: 816
    • View Profile
Re: FortyOne AHK Profile Loader - UPDATED
« Reply #10 on: 05:06 PM - 08/29/16 »
This is a nice add, good job, now all you got to understand the GUI interface as well ;)
 I have every gun for R6S on a simple turn on and off system :)

This post on their website really helped me out to make my GUI.

https://autohotkey.com/boards/viewtopic.php?f=19&t=10420

This seems like a good idea actually.  Probably wouldnt hurt to create a GUI that updates and shows what profile and what macros are loaded.  Im probably gonna be updating this script more often.

here is another good read for ya if you want to keep learning :)

https://github.com/ahkscript/awesome-AutoHotkey#tutorials-gui