I have created some flow using "Power Automate Desktop".
Is there anyway I can see the action from this application or download the code. So that I can create an application then share it with other people.
You're unable to share within your organisation without a licence (trial or paid) in PowerAutomate. You at least need to trigger a trial licence to have that feature.
See the text in orange ...
If you want to download the source, you can literally select all actions within your flow, hit Ctrl + C and then paste the result to a text editor (i.e. like Notepad), save the file and pass it on to another user.
The receiving user can then copy the steps from the text editor and paste them directly into their flow. The steps will translate.
The annoying part comes if you have a lot of sub flows they'll have to be extracted and saved in a text file one by one and then recreated one by one.
stone age code i use to extract Power Automate Desktop query code to a text file
Public Sub glhPAD()
xx = InputBox("Enter number of times to run")
For x = 1 To xx
Open "c:\temp\glhClipboard.txt" For Append As #1
Print #1, "============================================================== "
Print #1, Now()
Close #1
AppActivate "Power Automate": Application.Wait Now + TimeValue("00:00:02")
SendKeys "{F2}": Application.Wait Now + TimeValue("00:00:01")
SendKeys "^c": Application.Wait Now + TimeValue("00:00:01")
SendKeys "{esc}": Application.Wait Now + TimeValue("00:00:01")
Call glhClipboardToTextFile
SendKeys "{enter}": Application.Wait Now + TimeValue("00:00:20")
SendKeys "{tab}": Application.Wait Now + TimeValue("00:00:01")
SendKeys "{tab}": Application.Wait Now + TimeValue("00:00:01")
SendKeys "{tab}": Application.Wait Now + TimeValue("00:00:01")
SendKeys "^a": Application.Wait Now + TimeValue("00:00:01")
SendKeys "^c": Application.Wait Now + TimeValue("00:00:02")
Call glhClipboardToTextFile
SendKeys "%{F4}": Application.Wait Now + TimeValue("00:00:03")
SendKeys "{Down}": Application.Wait Now + TimeValue("00:00:01")
Next x
MsgBox "Capture Done"
End Sub
Public Sub glhClipboardToTextFile()
' reference to Microsoft Forms 2.0 Object Library
' VBEditor / Tools / References
On Error Resume Next
With New DataObject
.GetFromClipboard
Open "c:\temp\glhClipboard.txt" For Append As #1
Print #1, .GetText
Print #1, " "
Print #1, " "
Close #1
End With
End Sub
Related
This question already has answers here:
How do you display a message using VBScript (VBS), without causing an error?
(2 answers)
Closed 5 months ago.
How do I check if I click on a button in a MsgBox?
x = msgbox("Test", 0+16, "Test")
I meant check, not how to make a message box!
Use:
x = msgbox("Test", 0+16, "Test")
if x = number then
msgbox("Hello, World!")
end if
instead of the "number" in the if statement, write the number corresponding with the button that you want to check if pressed. Here are the numbers that you can write:
1 - ok; 2 - cancel; 3 - abort; 4 - retry; 5 - ignore; 6 - yes; 7 - no
You should learn VBScript programming from the ground up.
VBScript Basics, Part 1 | Message Box - Numbers (MsgBox)
VBScript Basics, Part 2 | Message Box - Constants (MsgBox)
VBScript Basics, Part 3 | If - ElseIf - Else - Then Statements
All Vbscript Tutorial Playlist
Here is an example:
Dim AnswerQuestion, Msg, Title
Title = "Answer the question?"
Msg = "Do you like cookies??" & Vbcr &_
"If yes, then click the [YES] button " & Vbcr &_
"If not, then click the [NO] button"
AnswerQuestion = MsgBox(Msg, VbYesNo + VbQuestion, Title)
If AnswerQuestion = VbYes Then
MsgBox "You clicked on the OK button. Good, you're off the hook!", vbInformation, Title
Else
MsgBox "You clicked on the No button! and you're going to jail!", VbCritical, Title
End if
I have written a .vbs script which presently is run manually by users. How can I make this script schedule itself in Task Scheduler (to run at a fixed time each day automatically) on Windows XP and Windows 7 the first time it is executed manually?
EDIT
Option Explicit
Dim oShell : Set oShell = WScript.CreateObject ("WScript.Shell")
Dim FSO : set FSO = CreateObject("Scripting.FileSystemObject")
Dim StartTime,Elapsed
'msgBox(oShell.CurrentDirectory)
'MsgBox(FSO.GetFile(Wscript.ScriptFullName).ParentFolder )
oShell.CurrentDirectory = FSO.GetFile(Wscript.ScriptFullName).ParentFolder
StartTime = Timer
oShell.run "ParentChildLinkFinal.vbs", 1, True
oShell.run "Parent_Child_Merge_final.vbs", 1, True
oShell.run "CycleTime.vbs", 1, True
oShell.run "Baddata.vbs", 1, True
oShell.run "Matrixrefresh.vbs", 1, True
Elapsed = Timer - StartTime
MsgBox("Total time taken to finish this task:" & Elapsed & "in Seconds")
Thanks,
Create a scheduled task to run the following command:
c:\windows\system32\cscript.exe PATH_TO_YOUR_VBS
You can certainly make a vbs file a scheduled task.
The caveat, though, is you want NOTHING to prompt the user...no inputs, no message boxes, nothing. Make sure you've handled and logged your exceptions or you could find yourself with a task that never completes (or worse, operations angrily calling you because a message box popped up at 3am and halted a production process)
on Windows 8: windows tasks that are triggering VBScripts having message boxes will only display the message boxes if the windows task is run under the same user who really is logged on the machine and the if the windows task is configured to "run only if the user is logged on"
I think this changed on windows 8, as on windows 7 I did not had to configure the task in that way
try this
X=MsgBox("Take the Quiz!")
name=inputbox("Name")
q1=inputbox("Question 1 - How many days are there in a leap Year?")
q2=inputbox("Question 2 - How many Suns does Neptune have?")
q3=inputbox("Question 3 - What is your name?")
q4=inputbox("Question 4 - What did one computer say to the other?")
q5=inputbox("Question 5 - Why did the chicken cross the road?")
msgbox("Answers!")
msgbox("Q1 - How many days are there in a leap Year?, you answered ") + q1 + (" ,the correct answer is 366")
msgbox("Q2 - How many Suns does Neptune have?, you answered ") + q2 + (" ,the correct answere is one, our sun.")
msgbox("Q3 - What is your name?, you answered ") + q3 + (", the correct answer is ") + name + (" or is it?")
msgbox("Q4 - What did one computer say to the other?, you answered ") + q4 + (", the correct answer is, 011100110111010101110000 (Binary code for sup)")
msgbox("Q5 - Why did the chicken cross the road?, you answered ") + q5 + (", the correct answer is To get to the other side")
msgbox("Well done, ") + name + (" you have completed the quiz")
I am trying to create a timer that increments at a certain time (in this case, whenever the time is xx:03:24) and sends a notification when it reaches a user-inputted value. Once it does so, it resets the increment and repeats until manually quit.
However, this code is not reliably triggering when it is supposed to. Does anyone have a guess as to why?
on quit
continue quit
end quit
tell application "Notifications Scripting"
set event handlers script path to (path to me)
end tell
global actions, newActions
using terms from application "Notifications Scripting"
on notification activated
tell application "Safari"
activate
set winlist to every window
repeat with win in winlist
set numtabs to 0
try
set tablist to every tab of win
set numtabs to length of tablist
end try
if numtabs is greater than 0 then
repeat with t in tablist
if "fallenlondon.storynexus.com" is in (URL of t as string) then
tell application "System Events"
tell window id (id of win as integer) of application "Safari" to set current tab to tab (index of t as integer)
end tell
end if
end repeat
end if
end repeat
end tell
end notification activated
end using terms from
display dialog "How many actions do you want to build up before being notified?" default answer "1"
set actions to (text returned of result) as number
set newActions to 0
on idle
if ((seconds of (current date)) = 24) and ((minutes of (current date)) mod 10 = 3) then
set newActions to (newActions + 1)
set delayTime to 540
else
set delayTime to 0.5
end if
if newActions ≥ actions then
if newActions = 1 then
tell application "Notifications Scripting" to display notification "Fallen London" message "You have " & newActions & " new action!" sound name "Glass"
else
tell application "Notifications Scripting" to display notification "Fallen London" message "You have " & newActions & " new actions!" sound name "Glass"
end if
set newActions to 0
end if
return delayTime
end idle
I would not expect your idle implementation to work reliably. It is not a precision timing mechanism; therefore the following assumption is unsound:
if ((seconds of (current date)) = 24) and ((minutes of (current date)) mod 10 = 3) then
You're attempting to hit a 1-second window in a 10-minute loop here, and if you miss that window it'll be another 10 minutes till you get to try again.
A reliable way to do it is to store a date representing the time upon which to next trigger, then periodically check if the current date is now after that date and trigger if it does:
to nextTriggerDate() -- returns next xx:x3:23 date
set d to current date
set {d's minutes, d's seconds} to {((d's minutes) div 10 * 10) + 3, 23}
if d < (current date) then set d to d + 10 * minutes
d
end nextTriggerDate
property _triggerDate : nextTriggerDate()
on idle
if (current date) > _triggerDate then
set _triggerDate to nextTriggerDate()
-- DO STUFF HERE...
end if
return 1
end idle
Alternatively, you could use NSTimer via the AppleScript-ObjC bridge, which is designed specifically for this type of task, or set up a launchd script to run an AppleScript on the specified times if you don't want to be tied to a stay-open applet.
I think you have a few things working against you with your code.
First thing to note is that only the code within the idle handler will be called on each idle event. In other words, if you're expecting the main body of your script to run with each idle process, it will not.
try this as an example...
on run
display dialog "hello!" giving up after 3
end run
on idle
display dialog "Idle test!" giving up after 3
return 5
on idle
When you save the code above as a stay open script, you'll get one dialog that says "hello" then you'll get the "Idle test!" message several times, until you quit the script. Remember to save it as "Stay Open"
To fix this, if you expect all the code outside of the idle handler to run, create a custom function from it that you call from your idle handler.
on yourCustomFunction()
-- All the code you want to run prior when the idle function is called
end yourCustomFunction
on idle
yourCustomFunction()
-- any other additional code you want to run here
return 5
end idle
Another thing I'd like to point out. You don't need to tell application "Notifications Scripting", you can just display notification as shown below.
on idle
if ((seconds of (current date)) = 24) and ((minutes of (current date)) mod 10 = 3) then
set newActions to (newActions + 1)
set delayTime to 540
else
set delayTime to 0.5
end if
if newActions ≥ actions then
if newActions = 1 then
display notification "You have " & newActions & " new action!" with title "Fallen London" sound name "Glass"
else
display notification "You have " & newActions & " new actions!" with title "Fallen London" sound name "Glass"
end if
set newActions to 0
end if
return delayTime
end idle
Lastly, I would recommend adding an on run handler rather than just writing your code in the script without it.
I am trying to save this HTML to a HTML file. There are 2 problems with this code.
1. It thinks that the "refresh" part is not part of the string
I have tried a fix for this buy using Chr(34) instead of " but it still bring me onto error 2
2. When I open the HTML File it has quotes around all the text and it looks rubbish
How would I go about fixing these errors? Thanks.
Dim nFileNum as Integer
nFileNum = 4
Open "WebWindow.html" For Output As #nFileNum 'Open the file to put information into
Write #nFileNum, "<meta http-equiv="refresh" content="1" />" 'Refresh Script
Write #nFileNum, "<P>10% Through the current test:</p>"
Write #nFileNum, "<p>Invoices 1/20 (processing)</p>"
Write #nFileNum, "<p>POs 0/20 (waiting)</p>"
Close #nFileNum 'Close the File
EDIT:
Using double quotes kind of works but the output in the web window now looks like this:
"" "
10% Through the current test:
" "
Invoices 1/20 (processing)
" "
POs 0/20 (waiting)
"
and in the HTML file it looks like this:
"<meta http-equiv=""refresh"" content=""1"" />"
"<P>10% Through the current test:</p>"
"<p>Invoices 1/20 (processing)</p>"
"<p>POs 0/20 (waiting)</p>"
So I still have to deal with problem 2....
*EDIT EDIT! FIXED *
I fixed problem 1 with the double quotes (Thanks to you guys) and fixed problem 2 myself. Instead of using Write I used Print. Print does the same thing as write but does not put the quotes in the file with the string.
My new working code:
Function WebOutput()
Dim nFileNum As Integer
Dim Line2 As String
Line2 = "<P>10% Through the current test:</p>"
nFileNum = 4
Open "C:\TestPartner\Config\WebWindow.html" For Output As #nFileNum 'Open the file to put information into
Print #nFileNum, "<meta http-equiv=""refresh"" content=""1"" />" 'Refresh Script
Print #nFileNum, Line2
Print #nFileNum, "<p>Invoices 1/20 (processing)</p>"
Print #nFileNum, "<p>POs 0/20 (waiting)</p>"
Close #nFileNum 'Close the File
To escape quotes in VB you do "" so try "<meta http-equiv=""refresh"" content=""1"" />"
Modify your function to replace any quote marks with double quotes in the string before you write it.
string = replace(string, Chr(34), Chr(34) & Chr(34))
Something like that. The should work. Play around with how many Chr(34) & chr(34) & chr(34) if two doesn't work.
You will have to modify your existing code, you can't get around it, but this is the easiest way to do it.
I have written a .vbs script which presently is run manually by users. How can I make this script schedule itself in Task Scheduler (to run at a fixed time each day automatically) on Windows XP and Windows 7 the first time it is executed manually?
EDIT
Option Explicit
Dim oShell : Set oShell = WScript.CreateObject ("WScript.Shell")
Dim FSO : set FSO = CreateObject("Scripting.FileSystemObject")
Dim StartTime,Elapsed
'msgBox(oShell.CurrentDirectory)
'MsgBox(FSO.GetFile(Wscript.ScriptFullName).ParentFolder )
oShell.CurrentDirectory = FSO.GetFile(Wscript.ScriptFullName).ParentFolder
StartTime = Timer
oShell.run "ParentChildLinkFinal.vbs", 1, True
oShell.run "Parent_Child_Merge_final.vbs", 1, True
oShell.run "CycleTime.vbs", 1, True
oShell.run "Baddata.vbs", 1, True
oShell.run "Matrixrefresh.vbs", 1, True
Elapsed = Timer - StartTime
MsgBox("Total time taken to finish this task:" & Elapsed & "in Seconds")
Thanks,
Create a scheduled task to run the following command:
c:\windows\system32\cscript.exe PATH_TO_YOUR_VBS
You can certainly make a vbs file a scheduled task.
The caveat, though, is you want NOTHING to prompt the user...no inputs, no message boxes, nothing. Make sure you've handled and logged your exceptions or you could find yourself with a task that never completes (or worse, operations angrily calling you because a message box popped up at 3am and halted a production process)
on Windows 8: windows tasks that are triggering VBScripts having message boxes will only display the message boxes if the windows task is run under the same user who really is logged on the machine and the if the windows task is configured to "run only if the user is logged on"
I think this changed on windows 8, as on windows 7 I did not had to configure the task in that way
try this
X=MsgBox("Take the Quiz!")
name=inputbox("Name")
q1=inputbox("Question 1 - How many days are there in a leap Year?")
q2=inputbox("Question 2 - How many Suns does Neptune have?")
q3=inputbox("Question 3 - What is your name?")
q4=inputbox("Question 4 - What did one computer say to the other?")
q5=inputbox("Question 5 - Why did the chicken cross the road?")
msgbox("Answers!")
msgbox("Q1 - How many days are there in a leap Year?, you answered ") + q1 + (" ,the correct answer is 366")
msgbox("Q2 - How many Suns does Neptune have?, you answered ") + q2 + (" ,the correct answere is one, our sun.")
msgbox("Q3 - What is your name?, you answered ") + q3 + (", the correct answer is ") + name + (" or is it?")
msgbox("Q4 - What did one computer say to the other?, you answered ") + q4 + (", the correct answer is, 011100110111010101110000 (Binary code for sup)")
msgbox("Q5 - Why did the chicken cross the road?, you answered ") + q5 + (", the correct answer is To get to the other side")
msgbox("Well done, ") + name + (" you have completed the quiz")