Softperfect hotkey

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Hayan27
Posts: 10
Joined: 03 Feb 2022, 11:52

Softperfect hotkey

22 Feb 2022, 12:56

Hi guys I’m new to ahi coding and I was trying to get a hockey to work for softperfect connection emulator:
https://www.softperfect.com/products/connectionemulator/
So my code goes like this

Code: Select all

^x::ControlClick, Start, SoftPerfect Connection Emulator          ; hit Ctrl+x
return
The problem is it only works when I open softperfect and then straight after hit ctrl+x 2-3 times for it to start but if I hit it again it doesn’t stop (maybe because the button then is called „Stop“ instead of „Start“ , but if I enter stop too it the code wouldn’t it start and stop at same time?)
And after I manually stop it I can’t start it again with ctrl+x. Then I have to close the program and open again and repeat if I don’t want to manually switch windows and press it everytime. Anyone got a solution for this and why do I need to hit ctrl+x multiple times for it to start since it only need 1 mouse klick for it to start manually.
amateur+
Posts: 655
Joined: 09 Oct 2021, 15:43

Re: Softperfect hotkey

22 Feb 2022, 15:02

Hi! Try this:

Code: Select all

^x::    ; hit Ctrl+x
if !ClickSCE("Stop")
	ClickSCE("Start")
return

ClickSCE(Button) {
	static SCE := "SoftPerfect Connection Emulator"
	ControlFocus, % Button, % SCE
	ControlClick, % Button, % SCE
	return !ErrorLevel
}
Have found any drawback in my code or approach? Please, point it out. /The moderator ordered to remove the rest of the signature, I had obeyed.
And I really apologize for our russian president. Being a citizen of an aggressor country is very shameful. Personally I tried to avoid this trying to defend elections from fraud being a member of the election commission of one of the precincts but only was subjected to a hooligan attack and right before the vote count was illegally escorted from the polling station and spent the night behind bars (in jail) in a result of illegal actions of corrupt policemen.
Hayan27
Posts: 10
Joined: 03 Feb 2022, 11:52

Re: Softperfect hotkey

22 Feb 2022, 17:09

Thx, for your fast answer I will try it out tomorrow and I though you need to tell it how the button is called or it coordinates for it to know which one it has to press
amateur+
Posts: 655
Joined: 09 Oct 2021, 15:43

Re: Softperfect hotkey

22 Feb 2022, 18:14

When you call ClickSCE("Stop") it will look for control named "Stop" and guess what will it look for when you call ClickSCE("Start")? :D
Have found any drawback in my code or approach? Please, point it out. /The moderator ordered to remove the rest of the signature, I had obeyed.
And I really apologize for our russian president. Being a citizen of an aggressor country is very shameful. Personally I tried to avoid this trying to defend elections from fraud being a member of the election commission of one of the precincts but only was subjected to a hooligan attack and right before the vote count was illegally escorted from the polling station and spent the night behind bars (in jail) in a result of illegal actions of corrupt policemen.
Hayan27
Posts: 10
Joined: 03 Feb 2022, 11:52

Re: Softperfect hotkey

23 Feb 2022, 14:54

Hi, sry for late answer I could only test it just now and it doesn’t quite work like it finds the start button and marks it but I need to press the horkey like 4-5 times for it to work and after softperfect is running it doesn’t klick the stop button and isn’t reacting at all after that unless I close the program softperfect and open it again but same happens again after hitting hotkey 4-5 times fast it starts running instead of only marking the button (blue line around the button) and then it’s not reacting anymore any idea ? I also tried reloading the script but doesn’t change anything , but with 1 mouse click manually it starts working so I though I need to imitate a mouse klick with control but that also only marked the button and only pressed it after hitting hockey fast and often.
gregster
Posts: 9103
Joined: 30 Sep 2013, 06:48

Re: Softperfect hotkey

23 Feb 2022, 15:02

Using the program's command line switches (via AHK) might yield better results:
https://www.softperfect.com/products/connectionemulator/manual/ wrote:Command-line switches

SCE supports the following command-line parameters:

Code: Select all

consim.exe [/runtime:120] [/hide] [/quit] [config_file.xml]
If SCE is launched with a XML-file specified, it will load the specified configuration profile and begin emulation automatically. If emulation is already running, it will load the specified file and continue with the new parameters.

If the /runtime switch followed by a number of seconds is present, emulation will run for the specified number of seconds and then the application will terminate. To run the application without the user interface, specify /hide to hide the main window. To terminate emulation immediately, specify /quit to close the running instance.
amateur+
Posts: 655
Joined: 09 Oct 2021, 15:43

Re: Softperfect hotkey

23 Feb 2022, 19:29

If those command line commands indeed do all you need, it will be super easy, just use Run, %Comcpec% consim.exe with the switches you need (or Runwait, %Comcpec% consim.exe
If you want to beat the issue with button clicking you may check whether the buttons react on Space pressing after they become marked blue around after ControlFocus. If yes, you may send Space then instead of clicking: ControlSend, % Button, {Space}, % SCE
Have found any drawback in my code or approach? Please, point it out. /The moderator ordered to remove the rest of the signature, I had obeyed.
And I really apologize for our russian president. Being a citizen of an aggressor country is very shameful. Personally I tried to avoid this trying to defend elections from fraud being a member of the election commission of one of the precincts but only was subjected to a hooligan attack and right before the vote count was illegally escorted from the polling station and spent the night behind bars (in jail) in a result of illegal actions of corrupt policemen.
Hayan27
Posts: 10
Joined: 03 Feb 2022, 11:52

Re: Softperfect hotkey

24 Feb 2022, 10:22

Thx, so much I will try it out :thumbup:
Hayan27
Posts: 10
Joined: 03 Feb 2022, 11:52

Re: Softperfect hotkey

24 Feb 2022, 15:45

Ok, im back and i tested it with the ClickSCE code and the Run, consim.exe and runwait but when I use the hot key it says the it can’t find or execute the file,
Code:
^x:: ; Hit Ctrl+x
Run, %Comcpec% consim.exe;
return

It says: Error; failed attempt to launch program or document:
Action: < consim.exe>
Params: <>
Specifically: The system cant find the file
Line#
001: Return
002: Run, %comcpec% consim.exe;
003: Exit
004: Exit

I also tried to replace the consim.exe with SCE normal name „Softperfect Connection Emulator“
So but wouldn’t that only run the file and if I add the /runtime or /exit I think it would only open up run a certain time and close itself instead of pressing start and stop and I don’t really want it to load the whole thing everytime I press the hotkey but it would be better than nothing if it would atleast work XD.
amateur+
Posts: 655
Joined: 09 Oct 2021, 15:43

Re: Softperfect hotkey

24 Feb 2022, 16:18

Hi!
First of all, I'm an idiot that told you to use comcpec instead of comspec. Really sorry for that.
You must not use semicolon this way: consim.exe; it isn't implied in AutoHotkey syntax. You should use just consim.exe
You can add a space before a semicolon to insert a comment:

Code: Select all

Runwait, %comspec% consim.exe ; My comment for this line
Or you may try to use a full path for consim.exe file.
And you should use switches here, of course:

Code: Select all

Runwait, %comspec% /c consim.exe <switches> , , hide
Experiment on this. If you'll fail describe it and maybe gregster will help you with these switches.
Have found any drawback in my code or approach? Please, point it out. /The moderator ordered to remove the rest of the signature, I had obeyed.
And I really apologize for our russian president. Being a citizen of an aggressor country is very shameful. Personally I tried to avoid this trying to defend elections from fraud being a member of the election commission of one of the precincts but only was subjected to a hooligan attack and right before the vote count was illegally escorted from the polling station and spent the night behind bars (in jail) in a result of illegal actions of corrupt policemen.
Hayan27
Posts: 10
Joined: 03 Feb 2022, 11:52

Re: Softperfect hotkey

25 Feb 2022, 08:59

Hi thx I will try I out and I also got some feedback from softperfect itself they have now added a option for a hotkey:
https://www.softperfect.com/board/read.php?17,28327,28329#msg-28329
Though I hope it works with both Methoden and see which one is better thx again for your help so far
amateur+
Posts: 655
Joined: 09 Oct 2021, 15:43

Re: Softperfect hotkey

25 Feb 2022, 11:36

Definitely the best way is to use native SCE start/stop hotkey once they have added it :).
Have found any drawback in my code or approach? Please, point it out. /The moderator ordered to remove the rest of the signature, I had obeyed.
And I really apologize for our russian president. Being a citizen of an aggressor country is very shameful. Personally I tried to avoid this trying to defend elections from fraud being a member of the election commission of one of the precincts but only was subjected to a hooligan attack and right before the vote count was illegally escorted from the polling station and spent the night behind bars (in jail) in a result of illegal actions of corrupt policemen.
Hayan27
Posts: 10
Joined: 03 Feb 2022, 11:52

Re: Softperfect hotkey

25 Feb 2022, 12:39

Ok so I tested it out right now and I can say the inbuilt hotkey is perfect works fast without errors and really easy to use or change

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: No registered users and 118 guests