<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: macros that are running javascript in PowerMill Forum</title>
    <link>https://forums.autodesk.com/t5/powermill-forum/macros-that-are-running-javascript/m-p/9866225#M10038</link>
    <description>&lt;P&gt;That help. Thank you.&lt;/P&gt;</description>
    <pubDate>Fri, 13 Nov 2020 01:38:18 GMT</pubDate>
    <dc:creator>nozby</dc:creator>
    <dc:date>2020-11-13T01:38:18Z</dc:date>
    <item>
      <title>macros that are running javascript</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/macros-that-are-running-javascript/m-p/9854167#M10031</link>
      <description>&lt;P&gt;Hello all,&lt;BR /&gt;I was hoping that someone can help me with this:&lt;BR /&gt;I have some macros that are running javascript or VBS.&lt;BR /&gt;They can be lunch from a regular MAC file like any other macro using a link like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;STRONG&gt; pmillhelp url fille:///C:\PM_Macro\test\example.html&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;All macros look pretty much the same. Something like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;html&amp;gt;&lt;BR /&gt;&amp;lt;head&amp;gt;&lt;BR /&gt;&amp;lt;script language = "javascript"&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; var PowerMill = top.external;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; function apply_click() {&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;PowerMill.Execute("Do some work",1);&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/P&gt;&lt;P&gt;&amp;lt;/script&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;/head&amp;gt;&lt;BR /&gt;&amp;lt;body&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;form&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;input type = 'button' name = 'button' value = 'apply' OnClick = 'apply_click();'/&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;/form&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;/body&amp;gt;&lt;BR /&gt;&amp;lt;/html&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My problem is that they all need a button to lunch the script, and I can't figure out how do I create something that runs just by lunching the MAC file, which contains the link to that script. In other words, how can I eliminate the button from my programs?&lt;BR /&gt;I hope I am explaining my problem clearly enough.&lt;/P&gt;&lt;P&gt;Thank you for your help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 08 Nov 2020 17:51:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/macros-that-are-running-javascript/m-p/9854167#M10031</guid>
      <dc:creator>nozby</dc:creator>
      <dc:date>2020-11-08T17:51:01Z</dc:date>
    </item>
    <item>
      <title>Re: macros that are running javascript</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/macros-that-are-running-javascript/m-p/9855295#M10032</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;&amp;lt;html&amp;gt;
&amp;lt;head&amp;gt;
&amp;lt;script language = "javascript"&amp;gt;
  var PowerMill = top.external;
  PowerMill.Execute("MESSAGE INFO 'Javascript running'",1);
&amp;lt;/script&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 09 Nov 2020 09:13:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/macros-that-are-running-javascript/m-p/9855295#M10032</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-11-09T09:13:08Z</dc:date>
    </item>
    <item>
      <title>Re: macros that are running javascript</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/macros-that-are-running-javascript/m-p/9855417#M10033</link>
      <description>&lt;P&gt;Thank you for your response, but that's what I'm trying to do and somehow can't make it work. Also, the&amp;nbsp;&lt;SPAN&gt;SPLITTER TABBROWSER keeps opening, and I don't know how to prevent that.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Nov 2020 10:06:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/macros-that-are-running-javascript/m-p/9855417#M10033</guid>
      <dc:creator>nozby</dc:creator>
      <dc:date>2020-11-09T10:06:40Z</dc:date>
    </item>
    <item>
      <title>Re: macros that are running javascript</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/macros-that-are-running-javascript/m-p/9855568#M10034</link>
      <description>&lt;LI-CODE lang="general"&gt;&amp;lt;html&amp;gt;
&amp;lt;head&amp;gt;
&amp;lt;script language = "javascript"&amp;gt;
  var PowerMill = top.external;
  PowerMill.Execute("BROWSER HOME",1);
  PowerMill.Execute("SPLITTER TABEXPLORE",1);
  PowerMill.Execute("EXPLORER SELECT Workplane 'Workplane\\1p' NEW",1);
  PowerMill.Execute("MESSAGE INFO 'Javascript running'",1);
  &amp;lt;/script&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 09 Nov 2020 11:21:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/macros-that-are-running-javascript/m-p/9855568#M10034</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-11-09T11:21:02Z</dc:date>
    </item>
    <item>
      <title>Re: macros that are running javascript</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/macros-that-are-running-javascript/m-p/9857684#M10035</link>
      <description>&lt;P&gt;I'm still doing something wrong. I even copied your code just to make sure I got it right. It is not working.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Nov 2020 05:07:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/macros-that-are-running-javascript/m-p/9857684#M10035</guid>
      <dc:creator>nozby</dc:creator>
      <dc:date>2020-11-10T05:07:25Z</dc:date>
    </item>
    <item>
      <title>Re: macros that are running javascript</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/macros-that-are-running-javascript/m-p/9862936#M10036</link>
      <description>&lt;P&gt;&lt;FONT&gt;Sorry, I only tested from the command line, it worked that way, but it doesn't really work from a macro call. Specifically, javascript runs but does not set the PowerMill variable well. To eliminate the problem&lt;BR /&gt;I did the following: I downloaded AutoIt v3&amp;nbsp;&lt;A title="The AutoIt site" href="https://www.autoitscript.com/site/autoit/" target="_blank" rel="noopener"&gt;https://www.autoitscript.com/site/autoit/&lt;/A&gt;&amp;nbsp; and made it&lt;BR /&gt;a script&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;#include-once
#include &amp;lt;WinAPI.au3&amp;gt;
#include &amp;lt;Memory.au3&amp;gt;
#include &amp;lt;WinAPISys.au3&amp;gt;
#include &amp;lt;WinAPIFiles.au3&amp;gt;
#include &amp;lt;MsgBoxConstants.au3&amp;gt;
Local $DropFile=""
If $CmdLine[0] = 0 Then
   $DropFile="c:\temp\test.html"
Else
   $Dropfile=$CmdLine[1]
EndIf
If Not FileExists($DropFile) Then
   MsgBox($MB_SYSTEMMODAL, "Drag&amp;amp;Drop", "File not found -" &amp;amp; $DropFile, 10)
   Exit
 EndIf
 Local $tPointStruct = _WinAPI_GetMousePos ()
 Local $hWndDragDropTarget = _WinAPI_WindowFromPoint($tPointStruct)
 Local $aWindows = _WinAPI_EnumWindows()
 For $i = 1 To $aWindows[0][0]
   If _WinAPI_IsChild ($hWndDragDropTarget, $aWindows[$i][0] ) Then
      $hWndDragDropTarget = $aWindows[$i][0]
	  ExitLoop
   EndIf
 Next
 $tPointStruct = _WinAPI_GetMousePos (True, $hWndDragDropTarget)
 _FileDragDrop($hWndDragDropTarget,$DropFile,DllStructGetData($tPointStruct, "x"),DllStructGetData($tPointStruct, "y"))
Exit
.
.
.&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT&gt;that performs a drag &amp;amp; drop operation &lt;A title="The original code" href="https://www.autoitscript.com/forum/topic/122881-files-drag-drop/" target="_blank" rel="noopener"&gt;The original code&lt;/A&gt;&amp;nbsp;. This also works well from HTML + javascript macro calls. For security reasons, I uploaded the source code, if you want to try it, compile it.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT&gt;You have to rewrite the file paths, I used the c:\temp folder&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Nov 2020 21:30:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/macros-that-are-running-javascript/m-p/9862936#M10036</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-11-11T21:30:56Z</dc:date>
    </item>
    <item>
      <title>Re: macros that are running javascript</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/macros-that-are-running-javascript/m-p/9862938#M10037</link>
      <description>&lt;P&gt;Oops! double post&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 11 Nov 2020 21:38:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/macros-that-are-running-javascript/m-p/9862938#M10037</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-11-11T21:38:19Z</dc:date>
    </item>
    <item>
      <title>Re: macros that are running javascript</title>
      <link>https://forums.autodesk.com/t5/powermill-forum/macros-that-are-running-javascript/m-p/9866225#M10038</link>
      <description>&lt;P&gt;That help. Thank you.&lt;/P&gt;</description>
      <pubDate>Fri, 13 Nov 2020 01:38:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/powermill-forum/macros-that-are-running-javascript/m-p/9866225#M10038</guid>
      <dc:creator>nozby</dc:creator>
      <dc:date>2020-11-13T01:38:18Z</dc:date>
    </item>
  </channel>
</rss>

