in the middle of my for loop I change layouts to do a find but it never actually switch the layout. if I make a stand alone script where I tell it to go to layout "x" it works fine but if I call that script from within my loop or I do it the same way in the loop it doesn't change
Does anyone have any idea why this doesn't work ?
How do you tell it doesn't work? If you simply run it, you may not notice how it changes. Try to run the script in the debugger or add a pause after the Go to Layout command.
Related
I would like to run a Power Automate flow by pressing a keyboard shortcut or alternatively calling it up from CMD or Powershell script.
The flow would simply start execution once the keyboard shortcut is pressed or a Powershell script is run.
As it is now; I need to start Power Automate and then click on play in order to start a specific flow. I am trying to avoid all that.
The ultimate goal is to, once the system is up (Windows 10) and I'm logged it, I press the shortcut key and go do something else and by the time I get back the flow is done. The flow itself works flawlessly. Please note that I am not looking for a solution which would involve smartphones and flow buttons on said phones, purely a Windows , PC, only solution or a way to a solution.
Here is a picture to clarify what Lukas was describing as a workaround.
Create a loop and make sure that the index variable for the loop is 0 so that it will never stop looping. Then make sure to put a 'wait for shortcut key' inside of the loop with you desired shortcut. Below that action and still inside of the loop, put all of your actions.
Run the script and the script will enter the loop at the 'wait for shortcut action. When the shortcut is pressed it will run all of the actions and then loop back to the 'wait for shortcut action again. As long as the script is running in the background the shortcut can trigger it.
Surprisingly, I do not think there is a way to do this. The best solution would probably be to use AutoIT to create a small automation to start your PAD flow.
As long as you're somewhat familiar with programming and even if you're not familiar with AutoIT, it shouldn't take you but a couple hours to write a script that is activatable via hotkey that opens PAD and starts the flow you want.
The AutoIT help file that you get when you install should be all the guidance you need.
(Depending on what your flow actually does, you might be better off just writing your whole automation in AutoIT)
You actually don't need to put everything in a loop, the loop is just from the end of the script to the top label. You just need a label at the top (if you want to be able to press the shortcut more than once), a wait for shortcut key event, and at the end a "go to the label" you created (in the image below it's 'start').
Then you can save the flow and start it. Nothing will happen until you press your shortcut key. Then the flow will execute, and return to the top, waiting for you to press your shortcut again.
You can even have errors go to the start label, instead of ending the script, so that the flow "stays alive".
Just put label on top of your code and then "Wait for shortcut key" and at the end use "go to" function, that will loop the code. This works for me
I have a couple of Rainmeter skins on top of my taskbar that act as a cooler clock, and in order to keep the skins above the taskbar, I have the following code:
[Rainmeter]
Update=500
OnUpdateAction=!ZPos #ZAxis#
[Variables]
ZAxis=1
So that keeps the skins above the taskbar, but it also keeps it above things like youtube running fullscreen. I got an AutoHotKey script that will run a program when a window becomes fullscreen and when it closes fullscreen, so I told it to launch "%PathToRainmerer%\Rainmeter.exe" !SetVariable "ZAxis" "-1" Skin.ini and "1" on the un-fullscreen, but nothing happened.
I checked everything to make sure the AHK script was working, and I even tried to run Rainmeter.exe with the parameters using a shortcut, but nothing worked. I also set up a Meter with Text=#ZAxis# and it stayed at one. I'm guessing the issue is with the syntax, but I can't find proper documentation (probably because I'm so bad at researching). I can provide more details on polite request.
Please remember that kind and respectful comments are greatly appreciated.
Try "\pathtorainmeter\rainmeter.exe" !activateconfig "mainskin folder\skin subfolder" "skin.ini"
Worked for me
I have a Netlogo model that I can use by setting a slider and then pressing the buttons in my interface once each in the following order: setup, go, SetSeed, Share. This all works fine.
I'd like to use Behavior Space to run this 100 times with various values of the slider.
I can get it to work with just setup and go but when I try to include SetSeed and Share the program hangs.
I have put setup in the 'Setup Commands:' box and go in the 'Go Commands:' boxes and that bit works fine.
To then add in SetSeed and Share I have tried adding the following to 'Go Commands:' in the following format:
go
SetSeed
Share
When I try SetSeed or Share on their own without go (just to see what happens) it also hangs (the steps just keep going up and up). Does anyone know what might cause this? I thought Go Commands essentially just had the computer press those buttons once rather then having a user do it?
You need to specify how long you want the run to last, either by entering a number of steps in the experiment setup (in your case, 1), or by specifying a stop condition, for example, you might have the run stop when not any? turtles becomes true. This is documented at http://ccl.northwestern.edu/netlogo/docs/behaviorspace.html#how
In answer to the comment above, the following hack seemed to work. I rewrote the go procedure making it a run once procedure:
to go
getGo ;This procedure does the job that the go command originally did
SetSeed
Share
stop
end
In the go commands I now just have 'go'.
I've scripted a Powershell code and it works perfectly.
But there is a lot a of DB connections or downloading elements from the DB.
That's why when i run my script, it takes a while before the GUI form appears.
Is there someone who knows how to make a progress bar that appears when i execute my script and stop it when the GUI form appears ?
Thank you for your help,
Regards.
you might want to check this.
http://blogs.technet.com/b/heyscriptingguy/archive/2011/01/29/add-a-progress-bar-to-your-powershell-script.aspx
As the title says, is it possible? I've searched all over the internet in order to find it, but whatever variation of my search query I come up with, I end up getting results which are about the move command which is used to move files/folders, instead of the actual prompt.
When doing
mode /?
The only result I can remotely relate to the appearance of the prompt is the Display mode,
(mode con:cols=x lines=y)
As I've said, I can't find any documentation about this & I'm extremely curious, can it be done? I know it can be done in Visual Studio to set a position where it should show it's dialog, so I'm presuming it can be done...
PS: If it can be done, what value should I use to have it perfectly centered when using these size settings?
mode con:cols=50 lines=15
Thank you in advance.
Yorrick
You cannot do so directly from a batch file. However, you can write a small program to do that. The relevant Windows API function is MoveWindow.